Project

General

Profile

define the headers names when converting to ascii with outputtab

Added by Natalia L almost 5 years ago

I have a netcdf file with 7 variables and I want to convert it to an ascii file (lon,lat, val1,val2....val7).

I use outputtab :

cdo outputtab,lon,lat,value,value,value,value,value,value,value test.nc > test.txt

Is there any way to define also the names of the values (i.e. the headers)?


Replies (3)

RE: define the headers names when converting to ascii with outputtab - Added by Ralf Mueller almost 5 years ago

Hi!

Check the docu with

cdo -h outputtab
You cannot have values of different variables in a single row. try
cdo outputtab,lon,lat,value,name test.nc
if you want to put values of multiple variables in a single table, you can paste them together. you might have a look into this

hth
ralf

RE: define the headers names when converting to ascii with outputtab - Added by Natalia L almost 5 years ago

Hi Ralf,

thank you.

Is it possible to specify which variable of the netcdf file to extract to ascii file? Or only the first variable is possible to write to the ascii file?

regards
Natalia

RE: define the headers names when converting to ascii with outputtab - Added by Ralf Mueller almost 5 years ago

sure, just use the operators selname or select like this

  • cdo -outputtab,name,value,lon,lat -selname,<YourVarName> test.nc > test.out
  • cdo -outputtab,name,value,lon,lat -select,name=<YourVarName> test.nc > test.out

hth
ralf

again: feel free to double-check with the docu. There is a very good FAQ

    (1-3/3)