Project

General

Profile

change var names

Added by Noelia Otero over 10 years ago

Hi!

I want to convert some grib files to netcdf and in the process I want to change the names of the variables. The problem is that I don't know how I can store the names and recover them to rename the netcdf.
This is my try:
cdo -f nc copy input.grib temp.nc
cdo showvar temp.nc > oldname #(the problem would be here...?)
cdo chname $oldname,$nam temp.nc out.nc #$nam is the name stored in a script

I also tried in one line something like:
cdo chname -showvar,$nam temp.nc out.nc

but it is not working either...any idea?

I really appreciate any suggestion!

Thanks in advance,
Cheers,

Noelia


Replies (2)

RE: change var names - Added by Uwe Schulzweida over 10 years ago

If the GRIB file contains only one variable try:

cdo -f nc setname,$nam input.grib out.nc

RE: change var names - Added by Noelia Otero over 10 years ago

Cool! Thanks a lot! much easier!:)

    (1-2/2)