<div dir="ltr"><div><div><div>Looking at a plot at each time step, the source data are likely satellite swath data.  (Most commonly,  satellite swath data are archived as HDF or HDF-EOS.)   I am not sure who/how the data were subsetted onto a consistent 1200x1200 grid.<br><br></div><div>True, if the latitudinal range were large and, especially, if data were 'near' the poles, an arithmetic average would not be appropriate. However, the entire latitudinal range (1200 points) spans 22N to ~35N and the region of interest spans an even smaller latitudinal range. Hence, an arithmetic aberage may well be 'close enough.' If not, a simple weighting could be used.<br></div><div><br></div>If a user were to look at all 7 time steps collectively (one data object) the results may well be different than looking at each time step. <br><br></div>For illustration, using MH's script, I generated the attached png files.<br><br></div>Cheers<br><div><div><br><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 27, 2017 at 11:04 AM, Mary Haley <span dir="ltr"><<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.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"><div class="gmail_default" style="font-size:small">Adrian,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Thanks for the information regarding CDO.  FTR, this particular file in question is actually not a WRF file, but rather an HDF-EOS file (I believe).  It is on a curvilinear grid, however, so hopefully CDO can handle this correctly.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">You're right that this kind of subsetting is not correct. I don't know if you followed the whole thread, but either in an earlier message or a separate message we were trying to point out that subsetting a lat/lon area can be done in different ways, depending on what you are trying to do. </div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">From the script I just included, I was trying to visually show what it means to select two corners of a lat/lon box, when you are dealing with a curvilinear grid.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">We also pointed to this example, which illustrates three kinds of subsetting in a graphical fashion:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"><a href="http://www.ncl.ucar.edu/Applications/latlon_subset.shtml#ex10" target="_blank">http://www.ncl.ucar.edu/<wbr>Applications/latlon_subset.<wbr>shtml#ex10</a><br></div><div class="gmail_default"><a href="http://www.ncl.ucar.edu/Applications/Images/wrf_gsn_10_lg.png" target="_blank">http://www.ncl.ucar.edu/<wbr>Applications/Images/wrf_gsn_<wbr>10_lg.png</a><br></div><div class="gmail_default"><br></div><div class="gmail_default">As we are trying to point out, selecting a lat/lon box can have very different meaning, depending on what you are trying to accomplish, and it is up to the user to understand what they want. There's also the concept of passing a lat/lon polygon of any shape, and using gc_inout to do the subsetting.</div><div class="gmail_default"><br></div><div class="gmail_default">When CDO does the subsetting of a curvilinear grid, what exactly is it selecting? Is there a graphical illustration of what it's doing?</div><div class="gmail_default"><br></div><div class="gmail_default">And you are correct there are special situations as you get closer to the poles, but in this particular case it wasn't clear if the poles were going to be an issue.</div><span class="HOEnZb"><font color="#888888"><div class="gmail_default"><br></div><div class="gmail_default">--Mary</div></font></span><div><div class="h5"><div class="gmail_default"><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 27, 2017 at 1:57 AM, Adrian Tompkins <span dir="ltr"><<a href="mailto:tompkins@ictp.it" target="_blank">tompkins@ictp.it</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">dear all,<br>
<br>
Sorry to push my nose in here, but I just noticed this discussion chain<br>
and the advice to average over a set of points using the "avg" function.<br>
 Mary also suggested early to do this with the following piece of code :<br>
<span><br>
  lats = (/ min_lat, max_lat /)<br>
  lons = (/ min_lon, max_lon /)<br>
  nm   = getind_latlon2d (lat2d, lon2d, lats, lons)<br>
  ilt1 = nm(0,0)  ; start lat index<br>
  ilt2 = nm(1,0)  ; start lon index<br>
  iln1 = nm(0,1)  ; end lat index<br>
  iln2 = nm(1,1)  ; end lon index<br>
  var_subset = var(ilt1:ilt2,iln1:iln2)<br>
  var_subset_avg = avg(var_subset)<br>
