<div dir="ltr">thanks for your help<div>i will try to do this merge<br>regards </div><div><div class="gmail_quote">On Mon, Oct 3, 2011 at 11:28 PM, David Brown <span dir="ltr">&lt;<a href="mailto:dbrown@ucar.edu">dbrown@ucar.edu</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div style="word-wrap:break-word">Hi Ahmed,<div>The point is that this is the way the file is written. NCL cannot extrapolate for the GRIB records that have fewer longitude elements. Neither can wgrib or any other tool I know of. You could combine the variables as NCL reads them into a single variable yourself. You would need to fill in the missing elements along the longitude dimension with _FillValues but it could be done. Look at the 2 forecast_time coordinate variables to figure out how to merge the variables into one.</div>

<div> -dave</div><div><div></div><div class="h5"><div><br><div><div>On Oct 3, 2011, at 1:54 AM, ahmed lasheen wrote:</div><br><blockquote type="cite"><div dir="ltr">thanks for your help.<div><div><div>Now , i understood why the NCL generate all these variables.</div>

<div>But still an issue, that it seems that NCL make two copies of each variables, each variable</div>

<div>with different longitude .so we have one variable with small number of longitudes and other with a big number of longitude, so from where NCL can get the values of the variable when it generate the variable with large longitude for whole domain as it is only define for a subset of the data in the grib file , does NCL makes extrapolation.?</div>



<div><br></div><div>the file that i am using is a subset of the WRF NMM core output .</div><div>i am trying to figure out why  WRF generate such variables with such change in longitudes.</div><div>regards,</div><div><br>


<div class="gmail_quote">
On Thu, Sep 29, 2011 at 6:28 PM, Gus Correa <span dir="ltr">&lt;<a href="mailto:gus@ldeo.columbia.edu" target="_blank">gus@ldeo.columbia.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



