[ncl-talk] need help to edit maps to exclude color on the ocean and contour values on land points

Ruksana Abedin ruksana.abedin at gmail.com
Wed Jan 25 03:45:44 MST 2017


Dear Mary and NCL users,

I have got similar problem while making bias maps for temperature. The
script, variable summary, min-max, the panel plot temp_mean_diff(3).jpg.
and the input files are given. This time missing value has been set
properly but still I am getting colour on the Ocean points.

These biases are calculated by subtracting observation from the climate
model. However, if I do the opposite, bias = observation-model; I get no
problem with the same script and the panel plot is temp_mean_diff(4).jpg.
Can you please help me to get rid of this problem. I need to have the bias
maps using the first method.
Thank you very much for your kind support, this really keeps me going on
with using ncl.

Best regards,
Ruksana

begin

; read in data for bias maps

fM0=addfile("/.../WAH_APHRO_TMEAN_1988_2007_DJF_bias.nc", "r");
fM1=addfile("/.../WAH_APHRO_TMEAN_1988_2007_MAM_bias.nc", "r");
fM2=addfile("/.../WAH_APHRO_TMEAN_1988_2007_JJAS_bias.nc", "r");
fM3=addfile("/.../WAH_APHRO_TMEAN_1988_2007_ON_bias.nc", "r");
;*******************************************************************************************************************************
; read variable

TmeanM0 = fM0 ->tave(:,:,:)
timeM0 = fM0 ->time
latM0 = fM0 ->lat
lonM0 = fM0 ->lon

TmeanM1 = fM1 ->tave(:,:,:)
timeM1 = fM1 ->time
latM1 = fM1 ->lat
lonM1 = fM1 ->lon

TmeanM2 = fM2 ->tave(:,:,:)
timeM2 = fM2 ->time
latM2 = fM2 ->lat
lonM2 = fM2 ->lon

TmeanM3 = fM3 ->tave(:,:,:)
timeM3 = fM3 ->time
latM3 = fM3 ->lat
lonM3 = fM3 ->lon

printVarSummary(TmeanM0)
printVarSummary(TmeanM1)
printVarSummary(TmeanM2)
printVarSummary(TmeanM3)

printMinMax(TmeanM0, 0)
printMinMax(TmeanM1, 0)
printMinMax(TmeanM2, 0)
printMinMax(TmeanM3, 0)

;***********************************************************
; create plots
;***********************************************************

  wks = gsn_open_wks("eps","temp_mean_diff")
  plot = new(4,graphic)
  gsn_define_colormap(wks,"temp_diff_18lev")      ; choose colormap
  ;gsn_reverse_colormap(wks)
  res                          = True
  res at gsnDraw                  = False
  res at gsnFrame                   = False
  res at cnInfoLabelOn            = False
  res at cnFillOn                 = True                 ; turn on color
  res at cnLinesOn                = False             ; turn off contour lines
  res at cnLevelSpacingF          = 0.10              ; contour interval
  res at cnFillDrawOrder          = "PreDraw"         ; draw contours first
  res at lbLabelStride            = 2                 ; stride on label bar
  res at gsnSpreadColors          = True              ; use full colormap
  res at gsnSpreadColorEnd        = -3                ; -3 don't use land color
  res at gsnAddCyclic             = False             ; regional data
  res at gsnStringFontHeightF     = 0.01
  res at tiMainString             = ""
  res at gsnRightString           = ""
  ;res at mpProjection            = "LambertConformal"
  ;res at gsnMaskLambertConformal = True
  res at gsnLeftString            = ""
  res at mpMaxLatF                = 30;max(lat)  ; zoom in on region
  res at mpMinLatF                = 15;min(lat)
  res at mpMinLonF                = 83;min(lon)
  res at mpMaxLonF                = 97; max(lon)
  res at mpCenterLonF             = 10                ; def is zero
  res at mpLandFillColor          = "Transparent"
  res at cnLevelSelectionMode= "ManualLevels"
  res at cnLineLabelsOn = False
   res at lbLabelAutoStride   = True
  res at lbLabelBarOn = False
  TmeanM1 at _FillValue    = 0.0
  TmeanM1 at _FillValue    = -99.9
  res at cnMinLevelValF      = -5.
  res at cnMaxLevelValF      = 5.; 1
  res at cnLevelSpacingF     = 1; 1
  res at lbLabelAutoStride   = True

