Skip to content

Commit ac800df

Browse files
committed
prefer arrayFirstValue arrayLastValue
1 parent 0697ef0 commit ac800df

File tree

4 files changed

+86
-86
lines changed

4 files changed

+86
-86
lines changed

lib/bald/__init__.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -984,23 +984,23 @@ def _load_netcdf_group_vars(fhandle, agroup, root_container, baseuri, identity_p
984984
len(agroup.variables[name]) > 0):
985985

986986
if not isinstance(agroup.variables[name][0], np.ma.core.MaskedConstant):
987-
sattrs['bald__firstValue'] = agroup.variables[name][0]
988-
if isinstance(sattrs['bald__firstValue'], str):
987+
sattrs['bald__arrayFirstValue'] = agroup.variables[name][0]
988+
if isinstance(sattrs['bald__arrayFirstValue'], str):
989989
pass
990990

991-
elif np.issubdtype(sattrs['bald__firstValue'].dtype, np.integer):
992-
sattrs['bald__firstValue'] = int(sattrs['bald__firstValue'])
993-
elif np.issubdtype(sattrs['bald__firstValue'].dtype, np.floating):
994-
sattrs['bald__firstValue'] = float(sattrs['bald__firstValue'])
991+
elif np.issubdtype(sattrs['bald__arrayFirstValue'].dtype, np.integer):
992+
sattrs['bald__arrayFirstValue'] = int(sattrs['bald__arrayFirstValue'])
993+
elif np.issubdtype(sattrs['bald__arrayFirstValue'].dtype, np.floating):
994+
sattrs['bald__arrayFirstValue'] = float(sattrs['bald__arrayFirstValue'])
995995
if (len(agroup.variables[name]) > 1 and
996996
not isinstance(agroup.variables[name][-1], np.ma.core.MaskedConstant)):
997-
sattrs['bald__lastValue'] = agroup.variables[name][-1]
998-
if isinstance(sattrs['bald__lastValue'], str):
997+
sattrs['bald__arrayLastValue'] = agroup.variables[name][-1]
998+
if isinstance(sattrs['bald__arrayLastValue'], str):
999999
pass
1000-
elif np.issubdtype(sattrs['bald__lastValue'].dtype, np.integer):
1001-
sattrs['bald__lastValue'] = int(sattrs['bald__lastValue'])
1002-
elif np.issubdtype(sattrs['bald__lastValue'].dtype, np.floating):
1003-
sattrs['bald__lastValue'] = float(sattrs['bald__lastValue'])
1000+
elif np.issubdtype(sattrs['bald__arrayLastValue'].dtype, np.integer):
1001+
sattrs['bald__arrayLastValue'] = int(sattrs['bald__arrayLastValue'])
1002+
elif np.issubdtype(sattrs['bald__arrayLastValue'].dtype, np.floating):
1003+
sattrs['bald__arrayLastValue'] = float(sattrs['bald__arrayLastValue'])
10041004

10051005
# datetime special case
10061006
if 'units' in agroup.variables[name].ncattrs():
@@ -1033,7 +1033,7 @@ def _load_netcdf_group_vars(fhandle, agroup, root_container, baseuri, identity_p
10331033
quantity,
10341034
epoch=tog)
10351035
if first is not np.ma.masked:
1036-
sattrs['bald__firstValue'] = edate_first
1036+
sattrs['bald__arrayFirstValue'] = edate_first
10371037
if len(agroup.variables[name]) > 1:
10381038
if agroup.variables[name][0] == fv:
10391039
last = np.ma.MaskedArray(agroup.variables[name][-1],
@@ -1049,7 +1049,7 @@ def _load_netcdf_group_vars(fhandle, agroup, root_container, baseuri, identity_p
10491049
quantity,
10501050
epoch=tog)
10511051

1052-
sattrs['bald__lastValue'] = edate_last
1052+
sattrs['bald__arrayLastValue'] = edate_last
10531053

10541054

10551055

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

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,21 @@ this:co2 a bald:Array ;
3333
NetCDF:scale_factor 0.000981685145029486 ;
3434
NetCDF:units "kg kg**-1" ;
3535
bald:references [ a bald:Reference ;
36-
bald:target this:longitude ;
37-
bald:targetReshape ( 1 1 1 360 ) ;
38-
bald:targetShape ( 360 ) ],
39-
[ a bald:Reference ;
40-
bald:target this:levelist ;
41-
bald:targetReshape ( 1 60 1 1 ) ;
42-
bald:targetShape ( 60 ) ],
36+
bald:target this:time ;
37+
bald:targetReshape ( 1 1 1 1 ) ;
38+
bald:targetShape ( 1 ) ],
4339
[ a bald:Reference ;
4440
bald:target this:latitude ;
4541
bald:targetReshape ( 1 1 181 1 ) ;
4642
bald:targetShape ( 181 ) ],
4743
[ a bald:Reference ;
48-
bald:target this:time ;
49-
bald:targetReshape ( 1 1 1 1 ) ;
50-
bald:targetShape ( 1 ) ] ;
44+
bald:target this:levelist ;
45+
bald:targetReshape ( 1 60 1 1 ) ;
46+
bald:targetShape ( 60 ) ],
47+
[ a bald:Reference ;
48+
bald:target this:longitude ;
49+
bald:targetReshape ( 1 1 1 360 ) ;
50+
bald:targetShape ( 360 ) ] ;
5151
bald:shape ( 1 60 181 360 ) .
5252

