Closed durack1 closed 8 years ago
@dnadeau4 this is the offending line:
cmor.write(varid,values,time_vals=d.getTime()[:],time_bnds=d.getTime().genGenericBounds())
There are a couple of issues here:
CMOR
SHOULD faithfully reproduce a time axis if it is provided with the dataset, NOT overwrite this by generating a new time axis using the time_bounds
2015-1-16 12:0:0
NOT 2015-01-16 18
or 2015-01-16 03
time_bnds
are not set correctly using time_bnds=d.getTime().genGenericBounds()
@dnadeau4 the issue has been resolved by providing more reasonable time_bnds
to CMOR
by using the following:
time = d.getTime()
cmor.write(varid,values,time_vals=time[:],time_bnds=time.getBounds())
I would recommend however that in documentation the fact that CMOR
uses time_bnds
and ignores the provided time_axis
values is highlighted - it is certainly an unusual logical decision to this user
@durack it IS documented in the manual. Did you read it :wink:
[coord_vals] = 1-d array (single precision float, double precision float, or, for
labels, character strings) containing coordinate values, ordered consistently
with the data array that will be passed by the user to CMOR through
function cmor_write (see documentation below). This argument is required
except if: 1) the axis is a simple “index axis” (i.e., an axis without
coordinate values), or 2) for a time coordinate, the user intends to pass the
coordinate values when the cmor_write function is called. Note that the
coordinate values must be ordered monotonically, so, for example, in the
case of longitudes that might have the values, 0., 10., 20, ... 170., 180., 190.,
200., ... 340., 350., passing the (equivalent) values, 0., 10., 20, ... 170.,
180., -170., -160., ... -20., -10. is forbidden. In the case of time-coordinate
values, if cell bounds are also passed, then CMOR will first check that each
coordinate value is not outside its associated cell bounds; subsequently,
however, the user-defined coordinate value will be replaced by the midpoint
of the interval defined by its bounds, and it is this value that will be
written to the netCDF file. In the case of character string coord_vals there
are no cell_bounds, but for the C version of the function, the argument
cell_bounds_ndim is used to specify the length of the strings in the
coord_vals array (i.e., the array will be dimensioned
[length][cell_bounds_ndim]).
type = type of the coord_vals/bnds passed,
@doutriaux1 that would be a NO, my bad.. However, following your advice _where_ is the manual located?
I've found http://www-pcmdi.llnl.gov/software/cmor/cmor_users_guide.pdf and https://pcmdi.github.io/cmor-site/index.html which would seem to be out of sync - or have similar content.. Which is the most recent?
I think @dnadeau4 was planning on updating that to https://pcmdi.llnl.gov/cmor/ using the formatting provided on http://uvcdat.llnl.gov/documentation/cdms/cdms.html
@dnadeau4 this is no longer a problem - I do think that the docs should _VERY CLEARLY_ state that this is the case (bounds are used not the time axis)
@dnadeau4 @doutriaux1 @taylor13 I've just come across a weird quirk with
CMOR3.0.6
that I wasn't expecting. I am providing input data with the following time axis (for the last year of the full 1870-2015 period):Note the input file doesn't have a time_bnds
When I hand this dataset to
CMOR3.0.6
I get the following time axis back in the output file (again this is just the last 12 months of the full 1870-2015 period):This behavior is really not what I was expecting - I would assume that if I provide a
time_axis
those values are preserved, rather thanCMOR
recreating thetime_axis
from what would appear to be faultytime_bnds
in the input file.