Skip to content

Commit de9cf44

Browse files
authored
Cfncregisters (#78)
* use NetCDF long_name * updated namespaces * TTL namespace and ordering * prefer ns1 namespace in test files
1 parent 040edac commit de9cf44

File tree

8 files changed

+96
-87
lines changed

8 files changed

+96
-87
lines changed

lib/bald/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,7 @@ def rdfgraph(self):
577577
"""
578578
graph = rdflib.Graph()
579579
graph.bind('bald', 'http://binary-array-ld.net/latest/')
580+
graph.bind('ns1', self.baseuri + '/')
580581
for prefix_name in self.prefixes():
581582

582583
#strip the double underscore suffix

lib/bald/tests/integration/CDL/array_geo.cdl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,17 @@ variables:
99
prefix_list:rdfs__ = "http://www.w3.org/2000/01/rdf-schema#" ;
1010
prefix_list:cf__ = "http://def.scitools.org.uk/CFTerms/" ;
1111
prefix_list:geo__ = "http://www.opengis.net/ont/geosparql#" ;
12+
prefix_list:nc__ = "http://def.scitools.org.uk/NetCDF/" ;
1213

1314
int temp(pdim0, pdim1) ;
1415
temp:cf__standard_name = "air_temperature" ;
15-
temp:cf__long_name = "Air temperature obs example at point" ;
16+
temp:nc__long_name = "Air temperature obs example at point" ;
1617
temp:rdfs__label = "Air temperature obs example at point" ;
1718
temp:geo__asWKT = "POINT(-77.03524 38.889468)" ;
1819

1920
int pressure(pdim0, pdim1) ;
2021
pressure:cf__standard_name = "air_pressure" ;
21-
pressure:cf__long_name = "Air pressure at UCAR Centre Green" ;
22+
pressure:nc__long_name = "Air pressure at UCAR Centre Green" ;
2223
pressure:rdfs__label = "Air pressure at UCAR Centre Green" ;
2324
pressure:geo__asWKT = "POINT(-105.24584700000003 40.0315278)" ;
2425

lib/bald/tests/integration/CDL/array_multitypes.cdl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,18 @@ variables:
99
prefix_list:rdfs__ = "http://www.w3.org/2000/01/rdf-schema#" ;
1010
prefix_list:cf__ = "http://def.scitools.org.uk/CFTerms/" ;
1111
prefix_list:geo__ = "http://www.opengis.net/ont/geosparql#" ;
12+
prefix_list:nc__ = "http://def.scitools.org.uk/NetCDF/" ;
1213

1314
int temp(pdim0, pdim1) ;
1415
temp:cf__standard_name = "air_temperature" ;
15-
temp:cf__long_name = "Air temperature obs example at point" ;
16+
temp:nc__long_name = "Air temperature obs example at point" ;
1617
temp:rdfs__label = "Air temperature obs example at point" ;
1718
temp:geo__asWKT = "POINT(-77.03524 38.889468)" ;
1819

1920
int pressure(pdim0, pdim1) ;
2021
:rdf__type = "geo__Geometry" ;
2122
pressure:cf__standard_name = "air_pressure" ;
22-
pressure:cf__long_name = "Air pressure at UCAR Centre Green" ;
23+
pressure:nc__long_name = "Air pressure at UCAR Centre Green" ;
2324
pressure:rdfs__label = "Air pressure at UCAR Centre Green" ;
2425
pressure:geo__asWKT = "POINT(-105.24584700000003 40.0315278)" ;
2526

lib/bald/tests/integration/TTL/GEMS_CO2_Apr2006.ttl

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@prefix CFTerms: <http://def.scitools.org.uk/CFTerms/> .
2+
@prefix NetCDF: <http://def.scitools.org.uk/NetCDF/> .
23
@prefix bald: <http://binary-array-ld.net/latest/> .
34
@prefix cf_sname: <http://vocab.nerc.ac.uk/standard_name/> .
45
@prefix ns1: <file://CDL/GEMS_CO2_Apr2006.cdl/> .
@@ -8,7 +9,6 @@
89
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
910

1011
<file://CDL/GEMS_CO2_Apr2006.cdl> a bald:Container ;
11-
ns1:Conventions "CF-1.0" ;
1212
bald:contains ns1:co2,
1313
ns1:co2_latitude_ref,
1414
ns1:co2_levelist_ref,
@@ -20,33 +20,34 @@
2020
ns1:lnsp_levelist_ref,
2121
ns1:lnsp_time_ref,
2222
ns1:longitude,
23-
ns1:time .
23+
ns1:time ;
24+
NetCDF:Conventions "CF-1.0" .
2425

2526
ns1:co2 a bald:Array ;
26-
ns1:_FillValue "-32767" ;
2727
bald:references ns1:co2_latitude_ref,
2828
ns1:co2_levelist_ref,
2929
ns1:co2_time_ref,
3030
ns1:longitude ;
3131
bald:shape "(1, 60, 181, 360)" ;
32-
CFTerms:add_offset 403.192219379918 ;
33-
CFTerms:long_name "Carbon Dioxide" ;
3432
CFTerms:missing_value "-32767" ;
35-
CFTerms:scale_factor 0.000981685145029486 ;
3633
CFTerms:standard_name <http://vocab.nerc.ac.uk/standard_name/mass_fraction_of_carbon_dioxide_in_air/> ;
37-
CFTerms:units "kg kg**-1" .
34+
NetCDF:FillValue "-32767" ;
35+
NetCDF:add_offset 403.192219379918 ;
36+
NetCDF:long_name "Carbon Dioxide" ;
37+
NetCDF:scale_factor 0.000981685145029486 ;
38+
NetCDF:units "kg kg**-1" .
3839

3940
ns1:lnsp a bald:Array ;
40-
ns1:_FillValue "-32767" ;
4141
bald:references ns1:lnsp_latitude_ref,
4242
ns1:lnsp_levelist_ref,
4343
ns1:lnsp_time_ref,
4444
ns1:longitude ;
4545
bald:shape "(1, 60, 181, 360)" ;
46-
CFTerms:add_offset 11.2087164280841 ;
47-
CFTerms:long_name "Logarithm of surface pressure" ;
4846
CFTerms:missing_value "-32767" ;
49-
CFTerms:scale_factor 1.03952457840347e-05 .
47+
NetCDF:FillValue "-32767" ;
48+
NetCDF:add_offset 11.2087164280841 ;
49+
NetCDF:long_name "Logarithm of surface pressure" ;
50+
NetCDF:scale_factor 1.03952457840347e-05 .
5051

5152
ns1:co2_latitude_ref a bald:Reference,
5253
bald:Subject ;
@@ -85,15 +86,15 @@ ns1:latitude a bald:Array,
8586
bald:last_value -90.0 ;
8687
bald:shape "(181,)" ;
8788
CFTerms:standard_name <http://vocab.nerc.ac.uk/standard_name/latitude/> ;
88-
CFTerms:units "degrees_north" .
89+
NetCDF:units "degrees_north" .
8990

9091
ns1:levelist a bald:Array,
9192
bald:Reference ;
9293
bald:array ns1:levelist ;
9394
bald:first_value 1 ;
9495
bald:last_value 60 ;
9596
bald:shape "(60,)" ;
96-
CFTerms:long_name "model_level_number" .
97+
NetCDF:long_name "model_level_number" .
9798

9899
ns1:longitude a bald:Array,
99100
bald:Reference ;
@@ -102,13 +103,13 @@ ns1:longitude a bald:Array,
102103
bald:last_value 359.0 ;
103104
bald:shape "(360,)" ;
104105
CFTerms:standard_name <http://vocab.nerc.ac.uk/standard_name/longitude/> ;
105-
CFTerms:units "degrees_east" .
106+
NetCDF:units "degrees_east" .
106107

107108
ns1:time a bald:Array,
108109
bald:Reference ;
109110
bald:array ns1:time ;
110111
bald:first_value "2006-04-01T00:00:00"^^xsd:dateTime ;
111112
bald:shape "(1,)" ;
112113
CFTerms:standard_name <http://vocab.nerc.ac.uk/standard_name/time/> ;
113-
CFTerms:units "hours since 1900-01-01 00:00:0.0" .
114+
NetCDF:units "hours since 1900-01-01 00:00:0.0" .
114115

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
@prefix bald: <http://binary-array-ld.net/latest/> .
2+
@prefix ns1: <file://CDL/array_reference.cdl/> .
23
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
34
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
45
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
56
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
67

78
<file://CDL/array_reference.cdl> a bald:Container ;
8-
bald:contains <file://CDL/array_reference.cdl/child_variable>,
9-
<file://CDL/array_reference.cdl/parent_variable> ;
9+
bald:contains ns1:child_variable,
10+
ns1:parent_variable ;
1011
bald:isPrefixedBy "prefix_list" .
1112

12-
<file://CDL/array_reference.cdl/parent_variable> a bald:Array ;
13-
bald:references <file://CDL/array_reference.cdl/child_variable> ;
13+
ns1:parent_variable a bald:Array ;
14+
bald:references ns1:child_variable ;
1415
bald:shape "(11, 17)" .
1516

16-
<file://CDL/array_reference.cdl/child_variable> a bald:Array,
17+
ns1:child_variable a bald:Array,
1718
bald:Reference ;
18-
bald:array <file://CDL/array_reference.cdl/child_variable> ;
19+
bald:array ns1:child_variable ;
1920
bald:shape "(11, 17)" .
2021

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
@prefix bald: <http://binary-array-ld.net/latest/> .
2+
@prefix ns1: <http://example.org/base/> .
23
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
34
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
45
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
56
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
67

78
<http://example.org/base> a bald:Container ;
8-
bald:contains <http://example.org/base/child_variable>,
9-
<http://example.org/base/parent_variable> ;
9+
bald:contains ns1:child_variable,
10+
ns1:parent_variable ;
1011
bald:isPrefixedBy "prefix_list" .
1112

12-
<http://example.org/base/parent_variable> a bald:Array ;
13-
bald:references <http://example.org/base/child_variable> ;
13+
ns1:parent_variable a bald:Array ;
14+
bald:references ns1:child_variable ;
1415
bald:shape "(11, 17)" .
1516

16-
<http://example.org/base/child_variable> a bald:Array,
17+
ns1:child_variable a bald:Array,
1718
bald:Reference ;
18-
bald:array <http://example.org/base/child_variable> ;
19+
bald:array ns1:child_variable ;
1920
bald:shape "(11, 17)" .
2021

0 commit comments

Comments
 (0)