5353
this:lnsp a bald:Array ;
@@ -56,46 +56,46 @@ this:lnsp a bald:Array ;
5656
NetCDF:add_offset 11.2087164280841 ;
5757
NetCDF:long_name "Logarithm of surface pressure" ;
5858
bald:references [ a bald:Reference ;
59-
bald:target this:time ;
60-
bald:targetReshape ( 1 1 1 1 ) ;
61-
bald:targetShape ( 1 ) ],
59+
bald:target this:latitude ;
60+
bald:targetReshape ( 1 1 181 1 ) ;
61+
bald:targetShape ( 181 ) ],
6262
[ a bald:Reference ;
6363
bald:target this:levelist ;
6464
bald:targetReshape ( 1 60 1 1 ) ;
6565
bald:targetShape ( 60 ) ],
66-
[ a bald:Reference ;
67-
bald:target this:latitude ;
68-
bald:targetReshape ( 1 1 181 1 ) ;
69-
bald:targetShape ( 181 ) ],
7066
[ a bald:Reference ;
7167
bald:target this:longitude ;
7268
bald:targetReshape ( 1 1 1 360 ) ;
73-
bald:targetShape ( 360 ) ] ;
69+
bald:targetShape ( 360 ) ],
70+
[ a bald:Reference ;
71+
bald:target this:time ;
72+
bald:targetReshape ( 1 1 1 1 ) ;
73+
bald:targetShape ( 1 ) ] ;
7474
bald:shape ( 1 60 181 360 ) .
7575

7676
this:latitude a bald:Array ;
7777
CFTerms:standard_name <http://vocab.nerc.ac.uk/standard_name/latitude/> ;
7878
NetCDF:units "degrees_north" ;
79-
bald:firstValue 90.0 ;
80-
bald:lastValue -90.0 ;
79+
bald:arrayFirstValue 90.0 ;
80+
bald:arrayLastValue -90.0 ;
8181
bald:shape ( 181 ) .
8282

8383
this:levelist a bald:Array ;
8484
NetCDF:long_name "model_level_number" ;
85-
bald:firstValue 1 ;
86-
bald:lastValue 60 ;
85+
bald:arrayFirstValue 1 ;
86+
bald:arrayLastValue 60 ;
8787
bald:shape ( 60 ) .
8888

8989
this:longitude a bald:Array ;
9090
CFTerms:standard_name <http://vocab.nerc.ac.uk/standard_name/longitude/> ;
9191
NetCDF:units "degrees_east" ;
92-
bald:firstValue 0.0 ;
93-
bald:lastValue 359.0 ;
92+
bald:arrayFirstValue 0.0 ;
93+
bald:arrayLastValue 359.0 ;
9494
bald:shape ( 360 ) .
9595

9696
this:time a bald:Array ;
9797
CFTerms:standard_name <http://vocab.nerc.ac.uk/standard_name/time/> ;
9898
NetCDF:units "hours since 1900-01-01 00:00:0.0" ;
99-
bald:firstValue "2006-04-01T00:00:00"^^xsd:dateTime ;
99+
bald:arrayFirstValue "2006-04-01T00:00:00"^^xsd:dateTime ;
100100
bald:shape ( 1 ) .
101101

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

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,17 @@ this__scalar_quantities:air_pressure a bald:Array ;
4141
nc:units "Pa" ;
4242
georef:domain this:theta_points ;
4343
bald:references [ a bald:Reference ;
44-
bald:target this:x_t ;
45-
bald:targetReshape ( 1 1 144 ) ;
46-
bald:targetShape ( 144 ) ],
44+
bald:target this:time ;
45+
bald:targetReshape ( 4 1 1 ) ;
46+
bald:targetShape ( 4 ) ],
4747
[ a bald:Reference ;
4848
bald:target this:y_t ;
4949
bald:targetReshape ( 1 91 1 ) ;
5050
bald:targetShape ( 91 ) ],
5151
[ a bald:Reference ;
52-
bald:target this:time ;
53-
bald:targetReshape ( 4 1 1 ) ;
54-
bald:targetShape ( 4 ) ] ;
52+
bald:target this:x_t ;
53+
bald:targetReshape ( 1 1 144 ) ;
54+
bald:targetShape ( 144 ) ] ;
5555
bald:shape ( 4 91 144 ) .
5656

