Project

General

Profile

importing ASCII (scattered data) to netcdf

Added by Merce Casas Prat over 8 years ago

Hi

I am using cdo to import ASCII to netcdf

In my specific case I have scattered data of size 32156

The grid file I have is (grid.txt):
  1. cdo grid
    gridtype = cell
    gridsize = 32516
    xvals = 178.59375 181.40625 184.21875 187.03125
    189.84375 192.65625 195.46875 164.53125
    (...)
    yvals = (...)

Then I do

cdo -f nc input,grid.txt ofile.nc < ifile.txt

where ifile is the ASCII file (output data is stored in rows of 10, but some rows have less columns... the total of data points is 32,516 is anyway)

and I get the error message:

cdo settime: Processed 32516 values from 1 variable over 1 timestep ( 0.01s )
cdo setdate: Processed 32516 values from 1 variable over 1 timestep ( 0.01s )
cdo input: Enter all 32516 elements of record 1!
cdo input: Enter all 32516 elements of record 2!

The netcdf file is greated and the length of the variable is 32516, as expected, but this error message makes me think something is wrong.

Do you have any idea of what can be going on? Is the grid.txt incomplete?

THanks

Merce


Replies (4)

RE: importing ASCII (scattered data) to netcdf - Added by Ralf Mueller over 8 years ago

Hi Merce!

You should upload input, output and griddes file - otherwise it's hard to guess, whats going on ;-)

see here

cheers
ralf

RE: importing ASCII (scattered data) to netcdf - Added by Merce Casas Prat over 8 years ago

Hi Ralf,

Please find attached the files corresponding to:

cdo grid info (cdogrid.txt)
ascii file (ifile.txt)

I do:

cdo -f nc input,cdogrid.txt aux.nc < ifile.txt

Climate Data Operators version 1.6.8rc2

CDI library version : 1.6.8 of Feb 28 2015 00:54:12
CGRIBEX library version : 1.7.0 of Dec 3 2014 08:52:12
netCDF library version : 4.3.2 of Feb 27 2015 19:05:38 $
HDF5 library version : 1.8.14
SERVICE library version : 1.3.2 of Feb 28 2015 00:54:00
EXTRA library version : 1.3.2 of Feb 28 2015 00:53:54
IEG library version : 1.3.3 of Feb 28 2015 00:53:57
FILE library version : 1.8.2 of Feb 28 2015 00:53:54

Thanks

Merce

RE: importing ASCII (scattered data) to netcdf - Added by Ralf Mueller over 8 years ago

I got

ram@luthien:~/Downloads cdo -f nc input,cdogrid.txt aux.nc < ifile.txt                                             [12:26:33|15-09-17]
cdo input: Enter all 32516 elements of record 1!
cdo input: Enter all 32516 elements of record 2!
cdo input:  ( 0.02s )
ram@luthien:~/Downloads cdo -V                                                                                     [12:26:38|15-09-17]
Climate Data Operators version 1.6.9 (http://mpimet.mpg.de/cdo)
Compiled: by ram on luthien (x86_64-unknown-linux-gnu) Jun 26 2015 14:42:31
Compiler: gcc -g -O3 -std=gnu99 -Wall -fopenmp -march=native   
 version: gcc (GCC) 5.1.0
Features: PTHREADS OpenMP4 NC4/HDF5 OPeNDAP SZ Z UDUNITS2 PROJ.4 FFTW3 AVX2
Libraries: proj/4.91
Filetypes: srv ext ieg grb grb2 nc nc2 nc4 nc4c 
     CDI library version : 1.6.9 of Jun 26 2015 14:42:11
 CGRIBEX library version : 1.7.2 of Apr 22 2015 13:44:04
GRIB_API library version : 1.13.1
  netCDF library version : 4.3.3.1 of Mar 12 2015 14:13:12 $
    HDF5 library version : 1.8.14
 SERVICE library version : 1.3.2 of Jun 26 2015 14:42:09
   EXTRA library version : 1.3.2 of Jun 26 2015 14:42:14
     IEG library version : 1.3.3 of Jun 26 2015 14:42:14
    FILE library version : 1.8.2 of Jun 26 2015 14:42:13

gridsize in the resulting nc file and number of values in the text input are equal. So I think every thing us ok.

here is some script I wrote to do that manually - just in case

RE: importing ASCII (scattered data) to netcdf - Added by Merce Casas Prat over 8 years ago

Hi Ralf

Thanks for your reply. Yes, I got a netcdf too with the correct dimensions, but I was wondering why I get the error "Enter all 32516 elements of record 1!..."

Merce

    (1-4/4)