[Thread Prev][Thread Next][Index]

Fwd: [ferret_users] Changing data in NetCDF file

Hi Ansley,
Thank you for your reply.
I think I managed to do it. I didn't do anything with abstract grid. It seems it works.
But I have another problem.
When I try to define the region, only x axis can be redefined but I can't do this with y axis.
This is my script.
set windows/size=1000.0/aspect=`.88`
set region/x=-7.5:6/y=-3:12
DEFINE AXIS/X=-5.666666667:5.25:0.083333333/unit=degree xlon
DEFINE AXIS/Y=-2.0:10.0:0.083333333/unit=degree ylat
DEFINE AXIS/X=-5.666666667:5.25:0.010416667/unit=degree xfine
DEFINE AXIS/Y=-2.0:10.0:0.010416667/unit=degree yfine
DEFINE GRID/x=xlon/y=ylat BalticSea2D
DEFINE GRID/x=xfine/y=yfine BalticSea2Dfine
FILE/VARIABLES=GriddedData/COLUMNS=132/GRID=BalticSea2D DataFile
let fine GriddedData[gxy=BalticSea2Dfine]
LET ubox = fine[x=@SBX:12,y=@SBX:12]
LET utaper = ubox[x=@SHN:13,y=@SHN:13]
shade/title="Example Data on Baltic Sea"/palette=my_palette_swh/levels=(0.01)(0.5,1,0.5)(1.0,1.25,0.25)(1.25,2.0,0.75)(2.0,7.0,1.0)(7.0,11,2.0)(15) utaper!GriddedData[gxy=BalticSea2Dfine]
go unlabel 1
go unlabel 2
go unlabel 3
go unlabel 4
ppl shade
go land_balt_100 1 3 4 2 "coarse"
go land_balt_100 1 3 4 2 "medium"

I can change x=-7.5:6 to something else but when I'm changing y=-3:12 it comes up with nothing.
So, how can I do the changing of y interval?
I also attach the graphical file.

Kind regards,
Szymon Roziewski

W dniu 16 lutego 2011 21:06 użytkownik Ansley Manke <Ansley.B.Manke@xxxxxxxx> napisał:

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. 


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

Z wyrazami szacunku,
Szymon Roziewski

Z wyrazami szacunku,
Szymon Roziewski

Attachment: exampleBaltic.gif
Description: GIF image

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

Privacy Policy | Disclaimer | Accessibility Statement