Project

General

Profile

NETCDF only lon/lat no timestep

Added by Luigi Marzo 5 months ago

Good morning, I need to generate a netcdf file without records. Example

I have the following table

11 12 13 14 ...
21 22 23 24 ...
31 32 33 34 ...
....

with the command

#!/bin/bash

xsize=20 ;
ysize=10 ;

printf -v gridfile "%dx%d" $xsize $ysize ;

cat << EOF > $gridfile
  gridtype  = lonlat
  xname     = lon
  xlongname = longilude
  xunits    = degrees_east
  yname     = lat
  ylongname = latilude
  yunits    = degrees_north
  xsize     = $xsize
  xfirst    = -5.00
  xinc      =  0.25
  ysize     = $ysize
  yfirst    =  5.00
  yinc      = -0.25
EOF

for ((iy=0;iy<ysize;iy++)) ; do
  for ((ix=0;ix<xsize;ix++)) ; do
    printf "%02d%02d " $iy $ix ;
  done
done > imap.data ;

cdo -f nc -setname,var -input,$gridfile map.nc < imap.data ;

I generate the relevant netcdf file. When I view the result I have:

File format : NetCDF2
-1 : Institut Source T Steptype Levels Num Points Num Dtype : Parameter ID
1 : unknown unknown v instant 1 1 200 1 F32 : -1
Grid coordinates :
1 : lonlat : points=200 (20x10)
lon : -5 to -0.25 by 0.25 degrees_east
lat : 5 to 2.75 by -0.25 degrees_north
Vertical coordinates :
1 : surface : levels=1
Time coordinate :
time : 1 step
RefTime = 0001-01-01 00:00:00 Units = hours Calendar = proleptic_gregorian
YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss
-0001-11-30 00:00:00
cdo sinfo: Processed 1 variable over 1 timestep [0.00s 51MB]_

It generated a timestep for me.

Is there a way to make it generate a netcdf with a two-dimensional variable without timestep?


Replies (1)

RE: NETCDF only lon/lat no timestep - Added by Karin Meier-Fleischer 5 months ago

Try the option --reduce_dim

    (1-1/1)