[ncl-talk] How to convert netcdf to grib format

Beáta Szábo-Takács szabo.b at czechglobe.cz
Mon Feb 13 01:00:37 MST 2017


Hi,


It hard to see the grid type by ncdump results. Can you apply Climate Data Operator (CDO)? If yes, you can see the grid coordinates with the sinfo or griddes operators:


cdo sinfo file.nc


cdo griddes file.nc


You can create mygrid file by the following way:


cat > mygrid << EOF

gridtype =


xsize    =


ysize    =


xfirst   =


xinc     =


yfirst   =


yinc     =


EOF

I hope I could help you.


Beata


________________________________
From: Arunima Singh <arunima at vassarlabs.com>
Sent: Monday, February 13, 2017 8:32:49 AM
To: Beáta Szábo-Takács
Cc: Barry Lynn; ncl-talk
Subject: Re: [ncl-talk] How to convert netcdf to grib format

Hi,

Thanks .
Can you please tell me what to have in mygrid ?

My netcdf file has following variables :
netcdf DET_10N20N_76E85E_2016111712 {
dimensions:
lat = 81 ;
lon = 73 ;
time = 41 ;
variables:
float latitude(lat) ;
latitude:units = "degrees_north" ;
float longitude(lon) ;
longitude:units = "degrees_east" ;
float time(time) ;
time:units = "hours since 2016-11-17 12Z" ;
float \2m_temperature(time, lat, lon) ;
\2m_temperature:units = "C" ;
float \2m_relative_humidity(time, lat, lon) ;
\2m_relative_humidity:units = "%" ;
float mean_sea_level_pressure(time, lat, lon) ;
mean_sea_level_pressure:units = "Pa" ;
float \6hr_accumulated_precip(time, lat, lon) ;
\6hr_accumulated_precip:units = "mm" ;
float \10m_U_wind(time, lat, lon) ;
\10m_U_wind:units = "m/s" ;
float \10m_V_wind(time, lat, lon) ;
\10m_V_wind:units = "m/s" ;
float wind_magnitude(time, lat, lon) ;
wind_magnitude:units = "m/s" ;
float wind_direction(time, lat, lon) ;
wind_direction:units = "degrees" ;
}


On Mon, Feb 13, 2017 at 12:56 PM, Beáta Szábo-Takács <szabo.b at czechglobe.cz<mailto:szabo.b at czechglobe.cz>> wrote:
Hi,
According to CDO support:
The grid type generic means that the variables have either no grid information or the grid information is not supported in CDO.
In both cases it is not possible to store the data in GRIB format. Here is a list of all supported CDO GRIB grid types:

  *   Latitude/longitude grid
  *   Lambert conformal grid
  *   Gaussian latitude/longitude grid
  *   Rotated latitude/longitude grid
  *   Spherical Harmonic Coefficients
  *   Icosahedral-hexagonal GME grid
You have to add the missing grid information with setgrid if there is no grid information in your file and the variables are stored on one of the above grids:
cdo -f grb setgrid,mygrid cc.nc<http://cc.nc> cc.grb
You can check the grid information of the variables with the CDO function sinfo or griddes.

I hope I could help you.

Beata


From: Arunima Singh [mailto:arunima at vassarlabs.com<mailto:arunima at vassarlabs.com>]
Sent: Monday, February 13, 2017 8:16 AM
To: Beáta Szábo-Takács <szabo.b at czechglobe.cz<mailto:szabo.b at czechglobe.cz>>
Cc: Barry Lynn <barry.h.lynn at gmail.com<mailto:barry.h.lynn at gmail.com>>; ncl-talk <ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>>

Subject: Re: [ncl-talk] How to convert netcdf to grib format

I tried cdo -
cdo -f grb copy DET_10N20N_76E85E_2016111712.nc DET_10N20N_76E85E_2016111712.grib

but i am getting following error :

Warning (cgribexDefGrid) : The CGRIBEX library can not store fields on the used grid!

Error (cgribexDefGrid) : Unsupported grid type: generic


On Mon, Feb 13, 2017 at 12:40 PM, Beáta Szábo-Takács <szabo.b at czechglobe.cz<mailto:szabo.b at czechglobe.cz>> wrote:
Hi,

I think you can convert netcdf to grib by CDO. Try the following operator:

cdo -f grb copy file.nc<http://file.nc> file.grb

I hope it helps.

Beata

From: ncl-talk-bounces at ucar.edu<mailto:ncl-talk-bounces at ucar.edu> [mailto:ncl-talk-bounces at ucar.edu<mailto:ncl-talk-bounces at ucar.edu>] On Behalf Of Arunima Singh
Sent: Monday, February 13, 2017 8:05 AM
To: Barry Lynn <barry.h.lynn at gmail.com<mailto:barry.h.lynn at gmail.com>>
Cc: ncl-talk <ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>>
Subject: Re: [ncl-talk] How to convert netcdf to grib format

Hi,

What i want is netcdf to grib2 format instead of grib to netcdf.

Thanks and Regards,
Arunima Singh


On Mon, Feb 13, 2017 at 12:31 PM, Barry Lynn <barry.h.lynn at gmail.com<mailto:barry.h.lynn at gmail.com>> wrote:
Hi:

I believe you can find the answer here:

http://www.ncl.ucar.edu/Applications/griball.shtml

On Mon, Feb 13, 2017 at 8:56 AM, Arunima Singh <arunima at vassarlabs.com<mailto:arunima at vassarlabs.com>> wrote:
Hi,

I have one netcdf file that i want to convert to grib format.
Can we do this conversion with ncl?

If yes, how?

Thanks and Regards,
Arunima Singh

_______________________________________________
ncl-talk mailing list
ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk



--
Barry H. Lynn, Ph.D
Senior Lecturer,
The Institute of the Earth Science,
The Hebrew University of Jerusalem,
Givat Ram, Jerusalem 91904, Israel
Tel: 972 547 231 170
Fax: (972)-25662581

C.E.O, Weather It Is, LTD
Weather and Climate Focus
http://weather-it-is.com
Jerusalem, Israel
Local: 02 930 9525
Cell: 054 7 231 170
Int-IS: x972 2 930 9525
US 914 432 3108



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170213/0a53b7c2/attachment.html 


More information about the ncl-talk mailing list