[ncl-talk] Shading significant grid points

Anahita Amiri Farahani aamir003 at ucr.edu
Fri Jan 15 20:19:50 MST 2016


Dear All,

I tried to shade where only significant grid points and wrote this script:



sig2D!0="lat"
sig2D!1="lon"
;Coordinate
sig2D&lat=lat
sig2D&lon=lon

alb_clr_der_summer2D!0="lat"
alb_clr_der_summer2D!1="lon"
;Coordinate
alb_clr_der_summer2D&lat=lat
alb_clr_der_summer2D&lon=lon

a = addfile("$NCARG_ROOT/lib/ncarg/data/cdf/landsea.nc","r")
lsdata = a->LSMASK
lsm  =
landsea_mask(lsdata,alb_clr_der_summer2D&lat,alb_clr_der_summer2D&lon)
alb_clr_der_summer2D = mask(alb_clr_der_summer2D,lsm.eq.1,False)
;alb_clr_der_summer2D = mask(alb_clr_der_summer2D,lsm.eq.3,False)



lsm  = landsea_mask(lsdata,sig2D&lat,sig2D&lon)
sig2D = mask(sig2D,lsm.eq.1,False)
;sig2D = mask(sig2D,lsm.eq.3,False)


print("Plot")

wks = gsn_open_wks("eps","1st_der_test")
gsn_define_colormap(wks,"BlWhRe")   ; choose color
;gsn_define_colormap(wks,"BlAqGrYeOrRe")

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  res                     = True               ; plot mods desired
  res at cnFillOn            = True              ; turn on color
  res at gsnSpreadColors     = True               ; use full color map
  res at cnLinesOn           = False              ; no contour lines
  res at cnLineLabelsOn      = False              ; no line labels

  res at mpMaxLatF = 29.5                         ; specify the plot domain
  res at mpMinLatF = 0.5                         ;
  res at mpMinLonF = -44.5                        ;
  res at mpMaxLonF = 15.5

  res at gsnAddCyclic        = False

 ; res at cnLevelSelectionMode =  "AutomaticLevels"   ; AutomaticLevels


  res at cnLevelSelectionMode =  "ManualLevels"   ; AutomaticLevels
  res at cnMinLevelValF       = -1.              ; min level
  res at cnMaxLevelValF       =  1.               ; max level
  res at cnLevelSpacingF      =  0.1               ; interval

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
res at tiMainString        = "1st der test"


res at gsnDraw              = False           ; Do not draw plot
res at gsnFrame             = False           ; Do not advance frame

plot= gsn_csm_contour_map_ce(wks,alb_clr_der_summer2D(:,:),res)

;delete(wks)

; ========================= PLOT 2 ==============================
 res2 = True                            ; res2 probability plots


  res2 at gsnDraw              = False           ; Do not draw plot
  res2 at gsnFrame             = False           ; Do not advance frame
  res2 at cnLevelSelectionMode = "ManualLevels" ; set manual contour levels
  res2 at cnMinLevelValF      = 0.00        ; set min contour level
  res2 at cnMaxLevelValF      = 1.05        ; set max contour level
  res2 at cnLevelSpacingF     = 0.05        ; set contour spacing

  res2 at cnInfoLabelOn       = False       ; turn off info label

  res2 at cnLinesOn           = False       ; do not draw contour lines
  res2 at cnLineLabelsOn      = False       ; do not draw contour labels

  res2 at cnFillScaleF        = 0.6         ; add extra density
;  delete(alpha at long_name)
;  delete(alpha at units)

  plot2   = gsn_csm_contour(wks,gsn_add_cyclic_point(sig2D(:,:)), res2)
  plot2   = ShadeGtContour(plot2, 0.95, 17)  ; shade all areas less than the
                                             ; 0.05 contour level
  overlay (plot, plot2)

  draw (plot)
  frame(wks)




but I got this warning:


(0)     gsn_add_cyclic: Warning: The range of your longitude data is not
360.

(0)     You may want to set gsnAddCyclic to False to avoid a warning

(0)     message from the spline function.

warning:_NhlCreateSplineCoordApprox: Attempt to create spline approximation
for X axis failed: consider adjusting trXTensionF value

warning:IrTransInitialize: error creating spline approximation for
trXCoordPoints; defaulting to linear


lat ranges from 0.5 to 29.5 and lon ranges from -45.5 to 14.5 and the
resolution is 1*1 degree.


Thanks,

Ana
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160115/776b6c2d/attachment.html 


More information about the ncl-talk mailing list