<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Nitin, if you want to ignore the values in computations/plot you can easily mask the variable making use of the _FillValue attribute. NCL will ignore every missing value when computing stuff, e.g. averages or making contour plots.<div class=""><br class=""></div><div class="">I would do something like that</div><div class=""><br class=""></div><div class=""><font face="Menlo" class=""><b class="">x=where(x .ge. 1, x@_FillValue, x)</b></font></div><div class=""><font face="Menlo" class=""><b class=""><br class=""></b></font></div><div class=""><font face="Arial" class="">that means, where <b class="">x is greater than or equal to 1 put a _FillValue, otherwise preserve the original x value.</b></font></div><div class=""><br class=""></div><div class="">You need the _FillValue attribute to be already defined at the time of execution, but I thing that wouldn’t be a problem since x is already defined as float. <br class=""><div class="">
<div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class="Apple-interchange-newline">Guido Cioni</div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="http://guidocioni.altervista.org" class="">http://guidocioni.altervista.org</a> </div>
</div>
<br class=""><div><blockquote type="cite" class=""><div class="">On 11 Aug 2016, at 11:43, Nitin Patil <<a href="mailto:nitinpatil85@gmail.com" class="">nitinpatil85@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="gmail_quote"><div dir="ltr" class=""><div class="">Dear NCL usrs,<br class=""><br class=""></div>In my script I want to ignore AOD values which are greater than 1.0, any idea where to put it?<br class=""><div class=""><div class=""><br class="">=================<br class="">load "$NCARG_ROOT/lib/ncarg/<wbr class="">nclscripts/csm/gsn_code.ncl"<br class="">load "$NCARG_ROOT/lib/ncarg/<wbr class="">nclscripts/csm/gsn_csm.ncl"<br class="">load "$NCARG_ROOT/lib/ncarg/<wbr class="">nclscripts/csm/contributed.<wbr class="">ncl"<br class=""><br class="">begin<br class=""><br class="">;*****************************<wbr class="">*******************<br class="">; Specify geographical region and time span (year-month start and end<br class="">;*****************************<wbr class="">*******************<br class=""><br class=""> latS = -90 <br class=""> latN = 90<br class=""> lonL = 0<br class=""> lonR = 360<br class=""><br class=""> ymStrt = 197101 <br class=""> ymLast = 201012<br class=""> <br class=""> pltType = "ps" <br class=""> pltName = "regress"<br class=""> pltTitle = "Globe: "+(ymStrt/100)+"-"+(ymLast/<wbr class="">100)<br class=""><br class="">;*****************************<wbr class="">*******************<br class="">; Read from netCDF file: variable is type short...unpack<br class="">;*****************************<wbr class="">*******************<br class=""> diri = "/media/Work/3_LTS_echam6_<wbr class="">Data/EACSST_ens_1971-2010/"<br class=""> fili = "EACSST_E1_1971-2010_AOD.<wbr class="">nc"<br class=""> f = addfile(diri+fili,"r") <br class=""><br class=""> YYYYMM = cd_calendar( f->time, -1)<br class=""><br class=""> iStrt = ind(YYYYMM.eq.ymStrt)<br class=""> iLast = ind(YYYYMM.eq.ymLast)<br class=""><br class=""> <b class="">x = short2flt( f->tau_aod(iStrt:iLast,{latS:<wbr class="">latN},{lonL:lonR}))</b><br class=""> <br class=""> </div><div class=""> x@units= "mm/day"<br class=""><br class=""> printVarSummary(x) <wbr class=""> ; [time| 1344]x[lat| 91]x[lon| 180]<br class=""><br class=""> yyyymm = cd_calendar(x&time, -1)<br class=""> yyyy = yyyymm/100<br class=""><br class=""> dimx = dimsizes(x)<br class=""> ntim = dimx(0) ; all years and months<br class=""> nlat = dimx(1)<br class=""> mlon = dimx(2)<br class=""><br class=""> year = ispan(yyyy(0), yyyy(ntim-1), 1)<br class=""> nyrs = dimsizes(year)<br class=""><br class="">;*****************************<wbr class="">*******************<br class="">; Areal averages: cos(lat) is good enough<br class="">;*****************************<wbr class="">*******************<br class=""><br class=""> xann = month_to_annual(x , 1) ; [year| 112]x[lat| 91]x[lon| 180]<br class=""> xann&year = year<br class=""> printVarSummary(xann)<br class=""><br class="">;*****************************<wbr class="">*******************<br class="">; Calculate the regression coefficients (slopes) <br class="">;*****************************<wbr class="">*******************<br class=""> rc = regCoef(year,xann(lat|:,lon|:,<wbr class="">year|:)) <br class=""> <br class=""> rc@long_name = "Trend"<br class=""> rc@units = xann@units+"/year"<br class=""> copy_VarCoords(xann(0,:,:), rc) ; copy lat,lon coords<br class=""><br class=""> printVarSummary(rc)<br class=""><br class="">;*****************************<wbr class="">*******************<br class="">; for illustration: change units to degC/period-used<br class="">;*****************************<wbr class="">*******************<br class=""> rc = rc*nyrs ; (C/year)*(nyrs)<br class=""> rc@units = ""+nyrs+" year"<br class=""><br class="">;*****************************<wbr class="">*******************<br class="">; plotting parameters <br class="">;*****************************<wbr class="">*******************<br class=""> wks = gsn_open_wks("eps","EACSST_<wbr class="">trend_yearly_precip") ; specifies a ps plot<br class=""> gsn_define_colormap(wks,"<wbr class="">precip2_15lev")<br class=""> res = True <br class=""> res@gsnMaximize = True ; make large<br class=""><br class=""> res@cnFillOn = True ; turn on color<br class=""> res@cnLinesOn = False ; turn off contour lines<br class=""> res@cnLineLabelsOn = False ; turn off contour line labels<br class=""> ;;res@cnFillMode = "RasterFill"<br class=""><br class=""> res@mpMinLatF = 5 ;-- sub-region minimum latitude<br class=""> res@mpMaxLatF = 40 ;-- sub-region maximum latitude<br class=""> res@mpMinLonF = 60 ;-- sub-region minimum longitude<br class=""> res@mpMaxLonF = 100 ;-- sub-region maximum longitude<br class=""><br class=""><br class=""> res@cnLevelSelectionMode = "ManualLevels" ; set manual contour levels<br class=""> res@cnMinLevelValF = -0.18 ; set min contour level<br class=""> res@cnMaxLevelValF = 0.18 ; set max contour level<br class=""> res@cnLevelSpacingF = 0.01 ; set contour interval<br class=""><br class=""> res@mpFillOn = False ; turn off default background gray<br class=""> ;res@mpCenterLonF = 180<br class=""><br class=""> res@gsnCenterString = year(0)+"-"+year(nyrs-1) <br class=""> <br class=""> res@tiMainString = "Yearly trend (precip EACSST)" ; fili<br class=""> plot = gsn_csm_contour_map_ce(wks,rc,<wbr class="">res) <br class=""> end<br class="">=================<br clear="all" class=""><div class=""><div data-smartmail="gmail_signature" class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class=""><div class=""><br class=""></div><div class="">--</div>Regards,<div class="">Nitin Patil</div></div></div></div></div></div></div></div></div></div>
</div></div></div>
</div><br class=""></div>
_______________________________________________<br class="">ncl-talk mailing list<br class=""><a href="mailto:ncl-talk@ucar.edu" class="">ncl-talk@ucar.edu</a><br class="">List instructions, subscriber options, unsubscribe:<br class="">http://mailman.ucar.edu/mailman/listinfo/ncl-talk<br class=""></div></blockquote></div><br class=""></div></body></html>