Project

General

Profile

NetCDF->GRIB2 conversion for irregularly-spaced latitudes

Added by Anonymous almost 13 years ago

I have a NetCDF file that has regularly-spaced longitudes but irregulary-spaced latitudes. The longitudes are 7.5, 22.5, 37.5,..., 352.5 (intervals of 15 degrees).
The latitude intervals are different. The latitudes start at -88.5, -85.5 (for an interval of 3 degrees), but then the increments change to around 5 in the middle latitudes.

I thought I could do this:

cdo setgrid,grid-2D.txt file1.nc file2.nc
cdo -f grb2 copy file2.nc file2.grb2

but I get the error message:
Error (gribapiDefGrid) : Unsupported grid type: unstructured

  • Am what I'm doing even possible with CDO?

I looked at the forum entry "netCDF file - Unsupported grid type?"
https://code.zmaw.de/boards/1/topics/248#message-265
and it looks like the "unstructured" grid type is not supported.

On the other hand, what I'm trying to do is a common use case, so perhaps I am just missing an option somewhere.

Here are more details.

The attachment, grid-2D.txt, is the file that I passed to the "cdo setgrid" command.

cdo setgrid,grid-2D.txt file1.nc file2.nc

[kingr@swafs-dev1 gaim-GMF]$ cdo sinfo file1.nc
File format: netCDF
-1 : Institut Source Param Time Typ Grid Size Num Levels Num
1 : unknown unknown 106 con F32 1056 1 1 1
2 : unknown unknown 105 con F32 1056 1 1 1
3 : unknown unknown 104 con F32 1056 1 1 1
4 : unknown unknown 103 con F32 1056 1 1 1
5 : unknown unknown 102 con F32 1056 1 1 1
6 : unknown unknown 101 con F32 1056 1 1 1
Horizontal grids :
1 : unstructured > size : dim = 1056 nvertex = 0
Vertical grids :
1 : surface : 0
cdo sinfo: Processed 6 variables. ( 0.00s )

cdo -f grb2 copy gmf-spec-2D-a.nc yy.grb2

Error (gribapiDefGrid) : Unsupported grid type: unstructured

grid-2D.txt (534 Bytes) grid-2D.txt what I passed to setgrid

Replies (1)

RE: NetCDF->GRIB2 conversion for irregularly-spaced latitudes - Added by Uwe Schulzweida almost 13 years ago

Your grid description file contains the information of an irregular lon/lat grid. You have to change the gridtype to lonlat in order to use this file with CDO. Unfortunately it is not possible to store irregular lon/lat grids in GRIB edition 1. GRIB1 can only handle regular lonlat, gaussian and similar simple grid information. It might be possible to store irregular lonlat grids in GRIB2 but I haven't checked this. CDO supports only the grids available with GRIB1.

    (1-1/1)