Open karlmsmith opened 6 years ago
Comment by @AnsleyManke on 6 Jun 2013 20:40 UTC Done. A new qualifier SAVE/NOCOORDS will write the variable without coordinate variables. If appending, Ferret just checks the dimension names and sizes to make sure they match what is in the file.
yes? use dsgfile
yes? let longitude365 = longitude+365
yes? cancel mode upcase
yes? save/append/nocoord/file=dsgfile.nc longitude365
LISTing to file dsgfile.nc
yes? sp ncdump -h dsgfile.nc
netcdf dsgfile {
dimensions:
trajectory = 3 ;
STRING1_12 = 12 ;
obs = 5315 ;
variables:
int rowSize(trajectory) ;
rowSize:ioos_category = "Identifier" ;
rowSize:long_name = "Number of Observations for this Trajectory" ;
rowSize:sample_dimension = "obs" ;
rowSize:history = "From SOCAT2_data_table_b900_f2d1_5213" ;
char cruise_expocode(trajectory, STRING1_12) ;
cruise_expocode:cf_role = "trajectory_id" ;
cruise_expocode:ioos_category = "Identifier" ;
cruise_expocode:long_name = "Cruise Expocode" ;
cruise_expocode:history = "From SOCAT2_data_table_b900_f2d1_5213" ;
float longitude(obs) ;
longitude:_CoordinateAxisType = "Lon" ;
longitude:actual_range = -1.084202e-19f, -3.601561f ;
longitude:axis = "X" ;
longitude:colorBarMaximum = 180. ;
longitude:colorBarMinimum = -180. ;
longitude:ioos_category = "Location" ;
longitude:long_name = "Longitude" ;
longitude:standard_name = "longitude" ;
longitude:units = "degrees_east" ;
longitude:history = "From SOCAT2_data_table_b900_f2d1_5213" ;
...
double time(obs) ;
time:_CoordinateAxisType = "Time" ;
time:actual_range = -35431200., 1199145600. ;
time:axis = "T" ;
time:ioos_category = "Time" ;
time:long_name = "Datetime" ;
time:standard_name = "time" ;
time:time_origin = "01-JAN-1970 00:00:00" ;
time:units = "seconds since 1970-01-01T00:00:00Z" ;
time:history = "From SOCAT2_data_table_b900_f2d1_5213" ;
double longitude365(obs) ;
longitude365:missing_value = -1.e+34 ;
longitude365:_FillValue = -1.e+34 ;
longitude365:long_name = "LONGITUDE+365" ;
longitude365:history = "From dsgfile" ;
// global attributes:
:history = "FERRET V6.85 6-Jun-13" ;
:Conventions = "CF-1.0" ;
:cdm_altitude_proxy = "depth" ;
:cdm_data_type = "Trajectory" ;
...
}
Attachment from @AnsleyManke on 31 May 2013 22:59 UTC dsg file with dimensions but not coordinate variables.
Edited: The attachment wasn't a valid dsg file - actual-range attributes didn't correspond to the ranges of lon and lat data, and time wasn't ordered within each trajectory. We have plenty more examples of dsg files now, removing the attached file.
Reported by @AnsleyManke on 31 May 2013 22:58 UTC Many netcdf files contain just dimensions with no corresponding coordinate variable, for example the Discrete Sampling Geometries files in Appendix H of the CF conventions, http://cf-pcmdi.llnl.gov/documents/cf-conventions/1.6/cf-conventions.html#appendix-examples-discrete-geometries
1) If we try to write such a file with Ferret, it will always write coordinate variables for dimensions obs, traj, profile, etc. We should offer a qualifier or setting to write the dimension only when writing to netCDF.
2) If we want to append to such a file (e.g. I wanted to add a variable with the month to the SOCAT DSG file for use in selecting a month or season), Ferret wants to compare the coordinates in the file with the coordinates of the variable to be written, and so will not append.
The file is legal according to current standards. When there's a dimension but not a coordinate variable Ferret should check the name, direction and size of the dimension in the file against the grid of the variable.
I'll attach a short test dsg file. Here's a script to try to append a variable to it (Note CANCEL MODE UPCASE. If that's not set, then Ferret does append, but it writes a new axis, capital OBS, to the file.)
Migrated-From: http://dunkel.pmel.noaa.gov/trac/ferret/ticket/2075