Hi David, Ahmed<br>
<br>
I came across to this type of problem in the past, with the CFS model<br>
output [grib1 files].<br>
I used ncl_convert2nc [which seems to behave similar to ncl_filedump<br>
used by Ahmed] to convert the data from grib1 to NetCDF,<br>
and in some occasions there was more than one variable in the<br>
output for a single variable in the input file [just as in Ahmed&#39;s case].<br>
<br>
There was yet another discussion about this problem started by<br>
Allison Steiner in this list last July.<br>
See this thread, it may be helpful:<br>
<br>
<a href="http://www.ncl.ucar.edu/Support/talk_archives/2011/1795.html" target="_blank">http://www.ncl.ucar.edu/Support/talk_archives/2011/1795.html</a><br>
<br>
However, in that case [and in mine] the problem was related to<br>
time grid variation, because models [CFS, CSFR, etc] seem to<br>
do something about the time grid (not the spatial grids)<br>
that doesn&#39;t make Grib very happy.<br>
<br>
I am not savvy on grib format, but I suppose grib was<br>
designed to acommodate data that might have grids<br>
with varying spatial resolution, which might also have<br>
variable time sampling interval, etc.<br>
It was designed particularly for observational data,<br>
where stations or other observation platforms may fail, new ones may<br>
come to play, some may sample once a day, others every hour, etc,<br>
hence producing sparse and irregular data.<br>
<br>
By contrast NetCDF, maybe other formats, have a more stable format,<br>
often handling model data,<br>
with grid sizes declared ahead of time [except for the time/record<br>
dimension].<br>
Maybe NCL adopts an approach similar to NetCDF, expecting grids to<br>
be static, regular.<br>
I suppose that following this logic,<br>
NCL splits any Grib irregular grid in a<br>
minimal set of regular grids, which is what puzzles Ahmed,<br>
but was clearly explained by David in the case of the longitude grid.<br>
<br>
Someone correct me if I am wrong, but grib seems to store<br>
the spatial grids for each time record, whereas<br>
NetCDF stores a single set of spatial grids for all time records.<br>
<br>
In the past I was also distressed by NCL producing several variables for<br>
a single grib variable on the input, whenever any of the grids change.<br>
However, now I am convinced that NCL does the right thing, as David said.<br>
<br>
Now, here is where I don&#39;t agree with David.<br>
If Ahmed data is observational, there may be no mistake<br>
whatsoever during its production.<br>
The irregular spatial grids may just reflect the irregularity<br>
of the sampling process in the real world.<br>
<br>
My two cents,<br>
<font color="#888888">Gus Correa<br>
</font><div><div></div><div><br>
David Brown wrote:<br>
&gt; Hi Ahmed,<br>
&gt;<br>
&gt; I examined your file and have found that the variables you list below<br>
&gt; differ not only in time but also in space: there are 2 different grids<br>
&gt; represented. They both have the same latitude elements, but in<br>
&gt; longitude, one grid has 277 elements from -16.686 to 75.22 while the<br>
&gt; other has 261 elements from -16.686 to 70. You see this with wgrib if<br>
&gt; you run it as wgrib -V and compare, for instance, record 167 and 168<br>
&gt; (both APCP in wgrib). Considering the randomness of the way the 2 grids<br>
&gt; are interspersed in the forecast time sequence, perhaps there was a<br>
&gt; mistake in the production of these files,  but NCL has no choice but to<br>
&gt; consider these as two different variables. As for the variables with the<br>
&gt; suffix _acc,  they do belong in some sense to the corresponding variable<br>
&gt; with the _acc3h suffix: they are the initial record at the beginning of<br>
&gt; the accumulation period. However, since no time has passed they do not<br>
&gt; fit the 3 hour accumulation designation. Their values are all either 0<br>
&gt; or the missing value so their absence from the time array dimension<br>
&gt; should be easy to work around.<br>
&gt;  -dave<br>
&gt;<br>
&gt; On Sep 28, 2011, at 4:15 PM, ahmed lasheen wrote:<br>
&gt;<br>
&gt;&gt; thanks for your reply .<br>
&gt;&gt; i read the NCL manual for how NCL  process the grib file.But i<br>
&gt;&gt; still wondering for example if NCL finds that the grib file contains<br>
&gt;&gt; several records with the  same variable name ,with  the same level<br>
&gt;&gt; (ex: isobaric level) and same dimension , differ only in time , then<br>
&gt;&gt; why it nesed to create different variables .the algorithm of the NCL<br>
&gt;&gt; as i understand should not permit generation of such variables.<br>
&gt;&gt; in my grib file i have 3 variables only and here is the dump of the<br>
&gt;&gt; file using the ncl.<br>
&gt;&gt; sometimes these variables are misleading and confusing.<br>
&gt;&gt;       float A_PCP_GDS0_SFC_acc ( g0_lat_0, g0_lon_1 )<br>
&gt;&gt;       float A_PCP_GDS0_SFC_acc3h ( forecast_time2, g0_lat_0, g0_lon_1)<br>
&gt;&gt;       float A_PCP_GDS0_SFC_acc3h_1 ( forecast_time3, g0_lat_4, g0_lon_5 )<br>
&gt;&gt;       float NCPCP_GDS0_SFC_acc ( g0_lat_0, g0_lon_1 )<br>
&gt;&gt;       float NCPCP_GDS0_SFC_acc3h ( forecast_time2, g0_lat_0, g0_lon_1 )<br>
&gt;&gt;       float NCPCP_GDS0_SFC_acc3h_1 ( forecast_time3, g0_lat_4, g0_lon_1)<br>
&gt;&gt;       float ACPCP_GDS0_SFC_acc ( g0_lat_0, g0_lon_1 )<br>
&gt;&gt;       float ACPCP_GDS0_SFC_acc3h ( forecast_time2, g0_lat_0, g0_lon_1<br>
&gt;&gt;       float ACPCP_GDS0_SFC_acc3h_1 ( forecast_time3, g0_lat_4, g0_lon_5 )<br>
&gt;&gt;     i aslo have attached the dump of file using both wgrib and ncl_fildump<br>
&gt;&gt;<br>
&gt;&gt; On Wed, Sep 28, 2011 at 11:18 PM, David Brown &lt;<a href="mailto:dbrown@ucar.edu" target="_blank">dbrown@ucar.edu</a><br>
</div></div><div><div></div><div>&gt;&gt; &lt;mailto:<a href="mailto:dbrown@ucar.edu" target="_blank">dbrown@ucar.edu</a>&gt;&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt;     Hi Ahmed,<br>
&gt;&gt;<br>
&gt;&gt;     wgrib simply lists each record in a GRIB file in the order it<br>
&gt;&gt;     finds them. NCL looks through the whole file and organizes the<br>
&gt;&gt;     records into variables with time and level dimensions in addition<br>
&gt;&gt;     to the horizontal lat/lon dimensions. But in order to add those<br>
&gt;&gt;     dimensions, it needs to make sure  that the records are<br>
&gt;&gt;     compatible. GRIB has many types of level records for instance<br>
&gt;&gt;     (e.g. sigma levels,  hybrid levels, pressure levels). In order to<br>
&gt;&gt;     create a valid level dimension, all the records used must have the<br>
&gt;&gt;     same type of level, in addition to representing the same type of<br>
&gt;&gt;     quantity. Further, the GRIB file can contain records with the same<br>
&gt;&gt;     type of quantity but on different horizontal grids, with different<br>
&gt;&gt;     extents or resolutions or projection type. These must be<br>
&gt;&gt;     represented with different variables. The whole process that NCL<br>
&gt;&gt;     uses to represent GRIB data is described in detail<br>
&gt;&gt;     at <a href="http://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclFormatSupport.shtml#GRIB" target="_blank">http://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclFormatSupport.shtml#GRIB</a>.<br>
&gt;&gt;     I hope this helps.<br>
&gt;&gt;      -dave<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;     On Sep 28, 2011, at 1:31 PM, ahmed lasheen wrote:<br>
&gt;&gt;<br>
&gt;&gt;&gt;     hello<br>
&gt;&gt;&gt;     when i make wgrib for grib1 file contains precipitation data , i<br>
&gt;&gt;&gt;     found three variables which are precipitation  of grid scale<br>
&gt;&gt;&gt;     , precipitation of convective scale and total<br>
&gt;&gt;&gt;     scale precipitation.But when i make ncl_filedump i see 9<br>
&gt;&gt;&gt;     variables which represent those variables plus others<br>
&gt;&gt;&gt;     related variables to them<br>
&gt;&gt;&gt;     but different on the average time and grid location.why this<br>
&gt;&gt;&gt;     occur ? and what this difference means between  wgrib and<br>
&gt;&gt;&gt;     ncl_filedump?.<br>
&gt;&gt;&gt;     thanks in advance<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;     --<br>
&gt;&gt;&gt;     ===============<br>
&gt;&gt;&gt;     Ahmed Lasheen<br>
&gt;&gt;&gt;     Junior researcher at Cairo Numerical Weather Prediction Center<br>
&gt;&gt;&gt;     (CNWPC)<br>
&gt;&gt;&gt;     Egyptian Meteorological Authority(EMA)<br>
&gt;&gt;&gt;     Cairo,Egypt<br>
&gt;&gt;&gt;     ===============<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;     _______________________________________________<br>
&gt;&gt;&gt;     ncl-talk mailing list<br>
&gt;&gt;&gt;     List instructions, subscriber options, unsubscribe:<br>
&gt;&gt;&gt;     <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; --<br>
&gt;&gt; ===============<br>
&gt;&gt; Ahmed Lasheen<br>
&gt;&gt; Junior researcher at Cairo Numerical Weather Prediction Center (CNWPC)<br>
&gt;&gt; Egyptian Meteorological Authority(EMA)<br>
&gt;&gt; Cairo,Egypt<br>
&gt;&gt; ===============<br>
&gt;&gt;<br>
&gt;&gt; &lt;wgrib&gt;&lt;ncl&gt;_______________________________________________<br>
&gt;&gt; ncl-talk mailing list<br>
&gt;&gt; List instructions, subscriber options, unsubscribe:<br>
&gt;&gt; <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
&gt;<br>
&gt;<br>
</div></div>&gt; ------------------------------------------------------------------------<br>
<div><div></div><div>&gt;<br>
&gt; _______________________________________________<br>
&gt; ncl-talk mailing list<br>
&gt; List instructions, subscriber options, unsubscribe:<br>
&gt; <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<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>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><span style="font-size:x-small"><span style="background-color:rgb(255, 255, 255)"><font color="#3366FF" face="&#39;comic sans ms&#39;, sans-serif"><div>



<span style="font-size:x-small"><font><span style="background-color:rgb(255, 255, 255)"><font color="#3366FF">===============</font></span></font></span></div>Ahmed Lasheen<br></font></span></span><div><font face="&#39;comic sans ms&#39;, sans-serif"><span style="background-color:rgb(255, 255, 255)"><font color="#3366FF"><font size="1">Junior researcher at </font></font></span><span style="font-size:x-small;color:rgb(51, 102, 255)">Cairo Numerical Weather Prediction Center (CNWPC)</span></font></div>



<div><span style="font-size:x-small"><span style="background-color:rgb(255, 255, 255)"><font color="#3366FF" face="&#39;comic sans ms&#39;, sans-serif">Egyptian Meteorological Authority(EMA)</font></span></span></div><div>



<span style="font-size:x-small"><span style="background-color:rgb(255, 255, 255)"><font color="#3366FF" face="&#39;comic sans ms&#39;, sans-serif">Cairo,Egypt </font></span></span></div><div><span style="font-size:x-small"><span style="background-color:rgb(255, 255, 255)"><font color="#3366FF" face="&#39;comic sans ms&#39;, sans-serif">===============</font></span></span></div>



</div><br>
</div></div></div></div>
_______________________________________________<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>

</blockquote></div><br></div></div></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><span style="font-size:x-small"><span style="background-color:rgb(255, 255, 255)"><font color="#3366FF" face="&#39;comic sans ms&#39;, sans-serif"><div>

<span style="font-size:x-small"><font><span style="background-color:rgb(255, 255, 255)"><font color="#3366FF">===============</font></span></font></span></div>Ahmed Lasheen<br></font></span></span><div><font face="&#39;comic sans ms&#39;, sans-serif"><span style="background-color:rgb(255, 255, 255)"><font color="#3366FF"><font size="1">Junior researcher at </font></font></span><span style="font-size:x-small;color:rgb(51, 102, 255)">Cairo Numerical Weather Prediction Center (CNWPC)</span></font></div>

<div><span style="font-size:x-small"><span style="background-color:rgb(255, 255, 255)"><font color="#3366FF" face="&#39;comic sans ms&#39;, sans-serif">Egyptian Meteorological Authority(EMA)</font></span></span></div><div>

<span style="font-size:x-small"><span style="background-color:rgb(255, 255, 255)"><font color="#3366FF" face="&#39;comic sans ms&#39;, sans-serif">Cairo,Egypt </font></span></span></div><div><span style="font-size:x-small"><span style="background-color:rgb(255, 255, 255)"><font color="#3366FF" face="&#39;comic sans ms&#39;, sans-serif">===============</font></span></span></div>

</div><br>
</div></div>