Skip to content

Commit eca8da6

Browse files
jyucsiromarqh
authored andcommitted
Adding ereefs example with ncld annotations to a branch (#13)
* Adding ereefs example with ncld annotations
1 parent c8aad63 commit eca8da6

File tree

2 files changed

+160
-5
lines changed

2 files changed

+160
-5
lines changed
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
netcdf gbr4_1.85 {
2+
dimensions:
3+
i = 600 ;
4+
j = 180 ;
5+
k = 47 ;
6+
time = 50521 ;
7+
variables:
8+
double zc(k) ;
9+
zc:axis = "Z" ;
10+
zc:coordinate_type = "Z" ;
11+
zc:units = "m" ;
12+
zc:positive = "up" ;
13+
zc:long_name = "Z coordinate" ;
14+
double longitude(j, i) ;
15+
longitude:standard_name = "longitude" ;
16+
longitude:coordinate_type = "longitude" ;
17+
longitude:projection = "geographic" ;
18+
longitude:units = "degrees_east" ;
19+
longitude:long_name = "Longitude" ;
20+
double latitude(j, i) ;
21+
latitude:standard_name = "latitude" ;
22+
latitude:coordinate_type = "latitude" ;
23+
latitude:projection = "geographic" ;
24+
latitude:units = "degrees_north" ;
25+
latitude:long_name = "Latitude" ;
26+
double botz(j, i) ;
27+
botz:standard_name = "depth" ;
28+
botz:missing_value = -99. ;
29+
botz:positive = "down" ;
30+
botz:coordinates = "latitude longitude" ;
31+
botz:outside = "9999" ;
32+
botz:units = "metre" ;
33+
botz:long_name = "Depth of sea-bed" ;
34+
double time(time) ;
35+
time:units = "days since 1990-01-01 00:00:00 +10" ;
36+
time:long_name = "Time" ;
37+
time:standard_name = "time" ;
38+
time:coordinate_type = "time" ;
39+
time:_ChunkSizes = 1 ;
40+
float eta(time, j, i) ;
41+
eta:coordinates = "time latitude longitude" ;
42+
eta:units = "metre" ;
43+
eta:long_name = "Surface elevation" ;
44+
eta:standard_name = "sea_surface_height_above_sea_level" ;
45+
eta:valid_range = -10.f, 10.f ;
46+
eta:missing_value = 1.e+35f ;
47+
eta:positive = "up" ;
48+
eta:medium_id = "http://environment.data.gov.au/def/feature/ocean" ;
49+
eta:scaledQuantityKind_id = "http://environment.data.gov.au/def/property/sea_surface_elevation" ;
50+
eta:substanceOrTaxon_id = "http://environment.data.gov.au/def/feature/ocean_near_surface" ;
51+
eta:unit_id = "http://qudt.org/vocab/unit#Meter" ;
52+
eta:_ChunkSizes = 1, 180, 600 ;
53+
float u(time, k, j, i) ;
54+
u:coordinates = "time zc latitude longitude" ;
55+
u:units = "ms-1" ;
56+
u:long_name = "Eastward current" ;
57+
u:standard_name = "eastward_sea_water_velocity" ;
58+
u:vector_name = "Currents" ;
59+
u:vector_components = "u v" ;
60+
u:valid_range = -100.f, 100.f ;
61+
u:missing_value = 1.e+35f ;
62+
u:medium_id = "http://environment.data.gov.au/def/feature/ocean" ;
63+
u:scaledQuantityKind_id = "http://environment.data.gov.au/def/property/sea_water_velocity_eastward" ;
64+
u:substanceOrTaxon_id = "http://environment.data.gov.au/def/feature/ocean_current" ;
65+
u:unit_id = "http://qudt.org/vocab/unit#MeterPerSecond" ;
66+
u:_ChunkSizes = 1, 24, 90, 300 ;
67+
float v(time, k, j, i) ;
68+
v:coordinates = "time zc latitude longitude" ;
69+
v:units = "ms-1" ;
70+
v:long_name = "Northward current" ;
71+
v:standard_name = "northward_sea_water_velocity" ;
72+
v:vector_name = "Currents" ;
73+
v:vector_components = "u v" ;
74+
v:valid_range = -100.f, 100.f ;
75+
v:missing_value = 1.e+35f ;
76+
v:medium_id = "http://environment.data.gov.au/def/feature/ocean" ;
77+
v:scaledQuantityKind_id = "http://environment.data.gov.au/def/property/sea_water_velocity_northward" ;
78+
v:substanceOrTaxon_id = "http://environment.data.gov.au/def/feature/ocean_current" ;
79+
v:unit_id = "http://qudt.org/vocab/unit#MeterPerSecond" ;
80+
v:_ChunkSizes = 1, 24, 90, 300 ;
81+
float salt(time, k, j, i) ;
82+
salt:coordinates = "time zc latitude longitude" ;
83+
salt:units = "PSU" ;
84+
salt:long_name = "Salinity" ;
85+
salt:valid_range = 0.f, 40.f ;
86+
salt:missing_value = 1.e+35f ;
87+
salt:medium_id = "http://environment.data.gov.au/def/feature/ocean" ;
88+
salt:scaledQuantityKind_id = "http://environment.data.gov.au/def/property/practical_salinity" ;
89+
salt:substanceOrTaxon_id = "http://sweet.jpl.nasa.gov/2.2/matrWater.owl#SaltWater" ;
90+
salt:unit_id = "http://environment.data.gov.au/water/quality/def/unit/PSU" ;
91+
salt:_ChunkSizes = 1, 24, 90, 300 ;
92+
float temp(time, k, j, i) ;
93+
temp:coordinates = "time zc latitude longitude" ;
94+
temp:units = "degrees C" ;
95+
temp:long_name = "Temperature" ;
96+
temp:valid_range = 0.f, 40.f ;
97+
temp:missing_value = 1.e+35f ;
98+
temp:medium_id = "http://environment.data.gov.au/def/feature/ocean" ;
99+
temp:scaledQuantityKind_id = "http://environment.data.gov.au/def/property/sea_water_temperature" ;
100+
temp:substanceOrTaxon_id = "http://sweet.jpl.nasa.gov/2.2/matrWater.owl#SaltWater" ;
101+
temp:unit_id = "http://qudt.org/vocab/unit#DegreeCelsius" ;
102+
temp:_ChunkSizes = 1, 24, 90, 300 ;
103+
float wspeed_u(time, j, i) ;
104+
wspeed_u:coordinates = "time latitude longitude" ;
105+
wspeed_u:units = "ms-1" ;
106+
wspeed_u:long_name = "eastward_wind" ;
107+
wspeed_u:valid_range = -1000.f, 1000.f ;
108+
wspeed_u:missing_value = 1.e+35f ;
109+
wspeed_u:_ChunkSizes = 1, 180, 600 ;
110+
float wspeed_v(time, j, i) ;
111+
wspeed_v:coordinates = "time latitude longitude" ;
112+
wspeed_v:units = "ms-1" ;
113+
wspeed_v:long_name = "northward_wind" ;
114+
wspeed_v:valid_range = -1000.f, 1000.f ;
115+
wspeed_v:missing_value = 1.e+35f ;
116+
wspeed_v:_ChunkSizes = 1, 180, 600 ;
117+
118+
// global attributes:
119+
:title = "GBR4 Hydro" ;
120+
:paramhead = "GBR 4km resolution grid" ;
121+
:paramfile = "in.prm" ;
122+
:shoc_version = "v1.1 rev(5249)" ;
123+
:Conventions = "CF-1.0" ;
124+
:Run_ID = 1.85 ;
125+
:hasVocab = 1 ;
126+
:metadata_link = "http://marlin.csiro.au/geonetwork/srv/eng/search?&uuid=72020224-f086-434a-bbe9-a222c8e5cf0d" ;
127+
:rdf__type = "bald__Container" ;
128+
:bald__isPrefixedBy = "prefix_list" ;
129+
:bald__isAliasedBy = "alias_list" ;
130+
131+
group: prefix_list {
132+
// group attributes:
133+
:bald__ = "http://binary-array-ld.net/latest/" ;
134+
:rdf__ = "http://www.w3.org/1999/02/22-rdf-syntax-ns#" ;
135+
} // group bald__prefix_list
136+
137+
group: alias_list {
138+
// group attributes:
139+
:unit_id = "http://qudt.org/1.1/schema/qudt#unit";
140+
:medium_id = "http://environment.data.gov.au/def/op#matrix" ;
141+
:scaledQuantityKind_id = "http://environment.data.gov.au/def/op#propertyKind" ;
142+
:substanceOrTaxon_id = "http://environment.data.gov.au/def/op#objectOfInterest" ;
143+
} // group bald__alias_list
144+
145+
}

lib/bald/tests/integration/test_cdl.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,41 @@
88
import bald
99
from bald.tests import BaldTestCase
1010

11+
1112
class Test(BaldTestCase):
1213
def setUp(self):
1314
self.cdl_path = os.path.join(os.path.dirname(__file__), 'CDL')
14-
print(self.cdl_path)
15-
15+
1616
def test_array_reference(self):
1717
with self.temp_filename('.nc') as tfile:
1818
cdl_file = os.path.join(self.cdl_path, 'array_reference.cdl')
1919
subprocess.check_call(['ncgen', '-o', tfile, cdl_file])
2020
validation = bald.validate_netcdf(tfile)
2121
exns = validation.exceptions()
22-
self.assertTrue(validation.is_valid(), msg='{} != []'.format(exns))
22+
self.assertTrue(validation.is_valid(), msg='{} != []'.format(exns))
2323

2424
def test_alias(self):
2525
with self.temp_filename('.nc') as tfile:
2626
cdl_file = os.path.join(self.cdl_path, 'array_alias.cdl')
2727
subprocess.check_call(['ncgen', '-o', tfile, cdl_file])
2828
validation = bald.validate_netcdf(tfile)
2929
exns = validation.exceptions()
30-
self.assertTrue(validation.is_valid(), msg='{} != []'.format(exns))
31-
30+
self.assertTrue(validation.is_valid(), msg='{} != []'.format(exns))
31+
3232
def test_process_chain(self):
3333
with self.temp_filename('.nc') as tfile:
3434
cdl_file = os.path.join(self.cdl_path, 'ProcessChain0300.cdl')
3535
subprocess.check_call(['ncgen', '-o', tfile, cdl_file])
3636
validation = bald.validate_netcdf(tfile)
3737
exns = validation.exceptions()
3838
self.assertTrue(validation.is_valid(), msg='{} != []'.format(exns))
39+
40+
def test_ereef(self):
41+
with self.temp_filename('.nc') as tfile:
42+
cdl_file = os.path.join(self.cdl_path, 'ereefs-gbr4_ncld.cdl')
43+
subprocess.check_call(['ncgen', '-o', tfile, cdl_file])
44+
validation = bald.validate_netcdf(tfile)
45+
exns = validation.exceptions()
46+
#self.assertTrue(validation.is_valid(), msg='{} != []'.format(exns))
47+
self.assertFalse(validation.is_valid(), msg='AssertionError: [\'http://qudt.org/vocab/unit#Meter is not resolving as a resource (404).\', \'http://qudt.org/vocab/unit#MeterPerSecond is not resolving as a resource (404).\', \'http://qudt.org/vocab/unit#MeterPerSecond is not resolving as a resource (404).\', \'http://qudt.org/vocab/unit#DegreeCelsius is not resolving as a resource (404).\']. Also {} != []'.format(exns))
48+

0 commit comments

Comments
 (0)