Project

General

Profile

Converting ASC to netcdf

Added by ivanhoe Tebaldeschi almost 3 years ago

Hi,
I need to convert this input ASC file to a netcdf.
I tried using the command

cdo -f nc input,grid2.txt Tmed.nc < Tmed20020101.asc

But it gives me a worning :
cdo    input: Enter all 1148 elements of timestep 1!

cdo    input (Abort): Too few input elements (1145 of 1148)!

Are there any problems in the grid maybe?
Can someone help me in getting the correct netcdf output?
many thanks.


Replies (2)

RE: Converting ASC to netcdf - Added by Ralf Mueller almost 3 years ago

Dear knight Ivanhoe!

From what I understood, there are two issues

  1. you gridfile grid2.txt is not correct because xsize and ysize do not match NCOLS and NROWS in the data file
  2. you text data is not given in the right format, it must contain all datapoints of a single timestep in a single row

I changed both files accordingly (uploaded as '_01' versions of your uploads) and used the following command:

cdo -f nc -input,grid2_01.txt < Tmed20020101.asc_01 out.nc

What I left unchanged is the exact lonlat-locations of you grid (xfirst,yfirst,xinc,yinc)

happy hunting and long live the queen!
Ralf

RE: Converting ASC to netcdf - Added by ivanhoe Tebaldeschi almost 3 years ago

Dear Ralf,

Even if I would really love to be a proud knight, the name is the only thing that links me with him.

Thank you very very much.

Ivan

    (1-2/2)