5757
this__vector_quantities: a bald:Container ;
@@ -70,35 +70,35 @@ this__vector_quantities__wind:u_wind a bald:Array ;
7070
nc:units "m s-1" ;
7171
georef:domain this:u_points ;
7272
bald:references [ a bald:Reference ;
73-
bald:target this:y_t ;
74-
bald:targetReshape ( 1 91 1 ) ;
75-
bald:targetShape ( 91 ) ],
73+
bald:target this:time ;
74+
bald:targetReshape ( 4 1 1 ) ;
75+
bald:targetShape ( 4 ) ],
7676
[ a bald:Reference ;
7777
bald:target this:x_q ;
7878
bald:targetReshape ( 1 1 144 ) ;
7979
bald:targetShape ( 144 ) ],
8080
[ a bald:Reference ;
81-
bald:target this:time ;
82-
bald:targetReshape ( 4 1 1 ) ;
83-
bald:targetShape ( 4 ) ] ;
81+
bald:target this:y_t ;
82+
bald:targetReshape ( 1 91 1 ) ;
83+
bald:targetShape ( 91 ) ] ;
8484
bald:shape ( 4 91 144 ) .
8585

8686
this__vector_quantities__wind:v_wind a bald:Array ;
8787
cf:standard_name <http://vocab.nerc.ac.uk/standard_name/y_wind/> ;
8888
nc:units "m s-1" ;
8989
georef:domain this:v_points ;
9090
bald:references [ a bald:Reference ;
91+
bald:target this:x_t ;
92+
bald:targetReshape ( 1 1 144 ) ;
93+
bald:targetShape ( 144 ) ],
94+
[ a bald:Reference ;
9195
bald:target this:y_q ;
9296
bald:targetReshape ( 1 90 1 ) ;
9397
bald:targetShape ( 90 ) ],
9498
[ a bald:Reference ;
9599
bald:target this:time ;
96100
bald:targetReshape ( 4 1 1 ) ;
97-
bald:targetShape ( 4 ) ],
98-
[ a bald:Reference ;
99-
bald:target this:x_t ;
100-
bald:targetReshape ( 1 1 144 ) ;
101-
bald:targetShape ( 144 ) ] ;
101+
bald:targetShape ( 4 ) ] ;
102102
bald:shape ( 4 90 144 ) .
103103

104104
this:theta_points a bald:Resource ;
@@ -122,34 +122,34 @@ this:v_points a bald:Resource ;
122122
this:x_q a bald:Array ;
123123
cf:standard_name <http://vocab.nerc.ac.uk/standard_name/longitude/> ;
124124
nc:units "degrees" ;
125-
bald:firstValue 1.25 ;
126-
bald:lastValue 358.75 ;
125+
bald:arrayFirstValue 1.25 ;
126+
bald:arrayLastValue 358.75 ;
127127
bald:shape ( 144 ) .
128128

129129
this:y_q a bald:Array ;
130130
cf:standard_name <http://vocab.nerc.ac.uk/standard_name/latitude/> ;
131131
nc:units "degrees" ;
132-
bald:firstValue -89.0 ;
133-
bald:lastValue 89.0 ;
132+
bald:arrayFirstValue -89.0 ;
133+
bald:arrayLastValue 89.0 ;
134134
bald:shape ( 90 ) .
135135

136136
this:time a bald:Array ;
137137
rdfs:label "Time" ;
138-
bald:firstValue "2020-05-05T00:00Z" ;
139-
bald:lastValue "2020-05-05T18:00Z" ;
138+
bald:arrayFirstValue "2020-05-05T00:00Z" ;
139+
bald:arrayLastValue "2020-05-05T18:00Z" ;
140140
bald:shape ( 4 ) .
141141

142142
this:x_t a bald:Array ;
143143
cf:standard_name <http://vocab.nerc.ac.uk/standard_name/longitude/> ;
144144
nc:units "degrees" ;
145-
bald:firstValue 0.0 ;
146-
bald:lastValue 357.5 ;
145+
bald:arrayFirstValue 0.0 ;
146+
bald:arrayLastValue 357.5 ;
147147
bald:shape ( 144 ) .
148148

