[Thread Prev][Thread Next][Index]

Re: [ferret_users] RESHAPE and SAVE error - variable unknown



Hi Russell,

Thank you very much. It works now.

As for the reversed y axis ordering, i now read the original file variable with '-' added to the order in which the variable is read. For some reason i was unable to make it work earlier.

Regards,


On Sun, Sep 11, 2011 at 7:53 AM, <Russell.Fiedler@xxxxxxxx> wrote:
Hi,

You need to cancel the global variable "npp_new". Alternatively when you define npp_new
define it as a variable local to the data set npp_grd

e.g.
let/d=npp_grd npp_new=...

Russ



________________________________________
From: owner-ferret_users@xxxxxxxx [owner-ferret_users@xxxxxxxx] On Behalf Of Samrat Rao [samrat.rao@xxxxxxxxx]
Sent: Sunday, 11 September 2011 3:49 AM
To: ferret_users@xxxxxxxx
Subject: [ferret_users] RESHAPE and SAVE error - variable unknown

Hi,

I'm using Ferret 6.7.1.

I need to change the axes ( i to t, j to i, k to j & then reverse the new j values ) of a variable in a netcdf file and i'm using RESHAPE to do that. But on opening the new file i get an error about unknown variables. The commands and outputs are:

yes? use/order=yzx NPP_1982_nc3.nc
yes? sh da
    currently SET data sets:
   1> ./NPP_1982_nc3.nc  (default)
 name     title                             I         J         K         L
 NPP                                    1:1440  1:720    1:12      ...

yes? set variable/title="Net prim prod"/bad=-999 npp

yes? define axis/x=0:359.75:0.25/units=degrees xax
yes? define axis/y=90s:89.75n:0.25/units=degrees yax
yes? define axis/t=1:12:1/calendar=noleap/units=months tax
 *** NOTE: /UNIT=MONTHS  ... using 1/12 of 365.00 days

yes? define grid/x=xax/y=yax/t=tax npp_grd

yes? let dummy = x[gx=npp_grd] + y[gy=npp_grd] + t[gt=npp_grd]

yes? let/title="New NPP" npp_new = reshape(npp,dummy)
yes? sh gr npp_new
   GRID NPP_GRD
 name            axis                 # pts     start              end
 XAX       LONGITUDE         1440mr     0E             0.25W
 YAX       LATITUDE               720 r     90S           89.75N
 normal    Z
 TAX       T (MONTHS(NOLE      12 r   1                    12

yes? fill npp_new[l=1] !! works correctly, but lat values are reversed in the same way as the original netcdf file ie continents are reversed

yes? save/clobber/file=myvar.nc<http://myvar.nc> npp_new
 LISTing to file myvar.n

yes? can da/all

yes? use myvar.nc<http://myvar.nc>
yes? sh da myvar.nc<http://myvar.nc>
    currently SET data sets:
   1> ./myvar.nc<http://myvar.nc>  (default)
 name              title                    I           J         K         L
 NPP_NEW  New NPP           1:1440    1:720     ...       1:12

yes? fill npp_new[l=1]
 **ERROR: variable unknown or not in data set: NPP
CONTOUR/FILL npp_new[l=1]
Command file, command group, or REPEAT execution aborted

---------

How do i make the reshape & save commands work correctly? Any other method to change the axes is fine.

Also how to reverse the values along the latitudes? Is using ncdump and ncgen the only way?

--
Thanks,
Samrat Rao.



--

Samrat Rao

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

Privacy Policy | Disclaimer | Accessibility Statement