Project

General

Profile

Netcdf to Ascii

Added by Ehtesham Ahmed over 3 years ago

Hello people,
Can someone please guide me in converting netcdf multiple files to ascii format?
Thanks in advance


Replies (4)

RE: Netcdf to Ascii - Added by Karin Meier-Fleischer over 3 years ago

Hi Ehteshan,

you can use the outputtab operator (see https://code.mpimet.mpg.de/projects/cdo/embedded/cdo.pdf#subsection.2.14.5) to send the result to stdout or redirect it to a file.

To create a user defined table of a dataset:
Each parameter of outputtab is one row in the table. Here is an example to print the lon, lat and value of all fields:

cdo outputtab,lon,lat,value infile.nc > tmp.txt

The following parameter are implemented:

value, name, param, code, lon, lat, lev, xind, yind, timestep, date, time, year, month, day, nohead

You can try it with:

cdo outputtab,date,time,value infile.nc > outfile.csv

-Karin

RE: Netcdf to Ascii - Added by Ehtesham Ahmed over 3 years ago

Hello Karin,
Thank you for your feedback. Actually, I want to get ascii files' outputs with their headers (as shown in attachment). I couldn't figure that out in CDO.

RE: Netcdf to Ascii - Added by Karin Meier-Fleischer over 3 years ago

In my opinion this is not possible with CDO. You can write a shell script and combine the output from cdo sinfo and cdo outputtab to create such an ASCII file.

RE: Netcdf to Ascii - Added by Ehtesham Ahmed over 3 years ago

Thank you for the suggestions
Cheers

    (1-4/4)