Re: [netcdfgroup] Renaming dimensions and retaining their values

On 07/06/2016 07:01 AM, ashwinD12 . wrote:
Hello,
            I have a netCDF4 file that I downloaded using nccopy and
OPenDAP. I want to be able to rename few of the dimensions in that
file(read that as coordinate) while retaining the values of the same.

I tried using the nco operator(nco version 4.6) specifically the
ncrename operator.

This is the command that I issued - ncrename -d lat,dimy_D hgt_925.nc
<http://hgt_925.nc> and it does rename the dimension.

However it removes the values that are associated with lat.

I modified the input to ncrename and I tried this -

ncrename -d lat,dimy_D -v lat,dimy_D hgt_925.nc <http://hgt_925.nc>.
This does give values for dimy_D but it gives  them the value as
9.9.2510E36. Short of writing my own program to rename my coordinate
variables is there any other utility out there that will help me do the
same ?

Ashwin,

I want to say this might be a bug in netCDF4. What version are you running?

I ask because NCO has always had "fun" with this procedure:

http://nco.sourceforge.net/nco.html#ncrename_crd

If I try (on a file here):

  $ ncrename -d lon,newlon -v lon,newlon input.nc4 output.nc4

with netCDF4 4.3.2 and NCO 4.4.4, I see your issue (newlon set to _FillValue or the like). But, using netCDF4 4.4.0 and NCO 4.5.5 that command works just fine.

So, you can try a newer netCDF4 library or go through netCDF3 (according to that page).

Matt

--
Matt Thompson, SSAI, Sr Scientific Programmer/Analyst
NASA GSFC,    Global Modeling and Assimilation Office
Code 610.1,  8800 Greenbelt Rd,  Greenbelt,  MD 20771
Phone: 301-614-6712                 Fax: 301-614-6246
http://science.gsfc.nasa.gov/sed/bio/matthew.thompson



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