Project

General

Profile

variable name change

Added by Augusto Sanabria over 11 years ago

I have a large project involving netCDF files with the time variable named "t".
When I use CDO tools to modify these files the name of the time variable is changed to "time" for some reason,
it means all my bash scripts crash. Is there any way to keep the time variable name as in the original?
I tried "chname" with no result.

I'd appreciate any help you could provide.

Cheers,

Augusto


Replies (5)

RE: variable name change - Added by Jaison-Thomas Ambadan over 11 years ago

Hi,

Can you please upload:

1) a sample of your data (must be < 50MB or a link to download the data)?
2) output of "cdo -V", and
3) the cdo operation (/operator sequence) that you've used, which modifies the "t"

Those info may help the CDO guys here to identify the problem!

Cheers,
J.

RE: variable name change - Added by Ralf Mueller over 11 years ago

In this case t or time is a dimension, which cannot be changed manually with cdo. you can

  • make it a variable in your bash scripting and change it from 't' to 'time' after CDO processing
  • use nco for manipulation the time variable: http://jisao.washington.edu/data/nco after CDO has finished processing
  • do the same once before CDO runs

regards
ralf

RE: variable name change - Added by Augusto Sanabria over 11 years ago

Hello Jaison-Thomas,

Thanks for your interest in this problem.
As requested I'm attaching two small netCDf files to illustrate the problem.
The time var in the original file (tst_file_wspdir.nc) is called "t" but in the file produced by the CDO command
the variable name has been changed to "time" (making my bash scripts crash).
The command used is:
cdo gtc,220 'tst_file_wspdir.nc' 'cdo_changes_t_var.nc'

I'm also including a screenshot showing the output of CDO -V.

Regards,

Augusto

RE: variable name change - Added by Jaison-Thomas Ambadan over 11 years ago

Hi Augusto,

Unfortunately, I don't have a solution at the moment other than Ralf's suggestion - to change the name back to "time" using "ncrename" (or some other "nco" tools). The problem is that in the case of NetCDF files, CDO follows CF naming convention especially for the co-ordinate variables. In your case "time" is the standard name for the time co-ordinate variable.

The file history (have a look at "ncdump -h tst_file_wspdir.nc") shows that the "time" co-ordinate variable name has been changed to "t" using "ncrename" somtime in the past. So the only solution at the moment is to change back "t" to "time" in the same way.

Neverthless, in my opinion, CDO should NOT change the existing co-ordinate variable/attribute names

Cheers,
J

RE: variable name change - Added by Uwe Schulzweida over 11 years ago

Hi,

The next CDO release will preserve the name of the time variable.

Cheers,
Uwe

    (1-5/5)