<br>
</span>I just wanted to point out that it is not correct to do this unless you<br>
have a small area Cartesian grid with regular spacing.  If WRF is being<br>
used with a lat-lon grid of any kind you need to take account of the<br>
differing grid sizes as you move towards the poles.  For Kunal's chosen<br>
area this wouldn't matter as the region desired is very small, but for<br>
larger regions this is important.<br>
<br>
Kunal, to be honest I generally do this kind of operation outside of NCL<br>
with CDO and then use NCL to make the plots as then you don't need to<br>
worry about the grid.<br>
<br>
For example to extract an area and then average it as you ask to do, you<br>
could simple do this from the command line:<br>
<br>
cdo fldmean -sellonlatbox,lon1,lon2,lat1,l<wbr>at2 <a href="http://infile.nc" rel="noreferrer" target="_blank">infile.nc</a> <a href="http://outfile.nc" rel="noreferrer" target="_blank">outfile.nc</a><br>
<br>
where the lon and lat describe the corners of the box you want to<br>
select.  Then move to NCL to make the plots...<br>
<br>
best wishes, Adrian<br>
<span><br>
<br>
<br>
<br>
On 10/25/17 12:16, Barry Lynn wrote:<br>
> Kunal:<br>
><br>
> Why don't you extract the grid elements you want and then use the NCL<br>
> average function to find the mean of those grid points?  You can extract<br>
> a grid of the size you want or just the points.<br>
><br>
> Barry<br>
><br>
> On Wed, Oct 25, 2017 at 10:07 AM, Kunal Bali <<a href="mailto:kunal.bali9@gmail.com" target="_blank">kunal.bali9@gmail.com</a><br>
</span><span>> <mailto:<a href="mailto:kunal.bali9@gmail.com" target="_blank">kunal.bali9@gmail.com</a>><wbr>> wrote:<br>
><br>
>     Thanks for the information. I did not include the time variable. So<br>
><br>
>     I changed aot_subset(ilt1:ilt2,iln1:iln2<wbr>) =<br>
</span>>     data(ilt1:ilt2,iln1:iln2) to aot_subset(*:,*ilt1:ilt2,iln1:<wbr>iln2) =<br>
>     data(*:,*ilt1:ilt2,iln1:iln2)<br>
<div><div class="m_7192637201731760756h5">><br>
>     AND it worked.<br>
><br>
><br>
>     But from the given script, I am not getting the mean value of the<br>
>     grid box. It producing the values of every grid separately. As given<br>
>     below<br>
><br>
>     (0)    22.17971308103524   69.17124237598317<br>
>     (0)         -28672<br>
>     (1)         0.208<br>
>     (0)    -----<br>
>     (0)    24.55800304046942   79.47472902537179<br>
>     (0)         -28672<br>
>     (1)         -28672<br>
>     (0)    -----<br>
><br>
><br>
>     I need to extract the data of square box and mean it. so that I can<br>
>     get the values with every time steps.<br>
><br>
>       latv = (/ 13, 25/)     ; for extracting grid box data<br>
>       lonv = (/ 72, 85 /)<br>
><br>
>     The script is<br>
><br>
><br>
>     ;----------------------------<wbr>------------------------------<wbr>------------<br>
>     ; Main code<br>
>     ;----------------------------<wbr>------------------------------<wbr>------------<br>
>       dir    = "./"<br>
>       fnames = systemfunc("ls " + dir + "maiactaot*.nc")<br>
>       print(fnames)<br>
>       a      = addfile(fnames,"r")<br>
>       data   = short2flt(a->Optical_Depth_055<wbr>_grid1km)<br>
>     printVarSummary (data)<br>
>     printMinMax (data, 0)<br>
>     print("-----")<br>
>       nFill  = num(ismissing(data))<br>
>     print("nFill="+nFill)<br>
>     print("-----")<br>
><br>
>       lat2d  = a->GridLat_grid1km<br>
>       lon2d  = a->GridLon_grid1km<br>
>     printMinMax (lat2d, 0)<br>
>     printMinMax (lon2d, 0)<br>
>     print("-----")<br>
><br>
>     ;---grid points of interest<br>
>     ;---<a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/getind_latlon2d.shtml" rel="noreferrer" target="_blank">http://www.ncl.ucar.edu/D<wbr>ocument/Functions/Contributed/<wbr>getind_latlon2d.shtml</a><br>
>     <<a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/getind_latlon2d.shtml" rel="noreferrer" target="_blank">http://www.ncl.ucar.edu/Docu<wbr>ment/Functions/Contributed/<wbr>getind_latlon2d.shtml</a>><br>
>      ; latv = (/22, 24.0, 24.0, 22.0, 22.0/)<br>
>      ; lonv = (/76, 76.0, 78.0, 78.0, 76.0/)<br>
><br>
>       latv = (/ 13, 25/)     ; for extracting grid box data<br>
>       lonv = (/ 72, 85 /)<br>
>       nm   = getind_latlon2d (lat2d, lon2d, latv, lonv)<br>
>       ilt1 = nm(0,0)  ; start lat index<br>
>       ilt2 = nm(1,0)  ; start lon index<br>
>       iln1 = nm(0,1)  ; end lat index<br>
>       iln2 = nm(1,1)  ; end lon index<br>
>       lat_subset = lat2d(ilt1:ilt2,iln1:iln2)<br>
>       lon_subset = lon2d(ilt1:ilt2,iln1:iln2)<br>
>       aot_subset := data<br>
>       aot_subset = aot_subset@_FillValue<br>
>       aot_subset(:,ilt1:ilt2,iln1:il<wbr>n2) = data(:,ilt1:ilt2,iln1:iln2)<br>
>      <br>
>      <br>
>      <br>
>       printVarSummary(aot_subset)<br>
>       print("ilt1 = " + ilt1)<br>
>       print("ilt2 = " + ilt2)<br>
>       print("iln1 = " + iln1)<br>
>       print("iln2 = " + iln2)<br>
>      <br>
>      ; aot_avg = avg(data)<br>
>       aot_subset_avg = avg(data)<br>
>      <br>
>       ;print(nm)<br>
>       print("-----")<br>
><br>
>       do k=0,dimsizes(latv)-1<br>
>          n = nm(k,0)<br>
>          m = nm(k,1)<br>
>          print(lat2d(n,m)+"   "+lon2d(n,m)) <br>
>          print("     "+data(:,n,m))                <wbr>   ; nearest grid<br>
>     point at all time steps<br>
>          print("-----")<br>
>       end do<br>
><br>
>      <br>
><br>
><br>
><br>
><br>
>     Kunal Bali<br>
><br>
><br>
><br>
><br>
><br>
>     On Wed, Oct 25, 2017 at 12:25 PM, Barry Lynn <<a href="mailto:barry.h.lynn@gmail.com" target="_blank">barry.h.lynn@gmail.com</a><br>
</div></div><span>>     <mailto:<a href="mailto:barry.h.lynn@gmail.com" target="_blank">barry.h.lynn@gmail.<wbr>com</a>>> wrote:<br>
><br>
>         Kunal:<br>
><br>
>         The error message says that you have used three subscripts on a<br>
>         variables with only two dimensions.<br>
><br>
>         You need to fix this error for your script to proceed to the<br>
>         next step.<br>
><br>
>         Barry<br>
><br>
>         On Wed, Oct 25, 2017 at 8:59 AM, Kunal Bali<br>
</span><span>>         <<a href="mailto:kunal.bali9@gmail.com" target="_blank">kunal.bali9@gmail.com</a> <mailto:<a href="mailto:kunal.bali9@gmail.com" target="_blank">kunal.bali9@gmail.com</a>><wbr>> wrote:<br>
><br>
>             It also shows an error if I replaced := with = in 38 line of<br>
>             the given script (attached earlier), even though variable is<br>
>             in 2D array.<br>
><br>
>             fatal:["Execute.c":7950]:Numb<wbr>er of subscripts on<br>
>             right-hand-side do not match<br>
>                         number of dimensions of variable: (2),<br>
>             Subscripts used: (3)<br>
><br>
>             fatal:["Execute.c":8640]:Exec<wbr>ute: Error occurred at or near<br>
>             line 38 in file extract1.ncl<br>
><br>
><br>
><br>
>             Kunal Bali<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
>             On Tue, Oct 24, 2017 at 4:46 PM, Helen Macintyre<br>
>             <<a href="mailto:Helen.Macintyre@phe.gov.uk" target="_blank">Helen.Macintyre@phe.gov.uk</a><br>
</span><span>>             <mailto:<a href="mailto:Helen.Macintyre@phe.gov.uk" target="_blank">Helen.Macintyre@phe.g<wbr>ov.uk</a>>> wrote:<br>
><br>
>                 You are trying to delete a variable that has not been<br>
</span>>                 assigned.____<br>
><br>
>                 __ __<br>
<span>><br>
>                 Using “:=” tries to delete aot_subset when it doesn’t<br>
</span>>                 exist yet. ____<br>
><br>
>                 __ __<br>
><br>
>                 More info here:____<br>
><br>
>                 <a href="http://www.ncl.ucar.edu/Document/Language/varb_assign.shtml" rel="noreferrer" target="_blank">http://www.ncl.ucar.edu/Docum<wbr>ent/Language/varb_assign.shtml</a><br>
>                 <<a href="http://www.ncl.ucar.edu/Document/Language/varb_assign.shtml" rel="noreferrer" target="_blank">http://www.ncl.ucar.edu/Docu<wbr>ment/Language/varb_assign.shtm<wbr>l</a>>____<br>
><br>
>                 __ __<br>
><br>
>                 __ __<br>
><br>
>                 __ __<br>
><br>
>                 *From:*ncl-talk [mailto:<a href="mailto:ncl-talk-bounces@ucar.edu" target="_blank">ncl-talk-bounces@ucar.<wbr>edu</a><br>
>                 <mailto:<a href="mailto:ncl-talk-bounces@ucar.edu" target="_blank">ncl-talk-bounces@<wbr>ucar.edu</a>>] *On Behalf Of *Kunal<br>
>                 Bali<br>
>                 *Sent:* 24 October 2017 06:28<br>
>                 *To:* <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a> <mailto:<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>><br>
>                 *Subject:* Re: [ncl-talk] grid_area_avg____<br>
><br>
>                 __ __<br>
<span>><br>
>                 I am not able to sort out the query regarding<br>
><br>
>                 fatal:Variable (aot_subset) is undefined<br>
>                 fatal:["Execute.c":8640]:Exec<wbr>ute: Error occurred at or<br>
</span>>                 near line 38 in file extract1.ncl____<br>
<span>><br>
>                 I have attached my script. please let me know how to<br>
>                 solve it (the file regarding this script is attached in<br>
</span>>                 the previous mail). ____<br>
><br>
>                 __ __<br>
><br>
>                 sorry for the inconvenience/. /____<br>
><br>
>                 __ __<br>
><br>
>                 __ __<br>
><br>
>                 regards<br>
>                 ____<br>
><br>
>                 Kunal Bali____<br>
><br>
>                 __ __<br>
><br>
>                 __ __<br>
><br>
>                 __ __<br>
><br>
>                 __ __<br>
<span>><br>
>                 On Sat, Oct 21, 2017 at 1:53 PM, Kunal Bali<br>
</span>>                 <<a href="mailto:kunal.bali9@gmail.com" target="_blank">kunal.bali9@gmail.com</a> <mailto:<a href="mailto:kunal.bali9@gmail.com" target="_blank">kunal.bali9@gmail.com</a>><wbr>><br>
>                 wrote:____<br>
<span>><br>
>                 thanks for providing this information. I am positive<br>
>                 that the given variable in the data is a 2D array and<br>
</span>>                 the error is coming on 38 line as I mentioned earlier. ____<br>
<span>><br>
>                 I am trying to debug this problem accordingly as you<br>
</span>>                 mentioned. ____<br>
<span>><br>
>                 However, I have attached the data (size =30mb, tried via<br>
>                 ftp but facing some error while uploading) and the full<br>
</span>>                 script for extracting the grid box mean value.  ____<br>
><br>
>                 __ __<br>
><br>
>                 Thank You for all the support.  ____<br>
><br>
>                 ​____<br>
><br>
>                 * maiactaot.h00v02.2001004063<wbr>5-20011550640.nc.bz2<br>
>                 <<a href="https://drive.google.com/file/d/0B6MS-JLMHECwaVh3QVVHUU1Wazg/view?usp=drive_web" rel="noreferrer" target="_blank">https://drive.google.com/fil<wbr>e/d/0B6MS-JLMHECwaVh3QVVHUU1Wa<wbr>zg/view?usp=drive_web</a>>____*<br>
><br>
>                 ​____<br>
><br>
><br>
>                 ____<br>
><br>
>                 Kunal Bali____<br>
><br>
>                 __ __<br>
><br>
>                 __ __<br>
><br>
>                 __ __<br>
><br>
>                 __ __<br>
><br>
>                 __ __<br>
<span>><br>
>                 On Fri, Oct 20, 2017 at 9:14 PM, Mary Haley<br>
</span>>                 <<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a> <mailto:<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>>> wrote:____<br>
><br>
>                 Kunal,____<br>
><br>
>                 __ __<br>
<span>><br>
>                 Multiple people have tried to help you, but you continue<br>
>                 to post error messages without trying to debug them<br>
>                 yourself. If you don't make an effort, people are likely<br>
>                 to stop trying to help. You are including code snippets,<br>
>                 but this is not always enough for us to help you debug<br>
>                 the problem. You need to include full scripts, output<br>
>                 from print/printVarSummary commands, AND all error<br>
</span>>                 messages.____<br>
><br>
>                 __ __<br>
><br>
>                 For example, you originally included this code:____<br>
><br>
>                 __ __<br>
><br>
>                   latv = (/ 18, 24/)     ; for extracting grid box data ____<br>
><br>
>                   lonv = (/ 74, 78 /)____<br>
><br>
>                   nm   = getind_latlon2d (lat2d, lon2d, latv, lonv)____<br>
><br>
>                   ilt1 = nm(0,0)  ; start lat index____<br>
><br>
>                   ilt2 = nm(1,0)  ; start lon index____<br>
><br>
>                   iln1 = nm(0,1)  ; end lat index____<br>
><br>
>                   iln2 = nm(1,1)  ; end lon index____<br>
><br>
>                   lat_subset  := lat2d(ilt1:ilt2,iln1:iln2)____<br>
><br>
>                   lon_subset := lon2d(ilt1:ilt2,iln1:iln2)____<br>
><br>
>                   aot_subset := data____<br>
<span>><br>
>                   aot_subset(ilt1:ilt2,iln1:iln2<wbr>) := data(ilt1:ilt2,<br>
</span>>                 iln1:iln2)____<br>
><br>
>                   ____<br>
><br>
>                   ;printVarSummary(aot_subset)__<wbr>__<br>
><br>
>                   aot_avg = avg(data)____<br>
><br>
>                   aot_subset_avg = avg(aot_subset)____<br>
><br>
>                 __ __<br>
<span>><br>
>                 and then said that you were getting an error about<br>
>                 aot_subset being undefined. From the perspective of<br>
>                 somebody who is just looking at the code snippet above<br>
>                 and doesn't have access to your full script, we are<br>
</span>>                 going to wonder about this line:____<br>
><br>
>                 __ __<br>
><br>
>                   aot_subset := data____<br>
><br>
>                 __ __<br>
<span>><br>
>                 Since this appears to be the first time aot_subset is<br>
>                 set, our next question is going to be "is data defined"?<br>
>                 In the code snippet you included, we don't see where<br>
>                 "data" is defined, so we have no way to help. This is<br>
</span>>                 where a "printVarSummary(data)" line would have helped.____<br>
><br>
>                 __ __<br>
<span>><br>
>                 In your last email, in which you did include some<br>
>                 information about "data", things are still not making<br>
>                 any sense. You said you were subsetting data as a 2D<br>
</span>>                 array with:____<br>
><br>
>                 __ __<br>
><br>
>                 aot_subset(ilt1:ilt2,iln1:iln<wbr>2) =<br>
>                 data(ilt1:ilt2,iln1:iln2)____<br>
><br>
>                 __ __<br>
><br>
>                 which you said was causing this error:____<br>
><br>
>                 __ __<br>
<span>><br>
>                 fatal:["Execute.c":7950]:Numb<wbr>er of subscripts on<br>
</span>>                 right-hand-side do not match____<br>
<span>><br>
>                             number of dimensions of variable: (2),<br>
</span>>                 Subscripts used: (3)____<br>
><br>
>                 __ __<br>
<span>><br>
>                 This error doesn't seem possible, because it's saying<br>
>                 that you are using 3 subscripts, but the line only has 2<br>
>                 subscripts being used in both arrays. Are you positive<br>
</span>>                 that this error is coming from this line?____<br>
><br>
>                 __ __<br>
><br>
>                 I have to ask you again to please include your *full<br>
>                 script* next time and *all error messages* and *all<br>
>                 printed output*, so people can see exactly what line<br>
<span>>                 numbers in your script the errors correspond with and<br>
>                 what your data looks like. But don't do this until you<br>
>                 have shown that you tried to debug the problem yourself.<br>
>                 Use "print" and "printVarSummary" *before* the locations<br>
>                 where the error messages are occurring, so you can see<br>
</span>>                 what might be causing the error.____<br>
><br>
>                 __ __<br>
><br>
>                 For example, if the error says ____<br>
><br>
>                 __ __<br>
<span>><br>
>                  number of dimensions of variable: (2), Subscripts used:<br>
</span>>                 (3)____<br>
><br>
>                 __ __<br>
<span>><br>
>                 then this means you are subscripting a variable as if it<br>
>                 were a 2D array, when it is actually a 3D array. Add<br>
</span>>                 *printVarSummary* statements on ALL subscripted<br>
<span>>                 variables that occur in that line, so you can be sure<br>
>                 you are doing things correctly.  For example, if the<br>
</span>>                 error occurs on this line:____<br>
><br>
>                 __ __<br>
<span>><br>
>                   aot_subset(ilt1:ilt2,iln1:iln2<wbr>) := data(ilt1:ilt2,<br>
</span>>                 iln1:iln2)____<br>
><br>
>                 __ __<br>
><br>
>                 then do this:____<br>
><br>
><br>
>                   printVarSummary(data)____<br>
><br>
>                   printVarSummary(aot_subset)___<wbr>_<br>
<span>><br>
>                   aot_subset(ilt1:ilt2,iln1:iln2<wbr>) := data(ilt1:ilt2,<br>
</span>>                 iln1:iln2)____<br>
><br>
>                 __ __<br>
><br>
>                 It may also help to print the il* variables:____<br>
><br>
>                 __ __<br>
><br>
>                   printVarSummary(data)____<br>
><br>
>                   printVarSummary(aot_subset)___<wbr>_<br>
><br>
>                   print("ilt1 = " + ilt1)____<br>
><br>
>                   print("ilt2 = " + ilt2)____<br>
><br>
>                   print("iln1 = " + iln1)____<br>
><br>
>                   print("iln2 = " + iln2)____<br>
<span>><br>
>                   aot_subset(ilt1:ilt2,iln1:iln2<wbr>) := data(ilt1:ilt2,<br>
</span>>                 iln1:iln2)____<br>
><br>
>                 __ __<br>
><br>
>                 __ __<br>
<span>><br>
>                 Moving forward, you *must* show that you are making some<br>
</span>>                 effort to debug your problem.____<br>
><br>
>                 __ __<br>
><br>
>                 Thank you for your consideration.____<br>
><br>
>                 __ __<br>
><br>
>                 --Mary____<br>
><br>
>                 __ __<br>
><br>
>                 __ __<br>
><br>
>                 __ __<br>
<span>><br>
>                 On Wed, Oct 18, 2017 at 12:23 AM, Kunal Bali<br>
</span>>                 <<a href="mailto:kunal.bali9@gmail.com" target="_blank">kunal.bali9@gmail.com</a> <mailto:<a href="mailto:kunal.bali9@gmail.com" target="_blank">kunal.bali9@gmail.com</a>><wbr>><br>
>                 wrote:____<br>
<span>><br>
>                 printVarSummary(aot_subset), shows that aot_subset is<br>
</span>>                 undefined, which I am unable to fix this problem yet.____<br>
><br>
>                 If I used aot_subset(ilt1:ilt2,iln1:iln2<wbr>) *=*<br>
>                 data(ilt1:ilt2,iln1:iln2) *instead of<br>
>                 *aot_subset(ilt1:ilt2,iln1:il<wbr>n2)*:=***data(ilt1:ilt2,iln1:<wbr>iln2)____<br>
<span>><br>
><br>
>                 then the error appeared as<br>
><br>
</span>>                 *fatal:["Execute.c":7950]:Num<wbr>ber of subscripts on<br>
<span>>                 right-hand-side do not match<br>
>                             number of dimensions of variable: (2),<br>
</span>>                 Subscripts used: (3)*____<br>
<span>><br>
>                 basically, the data summary is<br>
><br>
>                 Variable: fnames<br>
>                 Type: string<br>
>                 Total Size: 8 bytes<br>
>                             1 values<br>
>                 Number of Dimensions: 1<br>
>                 Dimensions and sizes:    [1]<br>
>                 Coordinates:<br>
>                 (0)    ./<a href="http://maiactaotE.h00v03.20000550525-20003660700.nc" rel="noreferrer" target="_blank">maiactaotE.h00v03.2000055052<wbr>5-20003660700.nc</a><br>
</span>>                 <<a href="http://maiactaotE.h00v03.20000550525-20003660700.nc" rel="noreferrer" target="_blank">http://maiactaotE.h00v03.200<wbr>00550525-20003660700.nc</a>><br>
><br>
>                 Variable: data<br>
>                 Type: float<br>
>                 Total Size: <a href="tel:2545920000" value="+12545920000" target="_blank">2545920000</a> <tel:(254)%20592-0000> bytes<br>
<span>>                             636480000 values<br>
>                 Number of Dimensions: 3<br>
</span>>                 Dimensions and sizes:    *[time | 442] x [YDim_grid1km |<br>
>                 1200] x [XDim_grid1km | 1200]*<br>
<span>>                 Coordinates:<br>
>                             time: [1301.416666666686..8767]<br>
>                 Number Of Attributes: 8<br>
>                   coordinates :    GridLat_grid1km, GridLon_grid1km<br>
>                   hdfeos_name :    Optical_Depth_055<br>
>                   projection :    Albers Conical Equal_Area<br>
>                   unit :    None<br>
>                   long_name :    AOT at 0.55 micron<br>
>                   _FillValue_original :    -28672<br>
>                   _FillValue :    -28672<br>
>                   valid_range :    ( -0.1,  5 )<br>
>                 (0)    latitude (degrees_north) : min=11.2940312768897  <br>
>                 max=24.54921980985786<br>
>                 (0)    longitude (degrees_east) :<br>
>                 min=68.08003670367275   max=81.63171349927691<br>
</span>>                 *fatal:["Execute.c":7776]:<wbr>aot_subset is undefined, can<br>
<span>>                 not subscript an undefined variable<br>
>                 fatal:["Execute.c":8640]:Exec<wbr>ute: Error occurred at or<br>
</span>>                 near line 38 in file test_extract.ncl*____<br>
><br>
>                 *38 line is *<br>
>                 *aot_subset(ilt1:ilt2,iln1:il<wbr>n2) =<br>
>                 data(ilt1:ilt2,iln1:iln2)*___<wbr>_<br>
><br>
>                 *fatal:Variable (aot_subset) is undefined*____<br>
><br>
>                 __ __<br>
><br>
>                 __ __<br>
><br>
>                 __ __<br>
><br>
>                 __ __<br>
><br>
>                 __ __<br>
><br>
>                 __ __<br>
><br>
>                 regards<br>
>                 ____<br>
><br>
>                 Kunal Bali____<br>
><br>
>                 __ __<br>
><br>
>                 __ __<br>
><br>
>                 __ __<br>
><br>
>                 __ __<br>
><br>
>                 __ __<br>
<span>><br>
>                 On Tue, Oct 17, 2017 at 3:05 PM, Guido Cioni<br>
</span>>                 <<a href="mailto:guidocioni@gmail.com" target="_blank">guidocioni@gmail.com</a> <mailto:<a href="mailto:guidocioni@gmail.com" target="_blank">guidocioni@gmail.com</a>>><br>
>                 wrote:____<br>
><br>
>                 Why did you comment this line ?____<br>
><br>
>                 __ __<br>
><br>
>                       ;printVarSummary(aot_subset)__<wbr>__<br>
><br>
>                 __ __<br>
<span>><br>
>                 That would have helped you in debugging the error on<br>
</span>>                 your own.____<br>
><br>
>                 __ __<br>
<span>><br>
>                 You are using the re-assignment operator ":=". This<br>
>                 means that every time you make an assignment the<br>
>                 variable is created again. Thus, you cannot make this<br>
</span>>                 assignment ____<br>
><br>
>                 __ __<br>
><br>
>                      * aot_subset(ilt1:ilt2,iln1:<wbr>iln2) :=<br>
>                     data(ilt1:ilt2, iln1:iln2)*____<br>
><br>
>                 __ __<br>
<span>><br>
>                 as NCL has no way to know the shape of aot_subset<br>
</span>>                 beforehand. ____<br>
><br>
>                 __ __<br>
<span>><br>
>                 The following should be used instead (notice the<br>
</span>>                 assignment with "=" in the second line).____<br>
><br>
>                 __ __<br>
><br>
>                   aot_subset := data____<br>
><br>
>                   aot_subset = aot_subset@_FillValue<br>
>                   aot_subset(ilt1:ilt2,iln1:i<wbr>ln2) *=* data(ilt1:ilt2,<br>
>                 iln1:iln2)____<br>
><br>
>                 __ __<br>
<span>><br>
>                 Notice that this will (1) create an array which is<br>
>                 shaped like data (2) fill it with fill values as you<br>
>                 only want to compute the average over the subset (3)<br>
>                 populate the array only in the lat-lon box provided.<br>
>                 However I don't see why you would want to use such a<br>
>                 complicated syntax when the following code would produce<br>
</span>>                 the same result____<br>
><br>
>                 __ __<br>
><br>
>                 aot_subset_avg=avg(data(ilt1:<wbr>ilt2, iln1:iln2))____<br>
><br>
>                 __ __<br>
<span>><br>
>                 If you have the right coordinate attributes you can even<br>
</span>>                 jump the first 7 lines and do ____<br>
><br>
>                 __ __<br>
><br>
>                 aot_subset_avg=avg(data({18:2<wbr>4},{74:78})____<br>
><br>
>                 __ __<br>
><br>
>                 but I don't know your data. ____<br>
><br>
>                 __ __<br>
<span>><br>
>                 As it was already suggested by Mary and others, PLEASE<br>
</span>>                 take time to debug the errors on your own. ____<br>
><br>
>                 __ __<br>
><br>
>                 Regards,____<br>
><br>
>                 __ __<br>
<span>><br>
>                     On 17. Oct 2017, at 11:25, Kunal Bali<br>
>                     <<a href="mailto:kunal.bali9@gmail.com" target="_blank">kunal.bali9@gmail.com</a><br>
</span>>                     <mailto:<a href="mailto:kunal.bali9@gmail.com" target="_blank">kunal.bali9@gmail.com</a><wbr>>> wrote:____<br>
><br>
>                     __ __<br>
><br>
>                     __ __<br>
<span>><br>
>                     I did the following changes but still getting an<br>
</span>>                     error of *aot_subset* which is undefined. ____<br>
<span>><br>
>                     please let me know that how to fix or defined the<br>
</span>>                     *aot_subset *this problem.____<br>
<span>><br>
><br>
><br>
><br>
>                       latv = (/ 18, 24/)     ; for extracting grid box data<br>
>                       lonv = (/ 74, 78 /)<br>
>                       nm   = getind_latlon2d (lat2d, lon2d, latv, lonv)<br>
>                       ilt1 = nm(0,0)  ; start lat index<br>
>                       ilt2 = nm(1,0)  ; start lon index<br>
>                       iln1 = nm(0,1)  ; end lat index<br>
>                       iln2 = nm(1,1)  ; end lon index<br>
>                       lat_subset  := lat2d(ilt1:ilt2,iln1:iln2)<br>
>                       lon_subset := lon2d(ilt1:ilt2,iln1:iln2)<br>
>                       aot_subset := data<br>
</span>>                      *aot_subset(ilt1:ilt2,iln1:i<wbr>ln2) := data(ilt1:ilt2,<br>
>                     iln1:iln2)*<br>
>                      <br>
>                       ;printVarSummary(aot_subset)<br>
>                       aot_avg = avg(data)<br>
>                       aot_subset_avg = avg(*aot_subset*)<br>
<span>>                      <br>
>                       ;print(nm)<br>
>                       print("-----")<br>
><br>
>                       do k=0,dimsizes(latv)-1<br>
>                          n = nm(k,0)<br>
>                          m = nm(k,1)<br>
>                          print(lat2d(n,m)+"   "+lon2d(n,m)) <br>
>                          print("     "+data(:,n,m))                <wbr>   ;<br>
>                     nearest grid point at all time steps<br>
>                          print("-----")<br>
>                       end do<br>
><br>
><br>
</span>>                     ____<br>
><br>
>                     __ __<br>
><br>
>                     regards<br>
>                     ____<br>
><br>
>                     Kunal Bali____<br>
><br>
>                     __ __<br>
><br>
>                     __ __<br>
><br>
>                     __ __<br>
><br>
>                     __ __<br>
><br>
>                     __ __<br>
><br>
>                     __ __<br>
<span>><br>
>                     On Tue, Oct 17, 2017 at 12:41 PM, Kunal Bali<br>
>                     <<a href="mailto:kunal.bali9@gmail.com" target="_blank">kunal.bali9@gmail.com</a><br>
</span>>                     <mailto:<a href="mailto:kunal.bali9@gmail.com" target="_blank">kunal.bali9@gmail.com</a><wbr>>> wrote:____<br>
<span>><br>
>                     I have sent the ncl script and data to the incoming<br>
>                     dir with the given names as<br>
><br>
>                     data =<br>
</span>>                     maiactaotE.h00v03.<wbr><a href="http://20003660525-20003660700.nc">20003660525-20003660700.nc</a>.<wbr>bz2____<br>
><br>
>                     ncl_script = extract_iiserb.ncl____<br>
><br>
>                     __ __<br>
<span>><br>
>                     I am not able to define the var_subset in the given<br>
</span>>                     script.  ____<br>
<span>><br>
>                     please let me know if you have received the data and<br>
>                     script?<br>
><br>
</span>>                     ____<br>
><br>
>                     __ __<br>
><br>
><br>
>                     ____<br>
><br>
>                     Kunal Bali____<br>
><br>
>                     __ __<br>
><br>
>                     __ __<br>
><br>
>                     __ __<br>
><br>
>                     __ __<br>
><br>
>                     __ __<br>
><br>
>                     __ __<br>
<span>><br>
>                     On Mon, Oct 16, 2017 at 11:07 PM, Mary Haley<br>
</span>>                     <<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a> <mailto:<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>>> wrote:____<br>
><br>
>                     Kunal,____<br>
><br>
>                     __ __<br>
<span>><br>
>                     You must make an effort to debug some of these<br>
>                     problems on your own. The error is telling you that<br>
>                     something is wrong around line 34 and it is telling<br>
>                     you exactly what the problem is. Please try to fix<br>
</span>>                     this error.____<br>
><br>
>                     __ __<br>
<span>><br>
>                     If you continue to have problems after fixing this<br>
>                     error, then I need to ask you to provide the full<br>
</span>>                     script and data via ftp:____<br>
><br>
>                     __ __<br>
><br>
>                     <a href="http://www.ncl.ucar.edu/ftp_files.shtml" rel="noreferrer" target="_blank">http://www.ncl.ucar.edu/ftp_f<wbr>iles.shtml</a><br>
>                     <<a href="http://www.ncl.ucar.edu/ftp_files.shtml" rel="noreferrer" target="_blank">http://www.ncl.ucar.edu/ftp_<wbr>files.shtml</a>>____<br>
><br>
>                     __ __<br>
<span>><br>
>                     However, make sure you debug any other new problems<br>
>                     that come up, instead of just emailing them to<br>
>                     ncl-talk.  We have a page to help you understand<br>
</span>>                     some of NCL's errors, and what causes them:____<br>
><br>
>                     __ __<br>
><br>
>                     <a href="http://www.ncl.ucar.edu/Document/Language/error_messages.shtml" rel="noreferrer" target="_blank">http://www.ncl.ucar.edu/Docum<wbr>ent/Language/error_messages.<wbr>shtml</a><br>
>                     <<a href="http://www.ncl.ucar.edu/Document/Language/error_messages.shtml" rel="noreferrer" target="_blank">http://www.ncl.ucar.edu/Docu<wbr>ment/Language/error_messages.<wbr>shtml</a>>____<br>
><br>
>                     __ __<br>
<span>><br>
>                     The particular error you're seeing can be found<br>
</span>>                     here:____<br>
><br>
>                     __ __<br>
><br>
>                     <a href="http://www.ncl.ucar.edu/Document/Language/error_messages.shtml#NumSubRHS" rel="noreferrer" target="_blank">http://www.ncl.ucar.edu/Docum<wbr>ent/Language/error_messages.<wbr>shtml#NumSubRHS</a><br>
>                     <<a href="http://www.ncl.ucar.edu/Document/Language/error_messages.shtml#NumSubRHS" rel="noreferrer" target="_blank">http://www.ncl.ucar.edu/Docu<wbr>ment/Language/error_messages.<wbr>shtml#NumSubRHS</a>>____<br>
><br>
>                     __ __<br>
<span>><br>
>                     As a side note, you are running a 3-year old version<br>
</span>>                     of NCL. I suggest that you upgrade to NCL V6.4.0.____<br>
><br>
>                     __ __<br>
><br>
>                     --Mary____<br>
><br>
>                     __ __<br>
><br>
>                     __ __<br>
><br>
>                     __ __<br>
<span>><br>
>                     On Mon, Oct 16, 2017 at 12:52 AM, Kunal Bali<br>
>                     <<a href="mailto:kunal.bali9@gmail.com" target="_blank">kunal.bali9@gmail.com</a><br>
</span>>                     <mailto:<a href="mailto:kunal.bali9@gmail.com" target="_blank">kunal.bali9@gmail.com</a><wbr>>> wrote:____<br>
<span>><br>
>                     I simply include the code (which you mentioned) were<br>
>                     I was taking the avg of the data as given below<br>
>                     (please correct me if I did wrong)<br>
><br>
><br>
>                     ;----------------------------<wbr>------------------------------<wbr>------------<br>
>                     ; Main code<br>
>                     ;----------------------------<wbr>------------------------------<wbr>------------<br>
>                       dir    = "./"<br>
>                       fnames = systemfunc("ls " + dir + "maiactaot*.nc")<br>
>                     print(fnames)<br>
>                       a      = addfile(fnames,"r")<br>
>                       data   = short2flt(a->Optical_Depth_055<wbr>_grid1km)<br>
>                     printVarSummary (data)<br>
>                     printMinMax (data, 0)<br>
>                     print("-----")<br>
>                       nFill  = num(ismissing(data))<br>
>                     print("nFill="+nFill)<br>
>                     print("-----")<br>
><br>
>                       lat2d  = a->GridLat_grid1km<br>
>                       lon2d  = a->GridLon_grid1km<br>
>                     printMinMax (lat2d, 0)<br>
>                     printMinMax (lon2d, 0)<br>
>                     print("-----")<br>
><br>
>                     ;---grid points of interest<br>
>                     ;---<a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/getind_latlon2d.shtml" rel="noreferrer" target="_blank">http://www.ncl.ucar.edu/D<wbr>ocument/Functions/Contributed/<wbr>getind_latlon2d.shtml</a><br>
</span><span>>                     <<a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/getind_latlon2d.shtml" rel="noreferrer" target="_blank">http://www.ncl.ucar.edu/Docu<wbr>ment/Functions/Contributed/<wbr>getind_latlon2d.shtml</a>><br>
>                      ; latv = (/22, 24.0, 24.0, 22.0, 22.0/)<br>
>                      ; lonv = (/76, 76.0, 78.0, 78.0, 76.0/)<br>
><br>
</span>>                       *latv = (/ 22, 24/)<br>
<span>>                       lonv = (/ 76, 78 /)<br>
>                       nm   = getind_latlon2d (lat2d, lon2d, latv, lonv)<br>
>                       ilt1 = nm(0,0)  ; start lat index<br>
>                       ilt2 = nm(1,0)  ; start lon index<br>
>                       iln1 = nm(0,1)  ; end lat index<br>
>                       iln2 = nm(1,1)  ; end lon index<br>
>                       var_subset = var(ilt1:ilt2,iln1:iln2)<br>
</span>>                       var_subset_avg = avg(var_subset)*<br>
<span>><br>
>                       print(nm)<br>
>                       print("-----")<br>
><br>
>                       do k=0,dimsizes(latv)-1<br>
>                          n = nm(k,0)<br>
>                          m = nm(k,1)<br>
>                          print(lat2d(n,m)+"   "+lon2d(n,m))  <br>
>                          print("     "+data(:,n,m))                <wbr>   ;<br>
>                     nearest grid point at all time steps<br>
>                          print("-----")<br>
>                       end do<br>
><br>
><br>
><br>
><br>
</span>>                     ____<br>
><br>
>                     *But still not getting the desired output as a<br>
<span>>                     single square box mean value . It is showing the<br>
</span>>                     errors as*<br>
<span>><br>
>                     kunal@kunal-Vostro-1015:/medi<wbr>a/Local<br>
>                     Disk_/IIT_DELHI/2001/MAIACTAO<wbr>T_TIME$ ncl extract1.ncl<br>
>                      Copyright (C) 1995-2014 - All Rights Reserved<br>
>                      University Corporation for Atmospheric Research<br>
>                      NCAR Command Language Version 6.2.1<br>
>                      The use of this software is governed by a License<br>
>                     Agreement.<br>
>                      See <a href="http://www.ncl.ucar.edu/" rel="noreferrer" target="_blank">http://www.ncl.ucar.edu/</a> for more details.<br>
><br>
><br>
>                     Variable: fnames<br>
>                     Type: string<br>
>                     Total Size: 4 bytes<br>
>                                 1 values<br>
>                     Number of Dimensions: 1<br>
>                     Dimensions and sizes:    [1]<br>
>                     Coordinates:<br>
>                     (0)    ./<a href="http://maiactaot.h00v02.20010040635-20011550640.nc" rel="noreferrer" target="_blank">maiactaot.h00v02.20010040635<wbr>-20011550640.nc</a><br>
</span>>                     <<a href="http://maiactaot.h00v02.20010040635-20011550640.nc/" rel="noreferrer" target="_blank">http://maiactaot.h00v02.2001<wbr>0040635-20011550640.nc/</a>><br>
<div><div class="m_7192637201731760756h5">><br>
>                     Variable: data<br>
>                     Type: float<br>
>                     Total Size: 40320000 bytes<br>
>                                 10080000 values<br>
>                     Number of Dimensions: 3<br>
>                     Dimensions and sizes:    [time | 7] x [YDim_grid1km<br>
>                     | 1200] x [XDim_grid1km | 1200]<br>
>                     Coordinates:<br>
>                                 time: [8862.583333333314..12486.6666<wbr>6666669]<br>
>                     Number Of Attributes: 8<br>
>                       coordinates :    GridLat_grid1km, GridLon_grid1km<br>
>                       hdfeos_name :    Optical_Depth_055<br>
>                       projection :    Albers Conical Equal_Area<br>
>                       unit :    None<br>
>                       long_name :    AOT at 0.55 micron<br>
>                       _FillValue_original :    -28672<br>
>                       _FillValue :    -28672<br>
>                       valid_range :    ( -0.1,  5 )<br>
>                     (0)    AOT at 0.55 micron: min=0   max=3.924<br>
>                     (0)    -----<br>
>                     (0)    nFill=6285271<br>
>                     (0)    -----<br>
>                     (0)    latitude: min=21.86737357453027  <br>
>                     max=34.99855492029426<br>
>                     (0)    longitude: min=64.23634233372005  <br>
>                     max=79.4747290253718<br>
>                     (0)    -----<br>
>                     fatal:["Execute.c":7863]:Numb<wbr>er of subscripts on<br>
>                     right-hand-side do not match<br>
>                                 number of dimensions of variable: (2),<br>
>                     Subscripts used: (3)<br>
><br>
>                     fatal:["Execute.c":8578]:Exec<wbr>ute: Error occurred at<br>
>                     or near line 34 in file extract1.ncl<br>
><br>
>                     fatal:Variable (var_subset) is undefined<br>
>                     fatal:["Execute.c":8578]:Exec<wbr>ute: Error occurred at<br>
>                     or near line 35 in file extract1.ncl<br>
><br>
><br>
><br>
><br>
>                     Variable: nm<br>
>                     Type: integer<br>
>                     Total Size: 16 bytes<br>
>                                 4 values<br>
>                     Number of Dimensions: 2<br>
>                     Dimensions and sizes:    [2] x [2]<br>
>                     Coordinates:<br>
>                     Number Of Attributes: 1<br>
>                       long_name :    indices closest to specified<br>
>                     LAT/LON coordinate pairs<br>
>                     (0,0)    1199<br>
>                     (0,1)    792<br>
>                     (1,0)    1199<br>
>                     (1,1)    1041<br>
>                     (0)    -----<br>
>                     (0)    23.76603307545667   75.53995171540016<br>
>                     (0)         0.179<br>
>                     (1)         0.142<br>
>                     (2)         -28672<br>
>                     (3)         0.169<br>
>                     (4)         -28672<br>
>                     (5)         -28672<br>
>                     (6)         -28672<br>
>                     (0)    -----<br>
>                     (0)    24.26559325846936   77.93996773594735<br>
>                     (0)         -28672<br>
>                     (1)         0.393<br>
>                     (2)         -28672<br>
>                     (3)         0.156<br>
>                     (4)         0.313<br>
>                     (5)         -28672<br>
>                     (6)         -28672<br>
</div></div>>                     (0)    -----____<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
>                       ____<br>
><br>
><br>
>                     ____<br>
><br>
>                     Kunal Bali____<br>
><br>
>                     __ __<br>
><br>
>                     __ __<br>
><br>
>                     __ __<br>
><br>
>                     __ __<br>
><br>
>                     __ __<br>
<span>><br>
>                     On Sat, Oct 14, 2017 at 12:24 AM, Mary Haley<br>
</span>>                     <<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a> <mailto:<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>>> wrote:____<br>
><br>
>                     Kunal,____<br>
><br>
>                     __ __<br>
<span>><br>
>                     Please include the code where you are actually<br>
>                     taking the average of your data using the<br>
</span>>                     information returned from getind_latlon2d.____<br>
><br>
>                     __ __<br>
<span>><br>
>                     It's important to note that getind_latlon2d simply<br>
>                     returns the individual index values that are closest<br>
>                     to each of the lat/lon pairs that you gave it. It<br>
>                     doesn't work in such a way that you give it a<br>
>                     lat/lon box and it returns all the values in that<br>
</span>>                     box.    ____<br>
><br>
>                     __ __<br>
<span>><br>
>                     That's what I was trying to illustrate with the<br>
>                     wrf_gsn_10.ncl I created.  I gave the function two<br>
>                     corners of the box, and then using the two pairs of<br>
>                     index values I got back, I was able to get all the<br>
</span>>                     values inside the box area of interest:____<br>
><br>
>                     __ __<br>
><br>
>                       lats = (/ min_lat, max_lat /)____<br>
><br>
>                       lons = (/ min_lon, max_lon /)____<br>
><br>
>                       nm   = getind_latlon2d (lat2d, lon2d, lats, lons)____<br>
><br>
>                       ilt1 = nm(0,0)  ; start lat index____<br>
><br>
>                       ilt2 = nm(1,0)  ; start lon index____<br>
><br>
>                       iln1 = nm(0,1)  ; end lat index____<br>
<span>><br>
>                       iln2 = nm(1,1)  ; end lon index<br>
</span>>                       var_subset = var(ilt1:ilt2,iln1:iln2)____<br>
><br>
>                       var_subset_avg = avg(var_subset)____<br>
><br>
>                     __ __<br>
><br>
>                     --Mary____<br>
><br>
>                     __ __<br>
><br>
>                     __ __<br>
<span>><br>
>                     On Thu, Oct 12, 2017 at 1:19 PM, Kunal Bali<br>
>                     <<a href="mailto:kunal.bali9@gmail.com" target="_blank">kunal.bali9@gmail.com</a><br>
</span>>                     <mailto:<a href="mailto:kunal.bali9@gmail.com" target="_blank">kunal.bali9@gmail.com</a><wbr>>> wrote:____<br>
><br>
>                     Dear Haley Ma'am,____<br>
><br>
>                     __ __<br>
><br>
>                     Thanks for providing the information and example. ____<br>
<span>><br>
>                     But if I follow the getind_latlon2d function as I<br>
>                     did, then it seems like I followed the same<br>
>                     procedure as given in the example  <br>
>                     <a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/getind_latlon2d.shtml" rel="noreferrer" target="_blank">http://www.ncl.ucar.edu/Docum<wbr>ent/Functions/Contributed/<wbr>getind_latlon2d.shtml</a><br>
</span>>                     <<a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/getind_latlon2d.shtml" rel="noreferrer" target="_blank">http://www.ncl.ucar.edu/Docu<wbr>ment/Functions/Contributed/<wbr>getind_latlon2d.shtml</a>>____<br>
><br>
>                     __ __<br>
<span>><br>
>                     But still I am not getting the mean of the grid box<br>
>                     on every time step or am I reading incorrectly the<br>
</span>>                     result ?____<br>
><br>
>                     __ __<br>
><br>
>                     __ __<br>
><br>
>                     regards____<br>
><br>
>                     Kunal Bali____<br>
><br>
>                     __ __<br>
><br>
>                     __ __<br>
><br>
>                     __ __<br>
><br>
>                     __ __<br>
><br>
>                     __ __<br>
><br>
>                     __ __<br>
<span>><br>
>                     On Fri, Oct 13, 2017 at 12:11 AM, Mary Haley<br>
</span>>                     <<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a> <mailto:<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>>> wrote:____<br>
><br>
>                     Kunal,____<br>
><br>
>                     __ __<br>
<span>><br>
>                     I created an example for you, showing three ways you<br>
>                     can subset a WRF grid (since I already had a similar<br>
>                     example).  It shows how to use the getind_latlon2d<br>
</span>>                     function.____<br>
><br>
>                     __ __<br>
<span>><br>
>                     You have to be careful with subsetting curvilinear<br>
>                     data, because specifying a lat/lon box to take an<br>
>                     average over can mean two different things. You will<br>
>                     be able to see the difference when you look at the<br>
</span>>                     graphic.____<br>
><br>
>                     __ __<br>
><br>
>                     See example wrf_gsn_10.ncl at:____<br>
><br>
>                     __ __<br>
><br>
>                     <a href="http://www.ncl.ucar.edu/Applications/wrfgsn.shtml#ex10" rel="noreferrer" target="_blank">http://www.ncl.ucar.edu/Appli<wbr>cations/wrfgsn.shtml#ex10</a><br>
>                     <<a href="http://www.ncl.ucar.edu/Applications/wrfgsn.shtml#ex10" rel="noreferrer" target="_blank">http://www.ncl.ucar.edu/Appl<wbr>ications/wrfgsn.shtml#ex10</a>>___<wbr>_<br>
><br>
>                     __ __<br>
><br>
>                     --Mary____<br>
><br>
>                     __ __<br>
><br>
>                     __ __<br>
><br>
>                     __ __<br>
<span>><br>
>                     On Wed, Oct 11, 2017 at 12:03 PM, Kunal Bali<br>
>                     <<a href="mailto:kunal.bali9@gmail.com" target="_blank">kunal.bali9@gmail.com</a><br>
</span>>                     <mailto:<a href="mailto:kunal.bali9@gmail.com" target="_blank">kunal.bali9@gmail.com</a><wbr>>> wrote:____<br>
><br>
>                         Dear NCL users,____<br>
<div><div class="m_7192637201731760756h5">><br>
><br>
>                         Single point coordinates values of 23.0 N and<br>
>                         77.0 E is extracted or print by using the script<br>
>                         below<br>
><br>
>                         -----------------------------<wbr>------------------------------<wbr>-----------<br>
>                         ; Main code<br>
>                         ;----------------------------<wbr>------------------------------<wbr>------------<br>
>                           dir    = "./"<br>
>                           fnames = systemfunc("ls " + dir + "maiactaot*.nc")<br>
>                         print(fnames)<br>
>                           a      = addfile(fnames,"r")<br>
>                           data   = short2flt(a->Optical_Depth_055<wbr>_grid1km)<br>
>                           nFill  = num(ismissing(data))<br>
>                           lat2d  = a->GridLat_grid1km<br>
>                           lon2d  = a->GridLon_grid1km<br>
><br>
>                         ;---grid points of interest<br>
>                           latv = (/23.0/)<br>
>                           lonv = (/77.0 /)<br>
>                          <br>
>                           nm = getind_latlon2d (lat2d,lon2d, latv, lonv)<br>
>                          <br>
>                           do k=0,dimsizes(latv)-1<br>
>                              n = nm(k,0)<br>
>                              m = nm(k,1)<br>
>                              print(lat2d(n,m)+"   "+lon2d(n,m))   ; grid<br>
>                         point location<br>
>                              print("    <br>
>                         "+data(:,n,m))               <wbr>    ; nearest grid<br>
>                         point at all time steps<br>
>                              print("-----")<br>
</div></div>>                           end do____<br>
<span>><br>
>                          <br>
>                         NOW, I want to extract the square grid box of<br>
>                         100 km around the coordinates (23N,77E) such as<br>
>                            latv = (/22, 24.0, 24.0, 22.0, 22.0/)<br>
>                            lonv = (/76, 76.0, 78.0, 78.0, 76.0 /)<br>
><br>
><br>
>                         after that I want to do the area mean of the<br>
>                         grid box. So that I can get one single point<br>
</span>>                         value of that grid box.____<br>
<span>><br>
>                         So when I replacing<br>
>                           latv = (/23.0/)<br>
</span>>                           lonv = (/77.0/)____<br>
><br>
>                         __ __<br>
<span>><br>
>                         with<br>
><br>
>                            latv = (/22, 24.0, 24.0, 22.0, 22.0/)<br>
</span>>                            lonv = (/76, 76.0, 78.0, 78.0, 76.0 /)____<br>
<span>><br>
>                         then It's not giving mean of the square grid<br>
</span>>                         box. ____<br>
<span>><br>
>                         It shows the something like that (given below),<br>
>                         which is incorrect. So please let me know how<br>
>                         can I get the square grid box mean and then<br>
>                         extract as asciiwrite or print?<br>
><br>
>                         (0)    23.76603307545667   75.53995171540016<br>
>                         (0)         0.179<br>
>                         (1)         0.142<br>
>                         (2)         -28672<br>
>                         (3)         0.169<br>
>                         (4)         -28672<br>
>                         (5)         -28672<br>
>                         (6)         -28672<br>
>                         (0)    -----<br>
>                         (0)    24.00322458681621   75.99551564353467<br>
>                         (0)         0.171<br>
>                         (1)         0.16<br>
>                         (2)         -28672<br>
>                         (3)         0.17<br>
>                         (4)         -28672<br>
>                         (5)         -28672<br>
</span>>                         (6)         -28672____<br>
><br>
>                         etc..etc..____<br>
><br>
><br>
><br>
>                         ____<br>
><br>
>                         regards<br>
>                         ____<br>
><br>
>                         Kunal Bali____<br>
><br>
>                         __ __<br>
><br>
>                         __ __<br>
><br>
>                         __ __<br>
><br>
>                         __ __<br>
><br>
>                         _____________________________<wbr>__________________<br>
>                         ncl-talk mailing list<br>
>                         <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a> <mailto:<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>><br>
<span>>                         List instructions, subscriber options, unsubscribe:<br>
</span>>                         <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailm<wbr>an/listinfo/ncl-talk</a> <<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailm<wbr>an/listinfo/ncl-talk</a>>____<br>
><br>
>                     __ __<br>
><br>
>                     __ __<br>
><br>
><br>
>                     _____________________________<wbr>__________________<br>
>                     ncl-talk mailing list<br>
>                     <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a> <mailto:<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>><br>
<span>>                     List instructions, subscriber options, unsubscribe:<br>
>                     <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailm<wbr>an/listinfo/ncl-talk</a><br>
</span>>                     <<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mail<wbr>man/listinfo/ncl-talk</a>>____<br>
><br>
>                     __ __<br>
><br>
>                     __ __<br>
><br>
><br>
>                     _____________________________<wbr>__________________<br>
>                     ncl-talk mailing list<br>
>                     <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a> <mailto:<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>><br>
<span>>                     List instructions, subscriber options, unsubscribe:<br>
>                     <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailm<wbr>an/listinfo/ncl-talk</a><br>
</span>>                     <<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mail<wbr>man/listinfo/ncl-talk</a>>____<br>
><br>
>                     __ __<br>
><br>
>                     __ __<br>
><br>
>                     __ __<br>
><br>
>                     _____________________________<wbr>__________________<br>
>                     ncl-talk mailing list<br>
>                     <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a> <mailto:<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>><br>
<span>>                     List instructions, subscriber options, unsubscribe:<br>
>                     <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailm<wbr>an/listinfo/ncl-talk</a><br>
</span>>                     <<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mail<wbr>man/listinfo/ncl-talk</a>>____<br>
><br>
>                 __ __<br>
><br>
><br>
>                 Guido Cioni____<br>
><br>
>                 <a href="http://guidocioni.altervista.org____" rel="noreferrer" target="_blank">http://guidocioni.altervista.<wbr>org____</a><br>
><br>
>                 __ __<br>
><br>
>                 __ __<br>
><br>
><br>
>                 _____________________________<wbr>__________________<br>
>                 ncl-talk mailing list<br>
>                 <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a> <mailto:<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>><br>
<span>>                 List instructions, subscriber options, unsubscribe:<br>
>                 <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailm<wbr>an/listinfo/ncl-talk</a><br>
</span>>                 <<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mail<wbr>man/listinfo/ncl-talk</a>>____<br>
><br>
>                 __ __<br>
><br>
>                 __ __<br>
><br>
>                 __ __<br>
<span>><br>
><br>
>                 *****************************<wbr>******************************<wbr>***************<br>
>                 The information contained in the EMail and any<br>
>                 attachments is confidential and intended solely and for<br>
>                 the attention and use of the named addressee(s). It may<br>
>                 not be disclosed to any other person without the express<br>
>                 authority of Public Health England, or the intended<br>
>                 recipient, or both. If you are not the intended<br>
>                 recipient, you must not disclose, copy, distribute or<br>
>                 retain this message or any part of it. This footnote<br>
>                 also confirms that this EMail has been swept for<br>
>                 computer viruses by Symantec.Cloud, but please re-sweep<br>
>                 any attachments before opening or saving.<br>
>                 <a href="http://www.gov.uk/PHE" rel="noreferrer" target="_blank">http://www.gov.uk/PHE</a><br>
>                 *****************************<wbr>******************************<wbr>***************<br>
><br>
><br>
><br>
>             _____________________________<wbr>__________________<br>
>             ncl-talk mailing list<br>
</span>>             <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a> <mailto:<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>><br>
<span>>             List instructions, subscriber options, unsubscribe:<br>
>             <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailm<wbr>an/listinfo/ncl-talk</a><br>
</span><span>>             <<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mail<wbr>man/listinfo/ncl-talk</a>><br>
><br>
><br>
><br>
><br>
>         --<br>
>         Barry H. Lynn, Ph.D<br>
>         Senior Lecturer,<br>
>         The Institute of the Earth Science, <br>
>         The Hebrew University of Jerusalem, <br>
>         Givat Ram, Jerusalem 91904, Israel <br>
>         Tel: 972 547 231 170<br>
>         Fax: (972)-25662581<br>
><br>
>         C.E.O, Weather It Is, LTD<br>
>         Weather and Climate Focus<br>
>         <a href="http://weather-it-is.com" rel="noreferrer" target="_blank">http://weather-it-is.com</a><br>
>         Jerusalem, Israel<br>
>         Local: 02 930 9525<br>
>         Cell: 054 7 231 170<br>
>         Int-IS: x972 2 930 9525<br>
</span>>         US <a href="tel:(914)%20432-3108" value="+19144323108" target="_blank">914 432 3108</a> <tel:091443%2023108><br>
<span class="m_7192637201731760756im m_7192637201731760756HOEnZb">><br>
><br>
><br>
><br>
><br>
> --<br>
> Barry H. Lynn, Ph.D<br>
> Senior Lecturer,<br>
> The Institute of the Earth Science, <br>
> The Hebrew University of Jerusalem, <br>
> Givat Ram, Jerusalem 91904, Israel <br>
> Tel: 972 547 231 170<br>
> Fax: (972)-25662581<br>
><br>
> C.E.O, Weather It Is, LTD<br>
> Weather and Climate Focus<br>
> <a href="http://weather-it-is.com" rel="noreferrer" target="_blank">http://weather-it-is.com</a><br>
> Jerusalem, Israel<br>
> Local: 02 930 9525<br>
> Cell: 054 7 231 170<br>
> Int-IS: x972 2 930 9525<br>
> US <a href="tel:(914)%20432-3108" value="+19144323108" target="_blank">914 432 3108</a><br>
><br>
><br>
> ______________________________<wbr>_________________<br>
> ncl-talk mailing list<br>
> <a href="mailto:ncl-talk@ucar.edu" target="_blank">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/mailma<wbr>n/listinfo/ncl-talk</a><br>
><br>
<br>
--<br>
</span><span class="m_7192637201731760756HOEnZb"><font color="#888888">Adrian Tompkins          | Earth System Physics<br>
<a href="tel:+39%20040%20224%200579" value="+390402240579" target="_blank">+39 040 2240579</a> (office) | ICTP<br>
<a href="tel:+39%20040%202240%207579" value="+3904022407579" target="_blank">+39 040 22407579</a> (fax)   | Strada Costiera 11<br>
<a href="http://www.ictp.it/~tompkins" rel="noreferrer" target="_blank">www.ictp.it/~tompkins</a>    | 34151 Trieste, Italy<br>
</font></span><div class="m_7192637201731760756HOEnZb"><div class="m_7192637201731760756h5"><br>
______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">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/mailma<wbr>n/listinfo/ncl-talk</a><br>
</div></div></blockquote></div><br></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>