NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

Re: Changing dimension values?

On Sep 4, 10:50pm, Gary Strand wrote:
> Subject: Changing dimension values?
>
> This is probably a stupid question, but is there an easier way than using nc-
> dump to change a dimension's values? Say I want to change time from seconds
to
> days - just divide every value appropriately. However, I've got quite a lot
of
> data to go through and a painless method would be very nice.
>
> Thanks for any advice/suggestions.
> --
> Gary Strand
> strandwg@xxxxxxxxxxxxx
                        http://www.cgd.ucar.edu/ccr/gary
>-- End of excerpt from Gary Strand

=========================================================

Hi Gary,

Since you're a Ferret user ...

The Ferret program can do all sorts of "messing with grids" on NetCDF files
that are "COARDS-standard" (see
http://www.unidata.ucar.edu/packages/netcdf/conventions.html).

For your question, use the DEFINE AXIS command to make a new time axis, say
"TDAYS", in units of days (time steps may be even or uneven). Then regrid your
variable along the T axis by "association" (replacement) using the syntax
"GT=TDAYS@ASN" as follows:

        LET var_in_days = var_in_secs[GT=TDAYS@ASN]
        SAVE/file=new_file.nc var_in_days


        cheers - steve



                |  NOAA/PMEL               |  ph. (206) 526-6080
Steve Hankin    |  7600 Sand Point Way NE  |  FAX (206) 526-6744
                |  Seattle, WA 98115-0070  |  hankin@xxxxxxxxxxxxx
                |  http://www.pmel.noaa.gov/ferret/home.html |


  • 1996 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: