[ncl-talk] Replacement of data with a constant value
Dennis Shea
shea at ucar.edu
Mon Jul 15 09:18:35 MDT 2019
*http://www.ncl.ucar.edu/Document/Functions/Built-in/where.shtml*
<http://www.ncl.ucar.edu/Document/Functions/Built-in/where.shtml>
*http://www.ncl.ucar.edu/Document/Functions/Built-in/num.shtml*
<http://www.ncl.ucar.edu/Document/Functions/Built-in/num.shtml>
I am not sure where you got the form you are using for '*where*'.
In no example is there an 'x=1' style for any of the arguments.
Also, given your description, I'm not sure that you want to use '*where'*
x = *short2flt*( f->$vNam$ ) ; ( Orbits_grid1km,
YDim_grid1km, XDim_grid1km )
nx = *num*(x.gt.-100 .and. x.lt.5000) ; # of values bwtweem -100 and
5000
===
x01 = *where*(x.gt.-100 .and. x.lt.5000, 0, 1) ; create
an array of 0 and 1
n1 = *num*(x.eq.1) ; also: *sum*(x)
On Mon, Jul 15, 2019 at 8:24 AM Herb, Jason via ncl-talk <ncl-talk at ucar.edu>
wrote:
> Hello,
>
>
> 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.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.
> 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.
>
>
> Script error messages
>
> fatal:syntax error: line 120 in file MCD19A2.Jason1.ncl before or near =
> x1 = where(x.gt.-100 .and. x.lt.5000, x =
> ---------------------------------------------^
>
> fatal:Syntax Error in block, block not executed
> fatal:error at line 136 in file MCD19A2.Jason1.ncl
>
> (0)
> =====> Wall Clock Elapsed Time: Main Sum Loop: nlat=3600, mlon=7200: 0
> seconds <=====
>
> fatal:Variable (f) is undefined
> fatal:["Execute.c":8640]:Execute: Error occurred at or near line 154 in
> file MCD19A2.Jason1.ncl
>
> fatal:Variable (f) is undefined
> fatal:["Execute.c":8640]:Execute: Error occurred at or near line 159 in
> file MCD19A2.Jason1.ncl
>
> warning:ContourPlotInitialize: no valid values in scalar field;
> ContourPlot not possible:[errno=1101]
> warning:ContourPlotInitialize: no valid values in scalar field;
> ContourPlot not possible:[errno=1101]
>
>
> Script coding
> tStrt = systemfunc("date") ; time the loop (wall clock)
>
> do nf=0,nfil-1 ; loop over all files
> print(nf+" "+fili(nf))
> f = addfile(diri+fili(nf)+".he2", "r") ; .he2 causes NCL to
> add lat/lon arrays
> ; read data
> lat2d = f->GridLat_grid1km
> lon2d = f->GridLon_grid1km
>
> x = short2flt( f->$vNam$ ) ; ( Orbits_grid1km,
> YDim_grid1km, XDim_grid1km )
> ;*************** attmeping to change any AOD data other then N/A to 1 to
> count up
> x1 = where(x.gt.-100 .and. x.lt.5000, x = 1)
> delete( x )
> x = x1
>
> Thank you for you time
>
> Jason
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190715/a67941b8/attachment.html>
More information about the ncl-talk
mailing list