plot(0) = gsn_csm_contour_map(wks,TmeanM0(0,:,:),res)
plot(1) = gsn_csm_contour_map(wks,TmeanM1(0,:,:),res)
plot(2) = gsn_csm_contour_map(wks,TmeanM2(0,:,:),res)
plot(3) = gsn_csm_contour_map(wks,TmeanM3(0,:,:),res)

;***********************************************************
; create panel
;***********************************************************
resP                          = True
resP at gsnFrame                 = False
resP at gsnMaximize              = True
resP at gsnPanelLabelBar         = True   ; add common labelbar
;resP at lbLabelFontHeightF       = 0.005
;resP at gsnPanelMainString       =""
;resP at txString                 =""
resP at gsnPanelFigureStrings    =(/"DJF","MAM","JJAS","ON"/)            ; add
strings to panel
gsn_panel(wks,plot,(/4,4/),resP)          ; now draw as one plot

end

;*******************************************************************************************************************************

*Variable information*
Variable: TmeanM0
Type: float
Total Size: 3480 bytes
            870 values
Number of Dimensions: 3
Dimensions and sizes:   [time | 1] x [lat | 30] x [lon | 29]
Coordinates:
            time: [19980101..19980101]
            lat: [15.25..29.75]
            lon: [  83..  97]
Number Of Attributes: 5
  long_name :   daily mean temperature analysis [degC]
  units :       degC
  _FillValue :  -99.9
  missing_value :       -99.9
  level_description :   Earth surface

Variable: TmeanM1
Type: float
Total Size: 3480 bytes
            870 values
Number of Dimensions: 3
Dimensions and sizes:   [time | 1] x [lat | 30] x [lon | 29]
Coordinates:
            time: [19971016..19971016]
            lat: [15.25..29.75]
            lon: [  83..  97]
Number Of Attributes: 5
  long_name :   daily mean temperature analysis [degC]
  units :       degC
  _FillValue :  -99.9
  missing_value :       -99.9
  level_description :   Earth surface

Variable: TmeanM2
Type: float
Total Size: 3480 bytes
            870 values
Number of Dimensions: 3
Dimensions and sizes:   [time | 1] x [lat | 30] x [lon | 29]
Coordinates:
            time: [19980201..19980201]
            lat: [15.25..29.75]
            lon: [  83..  97]
Number Of Attributes: 5
  long_name :   daily mean temperature analysis [degC]
  units :       degC
  _FillValue :  -99.9
  missing_value :       -99.9
  level_description :   Earth surface

Variable: TmeanM3
Type: float
Total Size: 3480 bytes
            870 values
Number of Dimensions: 3
Dimensions and sizes:   [time | 1] x [lat | 30] x [lon | 29]
Coordinates:
            time: [19980501..19980501]
            lat: [15.25..29.75]
            lon: [  83..  97]
Number Of Attributes: 5
  long_name :   daily mean temperature analysis [degC]
  units :       degC
  _FillValue :  -99.9
  missing_value :       -99.9
  level_description :   Earth surface
(0)     daily mean temperature analysis [degC]: min=-1.07374e+09
max=1.78964
(0)     daily mean temperature analysis [degC]: min=-1.07374e+09
max=4.93295
(0)     daily mean temperature analysis [degC]: min=-1.07374e+09
max=2.17995
(0)     daily mean temperature analysis [degC]: min=-1.07374e+09
max=1.05083



On Tue, Nov 29, 2016 at 5:37 PM, Mary Haley <haley at ucar.edu> wrote:

