Project

General

Profile

unexpected behaviors with file containing only time

Added by David Reusch over 9 years ago

I've run into a number of "unexpected behaviors" when using a file that only contains a variable (and dimension) time.

ncdump of file:
netcdf time_365day {
dimensions:
time = UNLIMITED ; // (7300 currently)
variables:
double time(time) ;
time:standard_name = "time" ;
time:long_name = "time" ;
time:units = "days since 1850-01-01 00:00:00" ;
time:calendar = "365_day" ;
}

First, showyear (and cousins) doesn't like the file structure:

cdo showyear time_365day.nc

cdo showyear: Open failed on >time_365day.nc<
Unsupported file structure

I tried two ways of creating the file (NCO's ncks and NCL) with the same result.

I also tried creating the file with "cdo selname,time" but get:
cdo selname (Warning): Variable name time not found!

cdo selname (Abort): No variables selected!

Because I have the file I need and can thus proceed to further steps, this is mostly a question about why I'm seeing this behavior. I'm assuming a couple things that might explain what I'm seeing so it would be nice to get confirmation:
1. "time" is a super-special variable in some way(s) so selname intentionally doesn't work with it.
2. CDO doesn't "like" files with just time in them, perhaps because it violates a file structure convention (my testing found this problem occurs once I delete all the other vars).

Or if this is NOT working correctly, a fix would of course be welcome.

Thanks!
Dave

Output of "cdo -V":
Climate Data Operators version 1.6.3 (http://code.zmaw.de/projects/cdo)
Compiled: by csgteam on yslogin2 (x86_64-unknown-linux-gnu) Mar 3 2014 12:52:09
Compiler: gcc -std=gnu99 -fPIC -pthread
version: gcc (GCC) 4.7.2
Features: PTHREADS NC4 OPeNDAP Z JASPER
Libraries:
Filetypes: srv ext ieg grb grb2 nc nc2 nc4 nc4c
CDI library version : 1.6.3 of Mar 3 2014 12:52:00
CGRIBEX library version : 1.6.3 of Jan 8 2014 19:55:18
GRIB_API library version : 1.11.0
netCDF library version : 4.2.1.1 of Mar 3 2014 11:49:51 $
HDF5 library version : 1.8.12
SERVICE library version : 1.3.1 of Mar 3 2014 12:51:51
EXTRA library version : 1.3.1 of Mar 3 2014 12:51:47
IEG library version : 1.3.1 of Mar 3 2014 12:51:49
FILE library version : 1.8.2 of Mar 3 2014 12:51:47


Replies (2)

RE: unexpected behaviors with file containing only time - Added by Uwe Schulzweida over 9 years ago

CDO processes only data variables and the corresponding coordinate variables of a netCDF file. Only data variables can be selected directly with selname. The CDO operator sinfon prints those variables. The coordinate variable time is a kind of meta-data in CDO and can't be accessed directly. Coordinate variables are read only if a data variable is using it otherwise it will be ignored.

RE: unexpected behaviors with file containing only time - Added by David Reusch over 9 years ago

OK, that's more or less what I suspected. Thanks for the confirmation.

I guess it would be something of a philosophical change to "promote" coordinate variables to the same level of accessibility as normal data variables, but I think that it would be a very useful change. Failing that, it would be nice to have more informative messages in the scenarios I described earlier.

Note that I'm not sure what I would do if CDO didn't exist, it's that important and useful in my work. In some ways, this makes "quirks" like this more surprising since the CDO operators usually work so well.

    (1-2/2)