Project

General

Profile

How to write shell file using cdo?

Added by Jinyan Song 11 months ago

using file ARPNH2D201608010030 command

ARPNH2D201608010030: Gridded binary (GRIB) version 2

using cdo sinfon ARPNH2D201608010030 command

Warning (gribapiScanTimestep2): Record 5 (name=lswp id=47.1.0 lev1=0 lev2=0) timestep 2: Parameter not defined at timestep 1!

cdo sinfon: Open failed on >ARPNH2D201608010030<
Unsupported file structure

I use gribsplit ARPNH2D201608010030 to spilt param files includng different variable.
for exampel:

the file also grb2

but if I use cdo sinfon the file,it show the following error:

the question:
What cdo command to use to get the information of this file?
How to convert these files into nc files?


Replies (7)

RE: How to write shell file using cdo? - Added by Estanislao Gavilan 11 months ago

Hi Jinyan,

it is a bit difficult to know whats happening by looking the pictures. Can you upload a single timestep?

Kind regards,

Estanislao

RE: How to write shell file using cdo? - Added by Jinyan Song 11 months ago

Hi, I upload a file here. I can't get the information on this file and convert these files into nc file. Finally, I want to use cdo remapbil command.

RE: How to write shell file using cdo? - Added by Karin Meier-Fleischer 11 months ago

Hi Jinyan,

there is something wrong with your GRIB file because also grib_dump (from https://confluence.ecmwf.int/display/ECC/grib_dump) returns an error:

>  grib_dump ARPNH2D.t1.l000.grb.0.6.4.gp

***** FILE: ARPNH2D.t1.l000.grb.0.6.4.gp 
ECCODES ERROR   :  Invalid size 16048 found for section_3, assuming 16072
ECCODES ERROR   :  Invalid size 16048 found for section_3, assuming 16072
ECCODES ERROR   :  Invalid size 16048 found for section_3, assuming 16072
ECCODES ERROR   :  Invalid size 16048 found for section_3, assuming 16072
#==============   MESSAGE 1 ( length=81580326 )            ==============
GRIB {
  # Meteorological products (grib2/tables/4/0.0.table)  
  discipline = 0;
  editionNumber = 2;
  # French Weather Service - Toulouse (common/c-11.table)  
  centre = 85;
  subCentre = 0;
  # Start of forecast (grib2/tables/4/1.2.table)  
  significanceOfReferenceTime = 1;
  dataDate = 20160801;
  dataTime = 15;
  # Operational products (grib2/tables/4/1.3.table)  
  productionStatusOfProcessedData = 0;
  # Analysis and forecast products (grib2/tables/4/1.4.table)  
  typeOfProcessedData = 2;
  # FA section is present (grib2/grib2LocalSectionNumber.85.table)  
  grib2LocalSectionNumber = 1;
  CLNOMA = SURFNEBUL.MOYENN;
  INGRIB = 120;
  LLCOSP = 0;
  INBITS = 8;
  FMULTM = 1;
  FMULTE = 2;
  numberOfDataPoints = 81563372;
  # Numbers define number of points corresponding to full coordinate circles (i.e. parallels), coordinate values on each circle are multiple of the circle mesh, and extreme coordinate values given in grid definition (i.e. extreme longitudes)  (grib2/tables/4/3.11.table)  
  interpretationOfNumberOfPoints = 1;
  # Gaussian latitude/longitude (grib2/tables/4/3.1.table)  
  gridDefinitionTemplateNumber = 40;
  # Earth assumed spherical with radius of 6,371,229.0 m (grib2/tables/4/3.2.table)  
  shapeOfTheEarth = 6;
  Ni = MISSING;
  Nj = 8000;
  N = 4000;
  iScansNegatively = 0;
  jScansPositively = 0;
  jPointsAreConsecutive = 0;
  alternativeRowScanning = 0;
  latitudeOfFirstGridPointInDegrees = 89.9828;
  longitudeOfFirstGridPointInDegrees = 0;
  latitudeOfLastGridPointInDegrees = -89.9828;
  longitudeOfLastGridPointInDegrees = 359.978;
  iDirectionIncrementInDegrees = MISSING;
  global = 0;
  isOctahedral = 0;
ecCodes assertion failed: `bottom != 0' in /Users/runner/miniforge3/conda-bld/eccodes_1674769846745/work/src/grib_gaussian_reduced.c:62
Abort

RE: How to write shell file using cdo? - Added by Jinyan Song 11 months ago

Hi Karin,
OK, I see.
I will be asking them data questions.
Can I just use the cdo remap command if there is no problem with the data I reacquired ?
Best,
Jinyan Song

RE: How to write shell file using cdo? - Added by Estanislao Gavilan 11 months ago

Hi Jinyan,

You also need a grid.txt file with the coordinates that you wish to remap. Something like this

gridtype = lonlat
gridsize = 64800
xname = lon
xlongname = longitude
xunits = degrees_east
yname = lat
ylongname = latitude
yunits = degrees_north
xsize = 360
ysize = 180
xfirst = 0
xinc = 1
yfirst = -90
yinc = 1

Then, the command is

cdo remapbil,grid.txt input output

Kind regards,

Estanislao

PS:You have other remap alternatives as well as grid.txt templates. Everything is well explained in the documentation

RE: How to write shell file using cdo? - Added by Jinyan Song 11 months ago

Hi Estanislao,
I see!
Thank you very much for your careful answer.
Best,
Jinyan Song

RE: How to write shell file using cdo? - Added by Karin Meier-Fleischer 11 months ago

Another brief explanation, CDO offers already predefined grids, so you don't have to work with a grid file if one fits to your needs. The use of the grid file from Estanislao's example is the same as to use one of the remap operators with the grid name r360x180 . For example to remap the input file grid to a global 1 degree grid with longitudes from 0 to 359:

cdo -remapnn,r360x180 infile outfile

Result:

     1 : lonlat                   : points=64800 (360x180)
                              lon : 0 to 359 by 1 degrees_east  circular
                              lat : -89.5 to 89.5 by 1 degrees_north

You can use also global_1 to remap the input grid to a 1 degree global grid. The only difference to r360x180 is that its longitude range is -179.5 to 179.5.

cdo -remapnn,global_1 infile outfile

Result:

     1 : lonlat                   : points=64800 (360x180)
                              lon : -179.5 to 179.5 by 1 degrees_east  circular
                              lat : -89.5 to 89.5 by 1 degrees_north

Read more about grids: https://code.mpimet.mpg.de/projects/cdo/embedded/cdo.pdf#section.1.5
Read more about remapping: https://code.mpimet.mpg.de/projects/cdo/embedded/cdo.pdf#section.2.12

    (1-7/7)