[Thread Prev][Thread Next][Index]

Re: saving a variable to existing nc file




Thanks, Steve. (I'm still around...)

Your suggestion doesn't work (I tried your example verbatim, and it works
great, though!). My new variable is not a subset, it has exactly the same
extent as the other variables. It's wind speed, such that:
LET wspeed = (u^2 + v^2)^0.5
u and v are surface wind from NCEP reanalysis, which come as netcdf
files. 

I used ncdump -h to look at the nc file created by your example, and what
happened when I tried to append the variable from ferret to my file. I
think I figured it out. It looks like ferret writes all variable and
dimension names in uppercase, but the dimension and coord. variable names
in the NCEP nc file are all lowercase. lon, lat, and time. When Ferret
adds wspeed to the existing NCEP file, it adds the coord. variables LON,
LAT, TIME; ie, same names, but uppercase.

So I used NCO to rename the dimensions and coord. variables to uppercase,
and that did it (I ran into a different problem, but I think I can fix
that). Now I'll just have to use NCO again to change the names back to
lowercase.

Does this make sense, and is it true then that Ferret always writes
uppercase names? If that's so, maybe you could add a note to the
manual... Or maybe it's already there and I didn't see it.

Thanks!

Emilio


On Thu, 3 May 2001, Steve Hankin wrote:

> Hi Emilio,
> 
> [Its been a long time!]
> 
> I suspect (??) that you are attemping to save a subset region, only of the new
> variable??
> 
> Try these lines to see if you get the same behavior, which does not reproduce
> the problem that you've reported.
> 
>      /export/home/ja3/hankin/tmp> ferret
>      yes? use coads_climatology
>      yes? save/x=130e:80w/y=20s:20n/file=test.nc/clobber sst,airt ! a
>      test file - 75x20x12
>       LISTing to file test.nc
>      yes? quit
> 
>      /export/home/ja3/hankin/tmp> ferret
>      yes? use test.nc
>      yes? let new = sst+airt
>      yes? save/append/file=test.nc new   ! add a new variable to it
>       LISTing to file test.nc
>      yes? quit
> 
>      ==> NOTE THAT THEY ALL SHARE THE SAME COORDINATE AXES
>      /export/home/ja3/hankin/tmp> ncdump -h test.nc
>      netcdf test {
>      dimensions:
>              COADSX56_130 = 75 ;
>              COADSY36_55 = 20 ;
>              TIME = UNLIMITED ; // (12 currently)
>      variables:
>      .
>      .
>      .
> 
> If you want to share the full coordinate axes, despite the fact that you are
> saving only a subset you can use the /ilimits and /jlimits (etc.) to force the
> full region to be written:
> 
>      /export/home/ja3/hankin/tmp> ferret
>      yes? use coads_climatology
>      yes? save/x=130e:80w/y=20s:20n/file=test.nc/clobber sst,airt ! a
>      test file
>       LISTing to file test.nc
>      yes? q
> 
>      /export/home/ja3/hankin/tmp> ferret
>      yes? use test.nc
>      yes? let new = sst+airt
>      yes? save/append/file=test.nc/ilimits=1:75/jlimits=1:20
>      new[x=170e:170w]
>       LISTing to file test.nc
>      yes? q
> 
>      /export/home/ja3/hankin/tmp> ferret
>      yes? use test.nc
>      yes? shade/l=1 new    ! note the 170e:170w band embedded within
>      missing values
> 
>     - steve
> 
> =========================
> 
> Emilio Mayorga wrote:
> 
> > I want to save a variable into an existing netcdf file. This variable is
> > defined in ferret using, say, LET var = var1 + var2, where var1 and var2
> > are variables from the netcdf file; the dimensionality of the new variable
> > is the same as the other ones (XYT, where T in the nc file is the record
> > dimension). But when I save it, Ferret creates 3 new coordinate variables
> > to support var. Is it possible to force Ferret to use the existing
> > coordinate variables when saving a new variable?
> >
> > Thanks.
> >
> > Emilio Mayorga
> > ________________________________________________________________
> > University of Washington
> > School of Oceanography                  emiliom@u.washington.edu
> > Box 357940                              ph. (206) 221-6756
> > Seattle, WA  98195-7940   USA           FAX (206) 685-3351
> > http://boto.ocean.washington.edu/staff_pages/emilio
> 
> --
> 
>                 |  NOAA/PMEL               |  ph. (206) 526-6080
> Steve Hankin    |  7600 Sand Point Way NE  |  FAX (206) 526-6744
>                 |  Seattle, WA 98115-0070  |  hankin@pmel.noaa.gov
> 
> 
> 




[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement