[ncl-talk] Shading significant grid points

Anahita Amiri Farahani aamir003 at ucr.edu
Tue Jan 19 15:31:58 MST 2016


Hi Marry,

 Thanks for your help, I just removed gsn_add_cyclic_point for plot2 and
the problem is solved:


; ========================= 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)
  res2 at gsnAddCyclic = False
  plot2   = gsn_csm_contour(wks,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)


Cheers,
Ana


On Tue, Jan 19, 2016 at 7:36 AM, Mary Haley <haley at ucar.edu> wrote:

> Ana,
>
> You may also need to set gsnAddCyclic to False for the "res2" variable as
> well.
>
> Did you read the documentation for ShadeGtContour?
>
> http://www.ncl.ucar.edu/Document/Functions/Shea_util/ShadeGtContour.shtml
>
> It states that this is a deprecated function, and that you should use
> gsn_contour_shade instead:
>
>
> http://www.ncl.ucar.edu/Document/Graphics/Interfaces/gsn_contour_shade.shtml
>
> If you continue to have problems, please include any error messages you
> are getting, even if it's the same one.  Just saying "it didn't work"
> doesn't give us enough information.  We need to know if you are still
> getting the same error message, a new error message, or none at all.
>
> Thanks,
>
> --Mary
>
>
>
>
> On Sat, Jan 16, 2016 at 11:02 AM, Anahita Amiri Farahani <aamir003 at ucr.edu
> > wrote:
>
>> Hi Karin,
>>
>> Thanks for your answer. I tried it, but didn't work.
>>
>> Cheers,
>> Ana
>>
>> On Sat, Jan 16, 2016 at 1:49 AM, Karin Meier-Fleischer <
>> meier-fleischer at dkrz.de> wrote:
>>
>>> Hi Ana,
>>>
>>> the warning message is telling you exactly what to do. Set
>>>
>>>    res at gsnAddCyclic = False
>>>
>>> because your grid is not global (longitudes are not 0-360 degrees), as
>>> you already said
>>>
>>> lat ranges from 0.5 to 29.5 and lon ranges from -45.5 to 14.5 and the
>>> resolution is 1*1 degree.
>>>
>>>
>>> Bye,
>>> Karin
>>>
>>>
>>> Am 16.01.2016 um 04:19 schrieb Anahita Amiri Farahani <aamir003 at ucr.edu
>>> >:
>>>
>>> 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
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>>>
>>>
>>>
>>
>> _______________________________________________
>> 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/20160119/1a46cf49/attachment.html 


More information about the ncl-talk mailing list