[ncl-talk] Replacement of data with a constant value

Herb, Jason jherb at albany.edu
Mon Jul 15 08:24:18 MDT 2019


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190715/ff3f51ea/attachment.html>


More information about the ncl-talk mailing list