[ncl-talk] How to convert netcdf to grib format
Guido Cioni
guidocioni at gmail.com
Mon Feb 13 03:50:12 MST 2017
Sorry, I didn't read carefully that you were trying to go from netcdf to grib... Just ignore the second part of the mail :)
Guido Cioni
http://guidocioni.altervista <http://guidocioni.altervista/>.org
> On 13 Feb 2017, at 11:49, Guido Cioni <guidocioni at gmail.com> wrote:
>
> Arunima, this is ncl-talk, not cdo-talk :)
>
> If CDO and NCL are having an hard time trying to convert your file *maybe* the problem is the file itself. Please read the appropriate documentation for CDO (https://code.zmaw.de/projects/cdo/wiki <https://code.zmaw.de/projects/cdo/wiki>).
> By reading the CDO guide you would furthermore discover that the correct syntax of the command copy is the following:
> cdo -f nc copy input_file.grb output_file.nc
>
> and not the other way around. I suspect that won't fix the problem, but better starting from a clean state.
>
> Good luck
>
> Guido Cioni
> http://guidocioni.altervista <http://guidocioni.altervista/>.org
>
>> On 13 Feb 2017, at 11:39, Arunima Singh <arunima at vassarlabs.com <mailto:arunima at vassarlabs.com>> wrote:
>>
>> Hi,
>>
>> I am running following command -
>> cdo -f grb setgrid,mygrid DET_10N20N_76E85E_2016111712.nc DET_10N20N_76E85E_2016111712.grib
>>
>> But getting following error:
>> Warning (cgribexDefGrid) : The CGRIBEX library can not store fields on the used grid!
>>
>> Error (cgribexDefGrid) : Unsupported grid type: generic
>>
>> Am I doing something wrong, or is it because generic grid type is not supported.
>> PFA files for reference.
>>
>> Is there any other way to convert netcdf to grib2 format.
>>
>> SAMPLE FILES:
>> mygrid file ::
>>
>> gridtype = generic
>> xsize = 73
>> ysize = 81
>> xfirst = 76
>> xinc = 0.005
>> yfirst = 20
>> yinc = 0.005
>>
>> cdo griddes output::
>> #
>> # gridID 1
>> #
>> gridtype = generic
>> gridsize = 81
>> xsize = 81
>> #
>> # gridID 2
>> #
>> gridtype = generic
>> gridsize = 73
>> xsize = 73
>> #
>> # gridID 3
>> #
>> gridtype = generic
>> gridsize = 5913
>> xsize = 73
>> ysize = 81
>> cdo griddes: Processed 10 variables ( 0.00s )
>>
>>
>> NetCDF file::
>> latitude = 20, 19.875, 19.75, 19.625, 19.5, 19.375, 19.25, 19.125, 19,
>> 18.875, 18.75, 18.625, 18.5, 18.375, 18.25, 18.125, 18, 17.875, 17.75,
>> 17.625, 17.5, 17.375, 17.25, 17.125, 17, 16.875, 16.75, 16.625, 16.5,
>> 16.375, 16.25, 16.125, 16, 15.875, 15.75, 15.625, 15.5, 15.375, 15.25,
>> 15.125, 15, 14.875, 14.75, 14.625, 14.5, 14.375, 14.25, 14.125, 14,
>> 13.875, 13.75, 13.625, 13.5, 13.375, 13.25, 13.125, 13, 12.875, 12.75,
>> 12.625, 12.5, 12.375, 12.25, 12.125, 12, 11.875, 11.75, 11.625, 11.5,
>> 11.375, 11.25, 11.125, 11, 10.875, 10.75, 10.625, 10.5, 10.375, 10.25,
>> 10.125, 10 ;
>>
>> longitude = 76, 76.125, 76.25, 76.375, 76.5, 76.625, 76.75, 76.875, 77,
>> 77.125, 77.25, 77.375, 77.5, 77.625, 77.75, 77.875, 78, 78.125, 78.25,
>> 78.375, 78.5, 78.625, 78.75, 78.875, 79, 79.125, 79.25, 79.375, 79.5,
>> 79.625, 79.75, 79.875, 80, 80.125, 80.25, 80.375, 80.5, 80.625, 80.75,
>> 80.875, 81, 81.125, 81.25, 81.375, 81.5, 81.625, 81.75, 81.875, 82,
>> 82.125, 82.25, 82.375, 82.5, 82.625, 82.75, 82.875, 83, 83.125, 83.25,
>> 83.375, 83.5, 83.625, 83.75, 83.875, 84, 84.125, 84.25, 84.375, 84.5,
>> 84.625, 84.75, 84.875, 85 ;
>>
>>
>> On Mon, Feb 13, 2017 at 3:44 PM, Arunima Singh <arunima at vassarlabs.com <mailto:arunima at vassarlabs.com>> wrote:
>> Hi,
>>
>> I am running following command -
>> cdo -f grb setgrid,mygrid DET_10N20N_76E85E_2016111712.nc DET_10N20N_76E85E_2016111712.grib
>>
>> But getting following error:
>> Warning (cgribexDefGrid) : The CGRIBEX library can not store fields on the used grid!
>>
>> Error (cgribexDefGrid) : Unsupported grid type: generic
>>
>> Am I doing something wrong, or is it because generic grid type is not supported.
>> PFA files for reference.
>>
>> Is there any other way to convert netcdf to grib2 format.
>>
>> Thanks and Regards,
>> Arunima Singh
>>
>> On Mon, Feb 13, 2017 at 1:30 PM, Beáta Szábo-Takács <szabo.b at czechglobe.cz <mailto:szabo.b at czechglobe.cz>> wrote:
>>
>> 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 <http://file.nc/>
>>
>> cdo griddes file.nc <http://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 <mailto: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 <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 <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 <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
>>
>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170213/8324a48d/attachment.html
More information about the ncl-talk
mailing list