Conversation
| data = self.fh.getDataSliceSB(vname, slicebuilder) | ||
| datav = data.values() | ||
| data_shaped = np.reshape(datav, dimsizes) | ||
| if self.scale_offset: |
There was a problem hiding this comment.
consider using getScaledDataSliceSB and let fimex do the scale/offset handling
|
Thanks. I think that the scale and offset handling should be replaced with I wonder why you commented out the Did you try putting this into |
| var = np.array([np.datetime64(int(v), "s") for v in var]) | ||
|
|
||
| coords["time"] = var | ||
|
|
There was a problem hiding this comment.
I don't really know what this should do in xarray, but the time-variable in netcdf is every variable with a time unit, i.e. 'days since 2005-09-03 +15:00'. One cannot rely on the dimension-name, and that there is only one "time"-axis per file.
Fimex supports conversion of the time-units, i.e. by getScaledDataSizeInUnit(...) so you can get a unified handling (needs doubles or quads, I would say). Not really sure what you do her (expect time to be epoch-seconds?).
| add_offset = cdm.getAttribute(cname, "add_offset").getData().values() | ||
| except RuntimeError: | ||
| add_offset = 0 | ||
| values = values*scale_factor + add_offset |
It is fairly easy to implement support for using
xarraywithfimexas a reader. I am opening this PR in the hope this will be useful for others who usexarrayThere is still a lot to do to support more features of
xarray, but this should cover the basic API