<div dir="ltr"><div><a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/where.shtml" target="_blank"><b>http://www.ncl.ucar.edu/Document/Functions/Built-in/where.shtml</b></a></div><div><a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/num.shtml"><b>http://www.ncl.ucar.edu/Document/Functions/Built-in/num.shtml</b></a></div><div><br></div><div>I am not sure where you got the form you are using for '<b>where</b>'. <br></div><div>In no example is there an 'x=1' style for any of the arguments.</div><div><br></div><div>Also, given your description, I'm not sure that you want to use '<b>where'</b><br></div><div><br></div><div>x       = <b>short2flt</b>( f->$vNam$   )            ; ( Orbits_grid1km, YDim_grid1km, XDim_grid1km )<br>nx     = <b>num</b>(x.gt.-100 .and. x.lt.5000)   ; #  of values bwtweem -100 and 5000<br></div><div>===</div><div><br></div><div>x01   = <b>where</b>(x.gt.-100 .and. x.lt.5000, 0, 1)                  ; create an array of 0 and 1<br></div><div>n1     = <b>num</b>(x.eq.1)                              ; also: <b>sum</b>(x)<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jul 15, 2019 at 8:24 AM Herb, Jason via ncl-talk <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">




<div dir="ltr">
<div id="gmail-m_-1306245686675571092gmail-m_-7474457273243491077divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Helvetica,sans-serif" dir="ltr">
<p style="margin-top:0px;margin-bottom:0px">Hello,</p>
<p style="margin-top:0px;margin-bottom:0px"><br>
</p>
<p style="margin-top:0px;margin-bottom:0px">I am working with the MCD19A2 data. In order to see the data extent for any given time period, 1 day, 1 month, 1 year, or any selected time period we need to assess.<span>I have a binning code to add the points, however
 the points that are being added are the original AOD values in the hdf files.</span> In order to do this I am attempting to replace all data points in the hdf file to " 1 " if there is data that is within the range flag of the data file. I have attempted to
 use the "where" function to make these replacements however I keep getting error bugs coming up. The portion of the script can be found below.</p>
<p style="margin-top:0px;margin-bottom:0px"><br>
</p>
<p style="margin-top:0px;margin-bottom:0px">Script error messages<br>
</p>
<p style="margin-top:0px;margin-bottom:0px"></p>
<div>fatal:syntax error: line 120 in file MCD19A2.Jason1.ncl before or near =<br>
     x1 = where(x.gt.-100 .and. x.lt.5000, x =<br>
---------------------------------------------^<br>
<br>
fatal:Syntax Error in block, block not executed<br>
fatal:error at line 136 in file MCD19A2.Jason1.ncl<br>
<br>
(0)<br>
=====> Wall Clock Elapsed Time: Main Sum Loop: nlat=3600, mlon=7200: 0 seconds <=====<br>
<br>
fatal:Variable (f) is undefined<br>
fatal:["Execute.c":8640]:Execute: Error occurred at or near line 154 in file MCD19A2.Jason1.ncl<br>
<br>
fatal:Variable (f) is undefined<br>
fatal:["Execute.c":8640]:Execute: Error occurred at or near line 159 in file MCD19A2.Jason1.ncl<br>
<br>
warning:ContourPlotInitialize: no valid values in scalar field; ContourPlot not possible:[errno=1101]<br>
warning:ContourPlotInitialize: no valid values in scalar field; ContourPlot not possible:[errno=1101]</div>
<div><br>
</div>
<div><br>
Script coding<br>
</div>
<div> tStrt = systemfunc("date")         ; time the loop (wall clock)<br>
<br>
  do nf=0,nfil-1                     ; loop over all files<br>
     print(nf+"   "+fili(nf))<br>
     f       = addfile(diri+fili(nf)+".he2", "r")   ;  .he2 causes NCL to add lat/lon arrays<br>
                                     ; read data<br>
     lat2d   = f->GridLat_grid1km<br>
     lon2d   = f->GridLon_grid1km<br>
<br>
     x       = short2flt( f->$vNam$   )   ; ( Orbits_grid1km, YDim_grid1km, XDim_grid1km )<br>
;*************** attmeping to change any AOD data other then N/A to 1 to count up<br>
     x1 = where(x.gt.-100 .and. x.lt.5000, x = 1)<br>
     delete(  x  )<br>
     x = x1<br>
<br>
</div>
Thank you for you time
<p></p>
<p style="margin-top:0px;margin-bottom:0px">Jason<br>
</p>
<p style="margin-top:0px;margin-bottom:0px"><br>
</p>
</div>
</div>

_______________________________________________<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/mailman/listinfo/ncl-talk</a></blockquote></div>