Skip to content

Commit 0d9fb12

Browse files
committed
update test results
1 parent c889e42 commit 0d9fb12

File tree

5 files changed

+181
-171
lines changed

5 files changed

+181
-171
lines changed

lib/bald/__init__.py

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -873,8 +873,6 @@ def load_netcdf(afilepath, baseuri=None, alias_dict=None, cache=None):
873873
if (len(fhandle.variables[name].dimensions) == 1 and
874874
fhandle.variables[name].dimensions[0] == name and
875875
len(fhandle.variables[name]) > 0):
876-
sattrs['bald__array'] = name
877-
sattrs['rdf__type'] = 'bald__Reference'
878876

879877
if not isinstance(fhandle.variables[name][0], np.ma.core.MaskedConstant):
880878
sattrs['bald__first_value'] = fhandle.variables[name][0]
@@ -920,8 +918,8 @@ def load_netcdf(afilepath, baseuri=None, alias_dict=None, cache=None):
920918
edate_first = terra.datetime.EpochDateTimes(first,
921919
quantity,
922920
epoch=tog)
923-
924-
sattrs['bald__first_value'] = edate_first
921+
if first is not np.ma.masked:
922+
sattrs['bald__first_value'] = edate_first
925923
if len(fhandle.variables[name]) > 1:
926924
if fhandle.variables[name][0] == fv:
927925
last = np.ma.MaskedArray(fhandle.variables[name][-1],
@@ -1017,10 +1015,6 @@ def load_netcdf(afilepath, baseuri=None, alias_dict=None, cache=None):
10171015

10181016
var = file_variables[name]
10191017
sattrs = fhandle.variables[name].__dict__.copy()
1020-
# netCDF coordinate variable special case
1021-
if (len(fhandle.variables[name].dimensions) == 1 and
1022-
fhandle.variables[name].dimensions[0] == name):
1023-
sattrs['bald__array'] = name
10241018

10251019
# for sattr in sattrs:
10261020
for sattr in (sattr for sattr in sattrs if
@@ -1078,28 +1072,10 @@ def _make_ref_entities(var, fhandle, pref, name, baseuri,
10781072
fhandle.variables[pref].shape):
10791073
try:
10801074
refset = var.attrs.get('bald__references', set())
1081-
# cv_shape = fhandle.variables[pref].shape
1082-
# var_shape = fhandle.variables[name].shape
1075+
10831076
identity = '{}_{}_ref'.format(name, pref)
10841077
rattrs = {}
10851078
rattrs['rdf__type'] = 'bald__Reference'
1086-
# reshape = [1 for adim in var_shape]
1087-
# reshape_name = [1 for adim in set(fhandle.variables[name].dimensions).union(set(fhandle.variables[pref].dimensions))]
1088-
# reshape_pref = [1 for adim in set(fhandle.variables[name].dimensions).union(set(fhandle.variables[pref].dimensions))]
1089-
# name_dims = OrderedDict(zip(fhandle.variables[name].dimensions, var_shape))
1090-
# pref_dims = OrderedDict(zip(fhandle.variables[pref].dimensions, cv_shape))
1091-
# combined_dims = OrderedDict(list(pref_dims.items())+list(name_dims.items()))
1092-
# reverse_combined_dims = OrderedDict(list(name_dims.items())+list(pref_dims.items()))
1093-
# # also
1094-
# # name_dims.update(pref_dims)
1095-
# # pref_dims.update(name_dims)
1096-
1097-
# dims = fhandle.variables[pref].dimensions
1098-
# for dim in dims:
1099-
# cvi = fhandle.variables[name].dimensions.index(dim)
1100-
# reshape[cvi] = int(fhandle.dimensions[dim].size)
1101-
# rattrs['bald__childBroadcast'] = reshape
1102-
# rattrs['bald__array'] = set((file_variables.get(pref),))
11031079

11041080
reshapes = netcdf_shared_dimensions(fhandle.variables[name],
11051081
fhandle.variables[pref])

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

Lines changed: 36 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -53,73 +53,81 @@ this:lnsp a bald:Array ;
5353

5454
this:co2_latitude_ref a bald:Reference,
5555
bald:Subject ;
56-
bald:array this:latitude ;
57-
bald:childBroadcast ( 1 1 181 1 ) .
56+
bald:sourceShape ( 1 60 181 360 ) ;
57+
bald:target this:latitude ;
58+
bald:targetReshape ( 1 1 181 1 ) ;
59+
bald:targetShape ( 181 ) .
5860

5961
this:co2_levelist_ref a bald:Reference,
6062
bald:Subject ;
61-
bald:array this:levelist ;
62-
bald:childBroadcast ( 1 60 1 1 ) .
63+
bald:sourceShape ( 1 60 181 360 ) ;
64+
bald:target this:levelist ;
65+
bald:targetReshape ( 1 60 1 1 ) ;
66+
bald:targetShape ( 60 ) .
6367

6468
this:co2_longitude_ref a bald:Reference,
6569
bald:Subject ;
66-
bald:array this:longitude ;
67-
bald:childBroadcast ( 1 1 1 360 ) .
70+
bald:sourceShape ( 1 60 181 360 ) ;
71+
bald:target this:longitude ;
72+
bald:targetReshape ( 1 1 1 360 ) ;
73+
bald:targetShape ( 360 ) .
6874

6975
this:co2_time_ref a bald:Reference,
7076
bald:Subject ;
71-
bald:array this:time ;
72-
bald:childBroadcast ( 1 1 1 1 ) .
77+
bald:sourceShape ( 1 60 181 360 ) ;
78+
bald:target this:time ;
79+
bald:targetReshape ( 1 1 1 1 ) ;
80+
bald:targetShape ( 1 ) .
7381

7482
this:lnsp_latitude_ref a bald:Reference,
7583
bald:Subject ;
76-
bald:array this:latitude ;
77-
bald:childBroadcast ( 1 1 181 1 ) .
84+
bald:sourceShape ( 1 60 181 360 ) ;
85+
bald:target this:latitude ;
86+
bald:targetReshape ( 1 1 181 1 ) ;
87+
bald:targetShape ( 181 ) .
7888

7989
this:lnsp_levelist_ref a bald:Reference,
8090
bald:Subject ;
81-
bald:array this:levelist ;
82-
bald:childBroadcast ( 1 60 1 1 ) .
91+
bald:sourceShape ( 1 60 181 360 ) ;
92+
bald:target this:levelist ;
93+
bald:targetReshape ( 1 60 1 1 ) ;
94+
bald:targetShape ( 60 ) .
8395

8496
this:lnsp_longitude_ref a bald:Reference,
8597
bald:Subject ;
86-
bald:array this:longitude ;
87-
bald:childBroadcast ( 1 1 1 360 ) .
98+
bald:sourceShape ( 1 60 181 360 ) ;
99+
bald:target this:longitude ;
100+
bald:targetReshape ( 1 1 1 360 ) ;
101+
bald:targetShape ( 360 ) .
88102

89103
this:lnsp_time_ref a bald:Reference,
90104
bald:Subject ;
91-
bald:array this:time ;
92-
bald:childBroadcast ( 1 1 1 1 ) .
105+
bald:sourceShape ( 1 60 181 360 ) ;
106+
bald:target this:time ;
107+
bald:targetReshape ( 1 1 1 1 ) ;
108+
bald:targetShape ( 1 ) .
93109

94-
this:latitude a bald:Array,
95-
bald:Reference ;
96-
bald:array this:latitude ;
110+
this:latitude a bald:Array ;
97111
bald:first_value 90.0 ;
98112
bald:last_value -90.0 ;
99113
bald:shape ( 181 ) ;
100114
CFTerms:standard_name <http://vocab.nerc.ac.uk/standard_name/latitude/> ;
101115
NetCDF:units "degrees_north" .
102116

103-
this:levelist a bald:Array,
104-
bald:Reference ;
105-
bald:array this:levelist ;
117+
this:levelist a bald:Array ;
106118
bald:first_value 1 ;
107119
bald:last_value 60 ;
108120
bald:shape ( 60 ) ;
109121
NetCDF:long_name "model_level_number" .
110122

111-
this:longitude a bald:Array,
112-
bald:Reference ;
113-
bald:array this:longitude ;
123+
this:longitude a bald:Array ;
114124
bald:first_value 0.0 ;
115125
bald:last_value 359.0 ;
116126
bald:shape ( 360 ) ;
117127
CFTerms:standard_name <http://vocab.nerc.ac.uk/standard_name/longitude/> ;
118128
NetCDF:units "degrees_east" .
119129

120-
this:time a bald:Array,
121-
bald:Reference ;
122-
bald:array this:time ;
130+
this:time a bald:Array ;
123131
bald:first_value "2006-04-01T00:00:00"^^xsd:dateTime ;
124132
bald:shape ( 1 ) ;
125133
CFTerms:standard_name <http://vocab.nerc.ac.uk/standard_name/time/> ;

0 commit comments

Comments
 (0)