> Sorry for the delay. I was out of the office last week.
>
> I assume you are talking about the contour line labels.  Try setting:
>
> res at cnLineLabelsOn = False
>
> I suggest that you visit our examples page at:
>
> http://test.www.ncl.ucar.edu/Applications/
>
> You will see lots of topics on this page, like "contour labels" and
> "contour effects".  If you click on any one of the topics, you will see a
> page with a list of examples, each with a sample NCL script and graphic.
> This is one of the best ways to learn about the various graphical resources
> in NCL and how to set them.
>
> Good luck,
>
> --Mary
>
>
> On Mon, Nov 21, 2016 at 6:55 AM, Ruksana Abedin <ruksana.abedin at gmail.com>
> wrote:
>
>> Dear Mary,
>>
>> Thank you very much for pointing at the issue and the fix for it. Now,
>> the plot could be corrected with no color on the ocean points.
>>
>> But what about excluding the data values on the contours randomly on the
>> land points? How can I disable this option? I have not set any resource for
>> this, it is done somehow automatically. Please can you help me to avoid
>> these values on the maps?
>>
>> Best regards,
>> Ruksana
>>
>>
>> On Mon, Nov 21, 2016 at 12:37 PM, Mary Haley <haley at ucar.edu> wrote:
>>
>>> Ruksana,
>>>
>>> It is very important that you look at your data before you assume that
>>> NCL is plotting it incorrectly.
>>>
>>> If you look at "ppt3" with printVarSummary and printMinMax, you will see
>>> that your missing values are not set correctly.
>>>
>>> Here's the printVarSummary, which claims the missing value is -99.9:
>>>
>>> Variable: ppt3
>>> Type: float
>>> Total Size: 3480 bytes
>>>             870 values
>>> Number of Dimensions: 3
>>> Dimensions and sizes: [time | 1] x [lat | 30] x [lon | 29]
>>> Coordinates:
>>>             time: [14400..14400]
>>>             lat: [15.25..29.75]
>>>             lon: [  83..  97]
>>> Number Of Attributes: 5
>>>   long_name : daily precipitation analysis interpolated onto 0.5deg
>>> grids [mm/day]
>>>   units : mm/day
>>>   _FillValue : -99.9
>>>   missing_value : -99.9
>>>   level_description : Earth surface
>>>
>>> However, if you do a printMinMax on pp3, you will see a maximum value of
>>> 1e+20, which seems suspicious:
>>>
>>> daily precipitation analysis interpolated onto 0.5deg grids [mm/day]
>>> (mm/day) : min=-2497.37   max=1e+20
>>>
>>> My guess is that you need to set the missing value of ppt3 to 1e20:
>>>
>>> ppt3 at _FillValue = 1e20
>>>
>>> --Mary
>>>
>>>
>>>
>>> On Sat, Nov 19, 2016 at 2:35 PM, Ruksana Abedin <
>>> ruksana.abedin at gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> I have plotted a panel of two bias maps. The plot, input files and the
>>>> script is attached. Problem is although my data is only on land points, on
>>>> the first bias map, the ocean is colored as orange, which should not be the
>>>> case. And the maps show few values of the contours on the land points
>>>> irregularly, but I do not want any values to be shown. Can you please help
>>>> me to do these two corections?
>>>>
>>>> Thank you for your time and kind efforts.
>>>>
>>>> Best regards,
>>>> Ruksana
>>>>
>>>>
>>>>
>>>> begin
>>>>
>>>> ; read in data
>>>>
>>>> f3=addfile(".........../WAH_APHRO_1998_2007_ANN_sum_precip_bias.nc",
>>>> "r");
>>>> f4=addfile(".........../WAH_GPCC_1998_2007_ANN_sum_precip_bias.nc",
>>>> "r");
>>>>
>>>> ppt3 = f3->precip
>>>> time = f3->time
>>>> lat = f3->lat
>>>> lon = f3->lon
>>>>
>>>> ppt4 = f4->precip
>>>> time = f4->time
>>>> lat = f4->lat
>>>> lon = f4->lon
>>>>
>>>> wks = gsn_open_wks("eps","ppt1")
>>>> plot = new(2,graphic)
>>>>
>>>> printVarSummary(ppt3)
>>>> printVarSummary(ppt4)
>>>>
>>>>  gsn_define_colormap(wks,"percent_11lev")      ; choose colormap for
>>>> bias map
>>>>   ;gsn_reverse_colormap(wks)
>>>>   res                          = True
>>>>   res at gsnDraw                  = False
>>>>   res at gsnFrame                   = False
>>>>   res at cnInfoLabelOn            = False
>>>>   res at cnFillOn                 = True                 ; turn on color
>>>>   res at cnLinesOn                = False             ; turn off contour
>>>> lines
>>>>   res at cnLevelSpacingF          = 0.10              ; contour interval
>>>>   res at cnFillDrawOrder          = "PreDraw"         ; draw contours
>>>> first
>>>>   res at lbLabelStride            = 2                 ; stride on label
>>>> bar
>>>>   res at gsnSpreadColors          = True              ; use full colormap
>>>>   res at gsnSpreadColorEnd        = -3                ; -3 don't use land
>>>> color
>>>>   res at gsnAddCyclic             = False             ; regional data
>>>>   res at gsnStringFontHeightF     = 0.01
>>>>   res at tiMainString             = ""
>>>>   res at gsnRightString           = ""
>>>>   ;res at mpProjection            = "LambertConformal"
>>>>   ;res at gsnMaskLambertConformal = True
>>>>   res at gsnLeftString            = ""
>>>>   res at mpMaxLatF                = 30;max(lat)  ; zoom in on region
>>>>   res at mpMinLatF                = 15;min(lat)
>>>>   res at mpMinLonF                = 83;min(lon)
>>>>   res at mpMaxLonF                = 97; max(lon)
>>>>   res at mpCenterLonF             = 10                ; def is zero
>>>>   res at mpLandFillColor          = "Transparent"
>>>>   res at cnLevelSelectionMode= "ManualLevels"
>>>>
>>>>   res at cnMinLevelValF      =  -2150.00       ;for bias maps
>>>>   res at cnMaxLevelValF      =  4450;100
>>>>   res at cnLevelSpacingF     = 150 ; 150
>>>>
>>>>   res at lbLabelBarOn         = False
>>>>   res at lbLabelAutoStride   = True
>>>>   ppt3 at _FillValue    = 0.0
>>>>   ppt3 at _FillValue    = -999
>>>>
>>>> plot(0) = gsn_csm_contour_map(wks,ppt3(0,:,:),res)
>>>> plot(1) = gsn_csm_contour_map(wks,ppt4(0,:,:),res)
>>>>
>>>> ;***********************************************************
>>>> ; create panel
>>>> ;***********************************************************
>>>>
>>>> resP                          = True
>>>> resP at gsnFrame                 = False
>>>> resP at gsnMaximize              = True
>>>> resP at gsnPanelLabelBar         = True
>>>> resP at lbLabelFontHeightF       = 0.01
>>>> gsn_panel(wks,plot,(/2,2/),resP)          ; now draw as one plot
>>>>
>>>> end
>>>>
>>>>
>>>> _______________________________________________
>>>> 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/20170125/8f7888a7/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: temp_mean_diff(3).jpg
Type: image/jpeg
Size: 400763 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170125/8f7888a7/attachment-0002.jpg 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: WAH_APHRO_TMEAN_1988_2007_DJF_bias.nc
Type: application/x-netcdf
Size: 13348 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170125/8f7888a7/attachment-0004.nc 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: WAH_APHRO_TMEAN_1988_2007_JJAS_bias.nc
Type: application/x-netcdf
Size: 13352 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170125/8f7888a7/attachment-0005.nc 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: WAH_APHRO_TMEAN_1988_2007_MAM_bias.nc
Type: application/x-netcdf
Size: 13348 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170125/8f7888a7/attachment-0006.nc 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: WAH_APHRO_TMEAN_1988_2007_ON_bias.nc
Type: application/x-netcdf
Size: 13344 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170125/8f7888a7/attachment-0007.nc 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: temp_mean_diff(4).jpg
Type: image/jpeg
Size: 332599 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170125/8f7888a7/attachment-0003.jpg 


More information about the ncl-talk mailing list