149149
this:y_t a bald:Array ;
150150
cf:standard_name <http://vocab.nerc.ac.uk/standard_name/latitude/> ;
151151
nc:units "degrees" ;
152-
bald:firstValue -90.0 ;
153-
bald:lastValue 90.0 ;
152+
bald:arrayFirstValue -90.0 ;
153+
bald:arrayLastValue 90.0 ;
154154
bald:shape ( 91 ) .
155155

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

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,21 @@ this:votemper a bald:Array ;
4040
NetCDF:long_name "Temperature" ;
4141
NetCDF:units "degC" ;
4242
bald:references [ a bald:Reference ;
43-
bald:target this:time ;
44-
bald:targetReshape ( 4 1 1 1 ) ;
43+
bald:target this:deptht ;
44+
bald:targetReshape ( 1 4 1 1 ) ;
4545
bald:targetShape ( 4 ) ],
46-
[ a bald:Reference ;
47-
bald:sourceReshape ( 1 4 4 148 180 ) ;
48-
bald:target this:votemper_pdf ;
49-
bald:targetShape ( 19 4 4 148 180 ) ],
5046
[ a bald:Reference ;
5147
bald:target this:nav_lon ;
5248
bald:targetReshape ( 1 1 148 180 ) ;
5349
bald:targetShape ( 148 180 ) ],
5450
[ a bald:Reference ;
55-
bald:target this:deptht ;
56-
bald:targetReshape ( 1 4 1 1 ) ;
51+
bald:target this:time ;
52+
bald:targetReshape ( 4 1 1 1 ) ;
5753
bald:targetShape ( 4 ) ],
54+
[ a bald:Reference ;
55+
bald:sourceReshape ( 1 4 4 148 180 ) ;
56+
bald:target this:votemper_pdf ;
57+
bald:targetShape ( 19 4 4 148 180 ) ],
5858
[ a bald:Reference ;
5959
bald:target this:nav_lat ;
6060
bald:targetReshape ( 1 1 148 180 ) ;
@@ -64,8 +64,8 @@ this:votemper a bald:Array ;
6464
this:percentiles a bald:Array ;
6565
NetCDF:long_name "percentile" ;
6666
NetCDF:units "1" ;
67-
bald:firstValue 5.0 ;
68-
bald:lastValue 95.0 ;
67+
bald:arrayFirstValue 5.0 ;
68+
bald:arrayLastValue 95.0 ;
6969
bald:shape ( 19 ) .
7070

7171
this:deptht_bnds a bald:Array ;
@@ -91,9 +91,9 @@ this:votemper_pdf a bald:Array ;
9191
NetCDF:long_name "Temperature" ;
9292
NetCDF:units "degC" ;
9393
bald:references [ a bald:Reference ;
94-
bald:target this:nav_lat ;
95-
bald:targetReshape ( 1 1 1 148 180 ) ;
96-
bald:targetShape ( 148 180 ) ],
94+
bald:target this:percentiles ;
95+
bald:targetReshape ( 19 1 1 1 1 ) ;
96+
bald:targetShape ( 19 ) ],
9797
[ a bald:Reference ;
9898
bald:target this:time ;
9999
bald:targetReshape ( 1 4 1 1 1 ) ;
@@ -107,9 +107,9 @@ this:votemper_pdf a bald:Array ;
107107
bald:targetReshape ( 1 1 1 148 180 ) ;
108108
bald:targetShape ( 148 180 ) ],
109109
[ a bald:Reference ;
110-
bald:target this:percentiles ;
111-
bald:targetReshape ( 19 1 1 1 1 ) ;
112-
bald:targetShape ( 19 ) ] ;
110+
bald:target this:nav_lat ;
111+
bald:targetReshape ( 1 1 1 148 180 ) ;
112+
bald:targetShape ( 148 180 ) ] ;
113113
bald:shape ( 19 4 4 148 180 ) .
114114

115115
this:nav_lat a bald:Array ;
@@ -143,8 +143,8 @@ this:time a bald:Array ;
143143
NetCDF:long_name "Time axis" ;
144144
NetCDF:title "Time" ;
145145
NetCDF:units "hours since 2001-01-01 00:00:00" ;
146-
bald:firstValue "2001-01-01T00:00:00"^^xsd:dateTime ;
147-
bald:lastValue "2001-01-04T00:00:00"^^xsd:dateTime ;
146+
bald:arrayFirstValue "2001-01-01T00:00:00"^^xsd:dateTime ;
147+
bald:arrayLastValue "2001-01-04T00:00:00"^^xsd:dateTime ;
148148
bald:shape ( 4 ) .
149149

150150
this:deptht a bald:Array ;
@@ -154,8 +154,8 @@ this:deptht a bald:Array ;
154154
NetCDF:long_name "Vertical T levels" ;
155155
NetCDF:title "deptht" ;
156156
NetCDF:units "m" ;
157-
bald:firstValue 0.0 ;
158-
bald:lastValue 1000.0 ;
157+
bald:arrayFirstValue 0.0 ;
158+
bald:arrayLastValue 1000.0 ;
159159
bald:references [ a bald:Reference ;
160160
bald:sourceReshape ( 4 1 ) ;
161161
bald:target this:deptht_bnds ;

0 commit comments

Comments
 (0)