<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none"><!-- p { margin-top: 0px; margin-bottom: 0px; }--></style>
</head>
<body dir="ltr" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Thanks Dennis.<br>
</p>
<p><br>
</p>
<p>Partha<br>
</p>
<div style="color: rgb(33, 33, 33);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Dennis Shea <shea@ucar.edu><br>
<b>Sent:</b> Wednesday, October 8, 2014 3:37 PM<br>
<b>To:</b> Partha Bhattacharjee<br>
<b>Cc:</b> ncl-talk@ucar.edu<br>
<b>Subject:</b> Re: [ncl-talk] Write grib2 to netcdf</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div>
<div>If you want a time dimension<br>
<br>
%> ncl_convert2nc aod.2014100400.grb -itime<br>
<br>
</div>
<div>or, more elaborate, change NCL's dimension name<br>
<br>
%> ncl_convert2nc aod.2014100400.grb -itime -u initial_time0_hours -U time<br>
</div>
<div><br>
</div>
<div>Ignore any warning message .. not important<br>
</div>
<div><br>
</div>
%> ncdump -h <a href="http://aod.2014100400.nc">aod.2014100400.nc</a><br>
<br>
<br>
etcdf aod.2014100400 {<br>
dimensions:<br>
time = UNLIMITED ; // (1 currently)<br>
lat_0 = 181 ;<br>
lon_0 = 360 ;<br>
ncl_strlen_0 = 18 ;<br>
variables:<br>
float AOTK_P48_GLL0(time, lat_0, lon_0) ;<br>
AOTK_P48_GLL0:forecast_time_units = "hours" ;<br>
AOTK_P48_GLL0:forecast_time = 0 ;<br>
AOTK_P48_GLL0:parameter_template_discipline_category_number = 48, 0, 20, 102 ;<br>
AOTK_P48_GLL0:parameter_discipline_and_category = "Meteorological products, Atmospheric chemical constituents" ;<br>
AOTK_P48_GLL0:grid_type = "Latitude/longitude" ;<br>
AOTK_P48_GLL0:_FillValue = 1.e+20f ;<br>
AOTK_P48_GLL0:units = "Numeric" ;<br>
AOTK_P48_GLL0:long_name = "Aerosol optical thickness" ;<br>
AOTK_P48_GLL0:production_status = "Operational products" ;<br>
AOTK_P48_GLL0:center = "US National Weather Service - NCEP (WMC)" ;<br>
double time(time) ;<br>
time:units = "hours since 1800-01-01 00:00" ;<br>
time:long_name = "initial time" ;<br>
double initial_time0_encoded(time) ;<br>
initial_time0_encoded:units = "yyyymmddhh.hh_frac" ;<br>
initial_time0_encoded:long_name = "initial time encoded as double" ;<br>
float lat_0(lat_0) ;<br>
lat_0:La1 = 90.f ;<br>
lat_0:Lo1 = 0.f ;<br>
lat_0:La2 = -90.f ;<br>
lat_0:Lo2 = 359.f ;<br>
lat_0:Di = 1.f ;<br>
lat_0:Dj = 1.f ;<br>
lat_0:units = "degrees_north" ;<br>
lat_0:grid_type = "Latitude/Longitude" ;<br>
lat_0:long_name = "latitude" ;<br>
float lon_0(lon_0) ;<br>
lon_0:La1 = 90.f ;<br>
lon_0:Lo1 = 0.f ;<br>
lon_0:La2 = -90.f ;<br>
lon_0:Lo2 = 359.f ;<br>
lon_0:Di = 1.f ;<br>
lon_0:Dj = 1.f ;<br>
lon_0:units = "degrees_east" ;<br>
lon_0:grid_type = "Latitude/Longitude" ;<br>
lon_0:long_name = "longitude" ;<br>
char initial_time0(time, ncl_strlen_0) ;<br>
initial_time0:NCL_converted_from_type = "string" ;<br>
initial_time0:units = "mm/dd/yyyy (hh:mm)" ;<br>
initial_time0:long_name = "Initial time of first record" ;<br>
<br>
// global attributes:<br>
:creation_date = "Wed Oct 8 13:35:24 MDT 2014" ;<br>
:NCL_Version = "6.2.0" ;<br>
:system = "Darwin <a href="http://sheamac.cgd.ucar.edu">sheamac.cgd.ucar.edu</a> 13.4.0 Darwin Kernel Version 13.4.0: Sun Aug 17 19:50:11 PDT 2014; root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64" ;<br>
:Conventions = "None" ;<br>
:grib_source = "aod.2014100400.grb" ;<br>
:title = "NCL: convert-GRIB-to-netCDF" ;<br>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Wed, Oct 8, 2014 at 12:41 PM, Partha Bhattacharjee <span dir="ltr">
<<a href="mailto:pbhatta2@jhu.edu" target="_blank">pbhatta2@jhu.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div dir="ltr" style="font-size:12pt; color:#000000; background-color:#ffffff; font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Thanks Dave. It worked. <br>
</p>
<p><br>
</p>
<p>Partha<br>
</p>
<div style="color:rgb(33,33,33)">
<hr style="display:inline-block; width:98%">
<div dir="ltr"><font color="#000000" face="Calibri, sans-serif" style="font-size:11pt"><b>From:</b> David Brown <<a href="mailto:dbrown@ucar.edu" target="_blank">dbrown@ucar.edu</a>><br>
<b>Sent:</b> Wednesday, October 8, 2014 2:29 PM<br>
<b>To:</b> Partha Bhattacharjee<br>
<b>Cc:</b> <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
<b>Subject:</b> Re: [ncl-talk] Write grib2 to netcdf</font>
<div> </div>
</div>
<div>
<div class="h5">
<div>
<div dir="ltr">If you use ncl_filedump on your GRIB2 file you will see that it has no time dimension. There is only a lat and a lon dimension. The script you are using is trying to read a time dimension that does not exist -- therefore the error. The simplest
and most general way to convert any GRIB file to NetCDF is to use the script ncl_convert2nc, which is supplied with every NCL installation. If the 'ncl' binary is in your PATH then ncl_convert2nc will be as well, assuming you have a standard installation.
<div> -dave<br>
<div>
<div>
<p><br>
</p>
</div>
</div>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Wed, Oct 8, 2014 at 10:41 AM, Partha Bhattacharjee <span dir="ltr">
<<a href="mailto:pbhatta2@jhu.edu" target="_blank">pbhatta2@jhu.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div dir="ltr" style="font-size:12pt; color:#000000; background-color:#ffffff; font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Forgot to add information about my earlier question. I am using NCL 6.2.1. <br>
</p>
<p><br>
</p>
<p>Partha<br>
</p>
<div dir="ltr" style="font-size:12pt; color:#000000; background-color:#ffffff; font-family:Calibri,Arial,Helvetica,sans-serif">
<hr style="display:inline-block; width:98%">
<div dir="ltr"><font color="#000000" face="Calibri, sans-serif" style="font-size:11pt"><b>From:</b>
<a href="mailto:ncl-talk-bounces@ucar.edu" target="_blank">ncl-talk-bounces@ucar.edu</a> <<a href="mailto:ncl-talk-bounces@ucar.edu" target="_blank">ncl-talk-bounces@ucar.edu</a>> on behalf of Partha Bhattacharjee <<a href="mailto:pbhatta2@jhu.edu" target="_blank">pbhatta2@jhu.edu</a>><br>
<b>Sent:</b> Wednesday, October 8, 2014 11:39 AM<br>
<b>To:</b> <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
<b>Subject:</b> [ncl-talk] Write grib2 to netcdf</font>
<div> </div>
</div>
<span>
<div>
<p>I was using slightly modified form of an example in NCL page <a href="https://www.ncl.ucar.edu/Applications/gribeff.shtml" title="https://www.ncl.ucar.edu/Applications/gribeff.shtml
Ctrl+click or tap to follow link" target="_blank">https://www.ncl.ucar.edu/Applications/gribeff.shtml</a>
to convert grib2 file to netcdf. However, ncl cannot read the time information from input grib2 file and stops where "initial_time" is mentioned. Grib2 file and ncl code are attached. Any help is appreciated. <br>
</p>
<p><br>
</p>
<p> Thanks.<br>
</p>
<p> Partha<br>
</p>
</div>
</span></div>
</div>
<br>
_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</body>
</html>