[Thread Prev][Thread Next][Index]

Re: [ferret_users] Changing data in NetCDF file



Hi
Your listing looks like the output of SHOW DATA/ATTRIBUTE.  (XCOASTS_C), which is listed in parentheses, is a coordinate axis.  It won't be changed unless you use SET AXIS or DEFINE AXIS commands to explicitly change it.

To define new variables using the original variable names, and rewrite your file with the new definitions, you first need to rename the variables in the input file.  Try a SHOW DATA after the SET VAR/NAME commands to see what you've got.

yes? use mydata.nc
yes? set var/name=lon_in  lon_coasts_c 
yes? set var/name=lat_in  lat_coasts_c 

! Now define the new variables in terms of the previous ones.
! Use /UNITS= and /TITLE= to give the new variables the correct attributes. 

yes? let/units="degrees_east" lon_coasts_c =  2* lon_in

! Or, you can get the units and other information from the original variables
! using the RETURN= keyword.

yes? let/units="`lat_in`" lat_coasts_c =  2* lat_in

yes? save/clobber/file=mydata.nc lon_coasts_c, lat_coasts_c
If you wanted to keep some variables from the original dataset and replace others, you would still need to SAVE both the ones you are keeping and the new ones.  /CLOBBER deletes the old file and replaces it with a new one. 

Ansley

On 2/16/2011 9:20 AM, Szymon Roziewski wrote:
Dear Ferreters!
I have some data in a netcdf file. I want to do some transformations to these data and then change existing in the netcdf file by freshly computed.

And also I would like to know what is this (XCOASTS_C), because this is not a variable - what is it?

 Variable    VarType(in dset)    AttributeName   AttType     Size OutFlag AttValue
------------------------------------------------------------------------------------------
 
 .                               history         CHAR        24   T       FERRET V5.41    4-Dec-07
 
(XCOASTS_C)            DOUBLE    point_spacing   CHAR        4    T       even
                                 orig_file_axnameCHAR        9    F       XCOASTS_C
 
 LON_COASTS_C          FLOAT     missing_value   FLOAT       1    T       -1.000000E+34
                                 _FillValue      FLOAT       1    T       -1.000000E+34
                                 long_name       CHAR        12   T       lon_coasts_c
                                 history         CHAR        16   T       From coast_c.dat
                                 units           CHAR        12   T       degrees_east
 
 LAT_COASTS_C          FLOAT     missing_value   FLOAT       1    T       -1.000000E+34
                                 _FillValue      FLOAT       1    T       -1.000000E+34
                                 long_name       CHAR        12   T       lat_coasts_c
                                 history         CHAR        16   T       From coast_c.dat
                                 units           CHAR        13   T       degrees_north

So I wanted to change e.g. existing  LON_COASTS_C, LAT_COASTS_C by new ones. Simultaneously with no changing (XCOASTS_C).
Variable attributes could be rewritten I suppose.
How can I deal with that?

Many greetings!
Szymon Roziewski


[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement