<div dir="ltr">Changing  <br><div>   var    = SPL2_E_f->$var_path$<br>    lat     = SPL2_E_f->$lat_path$<br>    lon    = SPL2_E_f->$lon_path$<br><br></div><div>To:<br>    var   := SPL2_E_f->$var_path$<br>    lat    := SPL2_E_f->$lat_path$<br>    lon   := SPL2_E_f->$lon_path$<br><br></div><div>Will allow variables of different sizes to be input.<br><br>===<br></div><div>The figure you included clearly show multiple satellite swaths. Likely, one swath per file.<br><b>*Each swath spanned different areas on the globe*<br></b></div><div><b> </b>Most of the swaths do <b>NOT</b> include your region of interest<b>.<br></b>===<b><br></b></div><div><br>;---Determine domain<br>;       Ajabshir(37.5,45.85)<br>;       Azarshahr(37.75,45.98)<br>;       Domain(37.80/45.8/37.45/46.03)<wbr>  (N/W/S/E)<br>;                       --37.80-----<br>;                       |                       |<br>;                 45.8            46.03<br>;                       |                       |<br>;                       ---37.45----<br><br>;---Following are from email Dennis Shea:<br>    latS                        = 37.45<br>    latN                        = 37.80<br>    lonL                        = 45.8<br>    lonR                        = 46.03<br><br>=========================<br></div><div>What do you expect? <br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Aug 17, 2018 at 2:27 PM, Ehsan Taghizadeh <span dir="ltr"><<a href="mailto:ehsantaghizadeh@yahoo.com" target="_blank">ehsantaghizadeh@yahoo.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-family:Helvetica Neue,Helvetica,Arial,sans-serif;font-size:16px"><div style="font-family:Helvetica Neue,Helvetica,Arial,sans-serif;font-size:16px"><div></div>
        <div>Dears,</div><div>Pardon me to forward my questions twice. May I ask how using attached script for multiple files?</div><div><br></div><div>Sincerely</div><span class="HOEnZb"><font color="#888888"><div>Ehsan</div><div><br></div>
        
        </font></span></div><div id="m_2989811908904530576ydpb4fa9243yahoo_quoted_5055561477" class="m_2989811908904530576ydpb4fa9243yahoo_quoted">
            <div style="font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:13px;color:#26282a"><span class="">
                <div>----- Forwarded Message -----</div>
                <div><b>From:</b> Ehsan Taghizadeh <<a href="mailto:ehsantaghizadeh@yahoo.com" target="_blank">ehsantaghizadeh@yahoo.com</a>></div></span><div><div class="h5"><div><b>To:</b> Ncl-talk <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>>; <a href="mailto:alesall@iri.columbia.edu" target="_blank">alesall@iri.columbia.edu</a> <<a href="mailto:alesall@iri.columbia.edu" target="_blank">alesall@iri.columbia.edu</a>></div><div><b>Sent:</b> Tuesday, August 14, 2018, 7:03:20 PM GMT+4:30</div><div><b>Subject:</b> Re: [ncl-talk] Fw: area average</div><div><br></div>
                <div><div id="m_2989811908904530576ydpb4fa9243yiv0406576422"><div><div style="font-family:bookman old style,new york,times,serif;font-size:16px"><div>Thank you for your helps.</div><div>Dear Alessandra</div><div>Thank you for you comments. A reference of my data could be this page (<a shape="rect" href="https://nsidc.org/data/SPL2SMP_E/versions/2" rel="nofollow" target="_blank">https://nsidc.org/data/<wbr>SPL2SMP_E/versions/2</a>). However Dennis's comments<span><span style="color:rgb(0,0,0)"> about my data</span></span> are true. I've attached a picture of these data for date 1 April 2018.</div><div>Also the result of PrintVarSummary(Var):</div><div><br clear="none"></div><div><span></span><div><font size="2" face="times new roman, new york, times, serif">    Variable: var</font></div><div><font size="2" face="times new roman, new york, times, serif">    Type: float</font></div><div><font size="2" face="times new roman, new york, times, serif">    Total Size: 1124096 bytes</font></div><div><font size="2" face="times new roman, new york, times, serif">                281024 values</font></div><div><font size="2" face="times new roman, new york, times, serif">    Number of Dimensions: 1</font></div><div><font size="2" face="times new roman, new york, times, serif">    Dimensions and sizes:   [DIM_000 | 281024]</font></div><div><font size="2" face="times new roman, new york, times, serif">    Coordinates:</font></div><div><font size="2" face="times new roman, new york, times, serif">    Number Of Attributes: 6</font></div><div><font size="2" face="times new roman, new york, times, serif">      _FillValue :  -9999</font></div><div><font size="2" face="times new roman, new york, times, serif">      coordinates : /Soil_Moisture_Retrieval_Data/<wbr>latitude /Soil_Moisture_Retrieval_Data/<wbr>longitude</font></div><div><font size="2" face="times new roman, new york, times, serif">      long_name :   Representative soil moisture measurement for the Earth based grid cell.</font></div><div><font size="2" face="times new roman, new york, times, serif">      units :       cm**3/cm**3</font></div><div><font size="2" face="times new roman, new york, times, serif">      valid_max :   0.5</font></div><div><font size="2" face="times new roman, new york, times, serif">      valid_min :   0.02</font></div><div><br clear="none"></div></div><div>Please let me know if I should explain more.</div><div><br clear="none"></div><div>I've used Dennis's suggestion, and it worked well. However may I know 2 extra points:</div><div>1- I've tried to use attached script to get average from multiple files, but an error as below has occurred:</div><div><br clear="none"></div><div><span style="background-color:rgb(253,248,105)"><font size="2" face="courier new, courier, monaco, monospace, sans-serif"><span>fatal:Dimension sizes of left hand side and right hand side of assignment do not match</span><br clear="none"></font></span></div><div><span><span style="background-color:rgb(253,248,105)"><font size="2" face="courier new, courier, monaco, monospace, sans-serif">fatal:["Execute.c":8637]:<wbr>Execute: Error occurred at or near line 61 in file SPL2SMP_E_areaave_mod1.ncl</font></span><br clear="none"></span></div><div><br clear="none"></div><div>This error could be expected because of the below lines in loop:<br clear="none"><font size="2" face="times new roman, new york, times, serif"><span>    var<span style="white-space:pre-wrap">                               </span>= SPL2_E_f->$var_path$</span><br clear="none"></font></div><div><span><font size="2" face="times new roman, new york, times, serif"><span>    lat<span style="white-space:pre-wrap">                          </span>= SPL2_E_f->$lat_path$</span><br clear="none"></font></span></div><div><span><span><font size="2" face="times new roman, new york, times, serif"><span>    lon<span style="white-space:pre-wrap">                         </span>= SPL2_E_f->$lon_path$</span><br clear="none"></font></span></span></div><div><span><span><font size="2" face="times new roman, new york, times, serif"><span><span>    sm_avg(i)                    = avg(var(ism))</span><br clear="none"></span></font></span></span></div><div><span><span><font size="2" face="times new roman, new york, times, serif"><span><span><br clear="none"></span></span></font></span></span></div><div>However using "<font size="2" face="times new roman, new york, times, serif">:=</font>" couldn't help so.</div><div>May I ask help again about using above lines in loop.</div><div><br clear="none"></div><div>2- May I ask how compute areal average of these data? I mean which function of ncl could help me about that (just for curiously!).</div><div><br clear="none"></div><div>Sincerely</div><div>Ehsan</div><div><br clear="none"></div><div class="m_2989811908904530576ydpb4fa9243yiv0406576422yahoo_quoted" id="m_2989811908904530576ydpb4fa9243yiv0406576422yahoo_quoted_5180311432">
            <div style="font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:13px;color:#26282a">
                
                <div class="m_2989811908904530576ydpb4fa9243yiv0406576422yqt6806569319" id="m_2989811908904530576ydpb4fa9243yiv0406576422yqtfd10056"><div>
                    On Monday, August 13, 2018, 8:23:47 AM GMT+4:30, Dennis Shea <<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>> wrote:
                </div>
                <div><br clear="none"></div>
                <div><br clear="none"></div>
                <div><div id="m_2989811908904530576ydpb4fa9243yiv0406576422"><div><div dir="ltr"><div><div><div>The data values on  '<b>SMAP_L2_</b>SM_P_E_*h5' are from satellite <b>swaths</b>. "<b>L2</b>"<br clear="none"></div><div><br clear="none"></div>The data variable ("soil_moisture") and the location variables: "latitude" and  "longitude" are all <b>one-dimensional</b>. It looks like the swath values and the associated latitude & longitude locations were just made into one-dimensional arrays. <br clear="none"><br clear="none"></div><div>Your code comments the following:<br clear="none"></div><div><br clear="none"><b>/;</b><br clear="none">                            --37.80-----<br clear="none">                        |                       |<br clear="none">                   45.8                  46.03<br clear="none">                        |                       |<br clear="none">                            ---37.45----<br clear="none"><b>;/</b><br clear="none"><br clear="none"></div><div>There is <b>no need </b>to perform and areal average when using such a small area [specifically such a small latitudinal range]. .The following should suffice:<br clear="none"><br clear="none"></div><div>       latS = 37.45<br clear="none"></div><div>       latN = 37.80<br clear="none"></div><div>       lonL = 45.8<br clear="none"></div><div>       lonR = 4603<br clear="none"><br clear="none"></div><div>      sm    = f->soil_moisture   ; [*]<br clear="none"></div><div>      lat     = f->latitude             ; [*]<br clear="none"></div><div>      lon    = f->longitude          ; [*]<br clear="none"></div><div><br clear="none"></div><div>       ism = <b><a shape="rect" href="http://www.ncl.ucar.edu/Document/Functions/Built-in/ind.shtml" rel="nofollow" target="_blank">ind</a></b>(<b>.not</b><a shape="rect" href="http://.ismissing" rel="nofollow" target="_blank"><b>.ismissing</b></a>(sm) .and. lat.ge.latS   .and. lat.le.latN \<br clear="none"></div><div>                              <wbr>                         .and. lon.ge.lonL .and. lon.le.lonR)<br clear="none"></div><div>       npts = <a shape="rect" href="http://www.ncl.ucar.edu/Document/Functions/Built-in/dimsizes.shtml" rel="nofollow" target="_blank"><b>dimsizes</b></a>(ism)<br clear="none"></div><div><br clear="none"></div><div>       sm_avg = <a shape="rect" href="http://www.ncl.ucar.edu/Document/Functions/Built-in/avg.shtml" rel="nofollow" target="_blank"><b>avg</b></a>(sm(ism))<br clear="none"></div><div>============================== ====================<br clear="none">Side points:<br clear="none"><br clear="none"></div>Alessandra's suggestions would be appropriate if the original data were on a rectilinear grid and then had been placed onto 1D arrays. Then, if you knew the appropriate nlat and mlon sizes you could have used<br clear="none"><br clear="none"></div>      xGrid = <b><a shape="rect" href="http://www.ncl.ucar.edu/Document/Functions/Built-in/conform_dims.shtml" rel="nofollow" target="_blank">conform_dims</a></b>( (/nlat,mlon/), x1d)   ; (nlat,mlon); similar to <a shape="rect" href="http://www.ncl.ucar.edu/Document/Functions/Built-in/onedtond.shtml" rel="nofollow" target="_blank"><b>onedtond</b></a><br clear="none"><div><div><div><br clear="none">===<br clear="none">The documentation for <b><a shape="rect" href="http://www.ncl.ucar.edu/Document/Functions/Built-in/wgt_areaave.shtml" rel="nofollow" target="_blank">wgt_areaave</a></b> should be clarified. This function expects a <b>rectilinear</b> grid.<br clear="none"><br clear="none">======<br clear="none"><div class="m_2989811908904530576ydpb4fa9243yiv0406576422gmail_extra"><div class="m_2989811908904530576ydpb4fa9243yiv0406576422gmail_quote">On Sun, Aug 12, 2018 at 4:13 PM, alesall <span dir="ltr"><<a shape="rect" href="mailto:alesall@iri.columbia.edu" rel="nofollow" target="_blank">alesall@iri.columbia.edu</a>></span> wrote:<br clear="none"><blockquote class="m_2989811908904530576ydpb4fa9243yiv0406576422gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="m_2989811908904530576ydpb4fa9243yiv0406576422yqt8774489905" id="m_2989811908904530576ydpb4fa9243yiv0406576422yqt11037"><div><div><br clear="none"></div>Hi Ehsan, <div><br clear="none"></div><div>can you reorganize your data so that it is 2-dimensional, in latitude and longitude?</div><div>If your “var” measures something which varies in latitude and longitude, you need to figure out how the data in it is ordered/organized. </div><div>Is the fastest dimension longitude or latitude?</div><div>You can use functions like “onedtond” to break down a vector of length nlon x nlat into a matrix of dimensions nlon, nlat.</div><div>And then assign names/values of latitude and longitude to the dimensions accordingly.</div><div><br clear="none"></div><div>warm regards</div><div><br clear="none"></div><div><br clear="none"></div><div><br clear="none"></div><div><br clear="none"><div>
<div>-- <br clear="none">Alessandra Giannini<br clear="none">IRI for Climate and Society - The Earth Institute at Columbia University<br clear="none">P.O. Box 1000, Palisades NY 10964-8000<br clear="none">phone/fax: +1 845 680-4473/4864 - email: <a shape="rect" href="mailto:alesall@iri.columbia.edu" rel="nofollow" target="_blank">alesall@iri.columbia.ed u</a></div>

</div>
<div><br clear="none"><blockquote type="cite"><div><div class="m_2989811908904530576ydpb4fa9243yiv0406576422m_-5502896329409997538gmail-h5"><div>On Aug 12, 2018, at 3:16 PM, Ehsan Taghizadeh <<a shape="rect" href="mailto:ehsantaghizadeh@yahoo.com" rel="nofollow" target="_blank">ehsantaghizadeh@yahoo.com</a>> wrote:</div><br class="m_2989811908904530576ydpb4fa9243yiv0406576422m_-5502896329409997538gmail-m_5826833313638763522Apple-interchange-newline" clear="none"></div></div><div><div><div class="m_2989811908904530576ydpb4fa9243yiv0406576422m_-5502896329409997538gmail-h5"><div><div style="font-family:bookman old style,new york,times,serif;font-size:16px"><div style="font-family:bookman old style,new york,times,serif;font-size:16px"><div></div>
        <div>Hi,</div><div>I'm sorry to forward my question again! Do you think it is possible doing this or I should leave it?</div><div>I'll be thankful for any suggestion.</div><div><br clear="none"></div><div>Sincerely</div><div>Ehsan</div><div><br clear="none"></div><div><br clear="none"></div>
        
        </div><div class="m_2989811908904530576ydpb4fa9243yiv0406576422m_-5502896329409997538gmail-m_5826833313638763522ydpa8de3a6fyahoo_quoted" id="m_2989811908904530576ydpb4fa9243yiv0406576422m_-5502896329409997538gmail-m_5826833313638763522ydpa8de3a6fyahoo_quoted_4594534684">
            <div>
                <div>----- Forwarded Message -----</div>
                <div><b>From:</b> Ehsan Taghizadeh <<a shape="rect" href="mailto:ehsantaghizadeh@yahoo.com" rel="nofollow" target="_blank">ehsantaghizadeh@yahoo.com</a>></div><div><b>To:</b> Ncl-talk <<a shape="rect" href="mailto:ncl-talk@ucar.edu" rel="nofollow" target="_blank">ncl-talk@ucar.edu</a>></div><div><b>Sent:</b> Thursday, August 2, 2018, 8:00:22 PM GMT+4:30</div><div><b>Subject:</b> area  average</div><div><br clear="none"></div>
                <div><div id="m_2989811908904530576ydpb4fa9243yiv0406576422m_-5502896329409997538gmail-m_5826833313638763522ydpa8de3a6fyiv7902342373"><div><div style="font-family:bookman old style,new york,times,serif;font-size:16px"><div>Hi,</div><div>I've tried to compute area average using "<span>wgt_areaave</span>". However it seems my data are 1 dimensional. So the following error occurred, as it is expected:</div><div><span style="background-color:rgb(253,248,105)">      fatal:wgt_areaave: the input array must have at least 2 dimensions</span><br clear="none"></div><div><br clear="none"></div><div>Could I ask any help to have are average from 1 dimension data?!</div><div><br clear="none"></div><div>I attached my script and put input files (<span>SPL2SMP_E.tar</span>) in ftp. Other information are:</div><div> <span style="background-color:rgb(173,215,115)"><span><span style="color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px">$</span></span> <span><span style="color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px">ncl -V</span></span></span></div><div><span><span style="color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px;background-color:rgb(173,215,115)">     <span>6.5.0</span></span></span></div><div><span><span style="color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px"><span style="background-color:rgb(173,215,115)">$ <span><span style="color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px">uname -a</span></span></span></span></span></div><div><font face="verdana, sans-serif" color="#333333"><span style="font-size:13.3333px;background-color:rgb(173,215,115)">     <span>Linux localhost.localdomain 3.10.0-514.2.2.el7.x86_64 #1 SMP Tue Dec 6 23:06:41 UTC 2016 x86_64         x86_64 x86_64 GNU/Linux</span></span></font></div><div><font face="verdana, sans-serif" color="#333333"><span style="font-size:13.3333px"><span style="background-color:rgb(173,215,115)">$ <span><span style="color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px">gcc --version</span></span></span></span></font></div><div><span style="background-color:rgb(173,215,115)"><font face="verdana, sans-serif" color="#333333"><span style="font-size:13.3333px"><span><span><span style="color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px">     <span></span></span></span></span></span></font><span style="color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px">gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28)</span></span><font face="verdana, sans-serif" color="#333333"><span style="font-size:13.3333px"><span><span><span style="color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px"><span></span></span></span></span></span></font><div><span style="background-color:rgb(173,215,115)">     Copyright (C) 2015 Free Software Foundation, Inc.</span></div><div><span><span><br clear="none"></span></span></div><div><span><span>I'll be thankful for any help.</span></span><br clear="none"></div><div><span><span><br clear="none"></span></span></div><div><span><span>Sincerely</span></span></div><div><span><span>Ehsan</span></span></div></div><div style="font-family:bookman old style,new york,times,serif;font-size:16px"></div></div></div></div></div>
            </div>
        </div></div></div></div></div><span><SPL2SMP_E_areaave.ncl></span>_______ ______________________________ __________<br clear="none">ncl-talk mailing list<br clear="none"><a shape="rect" href="mailto:ncl-talk@ucar.edu" rel="nofollow" target="_blank">ncl-talk@ucar.edu</a><br clear="none">List instructions, subscriber options, unsubscribe:<br clear="none"><a shape="rect" href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="nofollow" target="_blank">http://mailman.ucar.edu/mailma n/listinfo/ncl-talk</a><br clear="none"></div></blockquote></div><br clear="none"></div></div></div><br clear="none">______________________________ _________________<br clear="none">
ncl-talk mailing list<br clear="none">
<a shape="rect" href="mailto:ncl-talk@ucar.edu" rel="nofollow" target="_blank">ncl-talk@ucar.edu</a><br clear="none">
List instructions, subscriber options, unsubscribe:<br clear="none">
<a shape="rect" href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="nofollow" target="_blank">http://mailman.ucar.edu/mailma n/listinfo/ncl-talk</a><br clear="none">
<br clear="none"></blockquote></div><br clear="none"></div></div></div></div></div></div></div></div>
            </div></div><div class="m_2989811908904530576ydpb4fa9243yiv0406576422yqt6806569319" id="m_2989811908904530576ydpb4fa9243yiv0406576422yqtfd48578">
        </div></div></div></div></div></div>
            </div></div></div>
        </div></div></div><br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>