Re: panel plot and contour levels

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Thu Mar 27 2014 - 18:42:07 MDT

Hi Stephan,
I see two possible issues:
1) You are setting the contour levels for res1 and res2 the same.
2) You are setting various res resources after you pass the res settings
to res1 and res2. Thus, the latter res settings are never passed to res1
and res2, and therefore never used. You should set all res resources
first, then set-up res1 and res2:

res = True
res@gsnMaximize = True
res@gsnAddCyclic = False
res@mpDataBaseVersion = "mediumres"
res@mpOutlineBoundarySets = "national"

res@mpCenterLonF = rotpole@grid_north_pole_longitude
res@mpCenterLatF = rotpole@grid_north_pole_latitude -90
res@cnFillOn = True
res@cnLinesOn = False
res@cnLineLabelsOn = False

res@pmTickMarkDisplayMode = "Always"; use NCL default lat/lon labels
res@mpMinLatF = -23
res@mpMaxLatF = -10
res@mpMinLonF = -72
res@mpMaxLonF = -55
res@mpLimitMode = "latlon"
res@mpLeftCornerLatF = lat2d(0,0)
res@mpLeftCornerLonF = lon2d(0,0)
res@mpRightCornerLatF = lat2d(latsize-1,lonsize-1)
res@mpRightCornerLonF = lon2d(latsize-1,lonsize-1)

res1 = res
res1@cnLevelSelectionMode = "ManualLevels"
res1@cnMinLevelValF = 0
res1@cnMaxLevelValF = 6000
res1@cnLevelSpacingF = 200

res2 = res
res2@cnLevelSelectionMode = "ManualLevels"
res2@cnMinLevelValF = -1500
res2@cnMaxLevelValF = 1500
res2@cnLevelSpacingF = 50

res1@gsnCenterString = "Bolivien Niederschlag 1961-1990"
plot(0) = gsn_csm_contour_map(wks,M,res1)

res2@gsnCenterString = "Absolute Aenderung (1991-2020)-(1961-1990)"
plot(1) = gsn_csm_contour_map(wks,N,res2)

res2@gsnCenterString = "Absolute Aenderung (2021-2050)-(1961-1990)"
plot(2) = gsn_csm_contour_map(wks,O,res2)

res2@gsnCenterString = "Absolute Aenderung (2051-2080)-(1961-1990)"
plot(3) = gsn_csm_contour_map(wks,P,res2)

gsn_panel(wks,plot,(/2,2/),False) ; now draw as one plot

end

Alternatively, you could do away with res1 and res2, and just change the
contour levels in res:

res = True
res@gsnMaximize = True
res@gsnAddCyclic = False
res@mpDataBaseVersion = "mediumres"
res@mpOutlineBoundarySets = "national"

res@mpCenterLonF = rotpole@grid_north_pole_longitude
res@mpCenterLatF = rotpole@grid_north_pole_latitude -90
res@cnFillOn = True
res@cnLinesOn = False
res@cnLineLabelsOn = False

res@pmTickMarkDisplayMode = "Always"; use NCL default lat/lon labels
res@mpMinLatF = -23
res@mpMaxLatF = -10
res@mpMinLonF = -72
res@mpMaxLonF = -55
res@mpLimitMode = "latlon"
res@mpLeftCornerLatF = lat2d(0,0)
res@mpLeftCornerLonF = lon2d(0,0)
res@mpRightCornerLatF = lat2d(latsize-1,lonsize-1)
res@mpRightCornerLonF = lon2d(latsize-1,lonsize-1)

res@cnLevelSelectionMode = "ManualLevels"
res@cnMinLevelValF = 0
res@cnMaxLevelValF = 6000
res@cnLevelSpacingF = 200

res@gsnCenterString = "Bolivien Niederschlag 1961-1990"
plot(0) = gsn_csm_contour_map(wks,M,res)

res@cnMinLevelValF = -1500
res@cnMaxLevelValF = 1500
res@cnLevelSpacingF = 50

res@gsnCenterString = "Absolute Aenderung (1991-2020)-(1961-1990)"
plot(1) = gsn_csm_contour_map(wks,N,res)

res@gsnCenterString = "Absolute Aenderung (2021-2050)-(1961-1990)"
plot(2) = gsn_csm_contour_map(wks,O,res)

res@gsnCenterString = "Absolute Aenderung (2051-2080)-(1961-1990)"
plot(3) = gsn_csm_contour_map(wks,P,res)
gsn_panel(wks,plot,(/2,2/),False) ; now draw as one plot

end

Hope that helps. If not, please respond to the ncl-talk email list.
Adam

On 3/27/14, 4:06 PM, Stephan Herrmann wrote:
>
> Hello Adam,
>
> here is my complete script:
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>
> begin
>
> f =
> addfile("MPIM-REMO_EH5OMA1Br3_HR_044_BOL_1961-1990_142_143_minus_1_hour_mean_30_years.nc","r")
> M=f->var142(0,:,:)
>
> latsize = getfilevardimsizes(f,"rlat")
> lonsize = getfilevardimsizes(f,"rlon")
> rotpole = f->rotated_pole ; need attributes for correct remap
>
> ll = asciiread("ll.out",(/latsize,lonsize,2/),"float")
> lat2d = ll(::,:,0)
> lon2d = ll(::,:,1)
>
> M@lat2d = lat2d
> M@lon2d = lon2d
>
> ;printMinMax(lon2d,0)
> ;printMinMax(lat2d,0)
>
> f =
> addfile("MPIM-REMO_EH5OMA1Br3_HR_044_BOL_1991-2020_minus_1961-1990_142_143_minus_1_hour_mean_30_years.nc","r")
> N=f->var142(0,:,:)
>
> latsize = getfilevardimsizes(f,"rlat")
> lonsize = getfilevardimsizes(f,"rlon")
> rotpole = f->rotated_pole ; need attributes for correct remap
>
> ll = asciiread("ll.out",(/latsize,lonsize,2/),"float")
> lat2d = ll(::,:,0)
> lon2d = ll(::,:,1)
>
> N@lat2d = lat2d
> N@lon2d = lon2d
>
> f =
> addfile("MPIM-REMO_EH5OMA1Br3_HR_044_BOL_2021-2050_minus_1961-1990_142_143_minus_1_hour_mean_30_years.nc","r")
> O=f->var142(0,:,:)
>
> latsize = getfilevardimsizes(f,"rlat")
> lonsize = getfilevardimsizes(f,"rlon")
> rotpole = f->rotated_pole ; need attributes for correct remap
>
> ll = asciiread("ll.out",(/latsize,lonsize,2/),"float")
> lat2d = ll(::,:,0)
> lon2d = ll(::,:,1)
>
> O@lat2d = lat2d
> O@lon2d = lon2d
>
> f =
> addfile("MPIM-REMO_EH5OMA1Br3_HR_044_BOL_2051-2080_minus_1961-1990_142_143_minus_1_hour_mean_30_years.nc","r")
> P=f->var142(0,:,:)
>
> latsize = getfilevardimsizes(f,"rlat")
> lonsize = getfilevardimsizes(f,"rlon")
> rotpole = f->rotated_pole ; need attributes for correct remap
>
> ll = asciiread("ll.out",(/latsize,lonsize,2/),"float")
> lat2d = ll(::,:,0)
> lon2d = ll(::,:,1)
>
> P@lat2d = lat2d
> P@lon2d = lon2d
>
> wks = gsn_open_wks("ps","colour_table_diff_2") ; open a
> ps file
> plot = new(4,graphic) ; create a plot array
>
> gsn_define_colormap(wks,"cb_9step")
>
> res = True
> res@gsnMaximize = True
> res@gsnAddCyclic = False
> res@mpDataBaseVersion = "mediumres"
> res@mpOutlineBoundarySets = "national"
>
> res@mpCenterLonF = rotpole@grid_north_pole_longitude
> res@mpCenterLatF = rotpole@grid_north_pole_latitude -90
> res@cnFillOn = True
> res@cnLinesOn = False
> res@cnLineLabelsOn = False
>
> res1 = res
> res1@cnLevelSelectionMode = "ManualLevels"
> res1@cnMinLevelValF = 0
> res1@cnMaxLevelValF = 6000
> res1@cnLevelSpacingF = 200
>
> res2 = res
> res2@cnLevelSelectionMode = "ManualLevels"
> res2@cnMinLevelValF = 0
> res2@cnMaxLevelValF = 6000
> res2@cnLevelSpacingF = 200
>
> res@pmTickMarkDisplayMode = "Always"; use NCL default lat/lon labels
> res@mpMinLatF = -23
> res@mpMaxLatF = -10
> res@mpMinLonF = -72
> res@mpMaxLonF = -55
> res@mpLimitMode = "latlon"
> res@mpLeftCornerLatF = lat2d(0,0)
> res@mpLeftCornerLonF = lon2d(0,0)
> res@mpRightCornerLatF = lat2d(latsize-1,lonsize-1)
> res@mpRightCornerLonF = lon2d(latsize-1,lonsize-1)
>
> res1@gsnCenterString = "Bolivien Niederschlag 1961-1990"
> plot(0) = gsn_csm_contour_map(wks,M,res1)
>
> res2@gsnCenterString = "Absolute Aenderung (1991-2020)-(1961-1990)"
> plot(1) = gsn_csm_contour_map(wks,N,res2)
>
> res2@gsnCenterString = "Absolute Aenderung (2021-2050)-(1961-1990)"
> plot(2) = gsn_csm_contour_map(wks,O,res2)
>
> res2@gsnCenterString = "Absolute Aenderung (2051-2080)-(1961-1990)"
> plot(3) = gsn_csm_contour_map(wks,P,res2)
>
> gsn_panel(wks,plot,(/2,2/),False) ; now draw as one plot
>
> end
>
> Best regards
>
> Stephan
>
> -----Original-Nachricht-----
>
> Betreff: Re: AW: [ncl-talk] panel plot and contour levels
>
> Datum: Wed, 26 Mar 2014 20:46:48 +0100
>
> Von: Adam Phillips <asphilli@ucar.edu>
>
> An: Stephan Herrmann <stephan.w.herrmann@t-online.de>,
> "ncl-talk@ucar.edu" <ncl-talk@ucar.edu>
>
> Hi Stephan,
> Assuming you changed your script as I advised, I am puzzled as to how
> you are getting the error messages that you reported. Can you send the
> ncl-talk email list your complete script so everyone can take a look?
> Thanks,
> Adam
>
> On 03/26/2014 09:15 AM, Stephan Herrmann wrote:
>
> Hello Adam,
>
> your solution does not work. The following error messages occur:
>
> warning:PlotManagerSetValues: TickMark annotation cannot be added
> after NhlCreate
> warning:gsnCenterString is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpLimitMode is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpMinLonF is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpMaxLonF is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpMinLatF is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpMaxLatF is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpCenterLonF is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpLeftCornerLonF is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpRightCornerLonF is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpLeftCornerLatF is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpRightCornerLatF is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpCenterLatF is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:gsnAddCyclic is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpDataBaseVersion is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpOutlineBoundarySets is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:sfXArray is not a valid resource in map at this time
> warning:sfYArray is not a valid resource in map at this time
> warning:cnFillOn is not a valid resource in map at this time
> warning:cnInfoLabelOn is not a valid resource in map at this time
> warning:cnLineLabelsOn is not a valid resource in map at this time
> warning:cnLevelSelectionMode is not a valid resource in map at
> this time
> warning:cnMinLevelValF is not a valid resource in map at this time
> warning:cnMaxLevelValF is not a valid resource in map at this time
> warning:cnLevelSpacingF is not a valid resource in map at this time
> warning:gsnAddCyclic is not a valid resource in map at this time
> warning:cnLineLabelBackgroundColor is not a valid resource in map
> at this time
> warning:cnLinesOn is not a valid resource in map at this time
> warning:PlotManagerSetValues: TickMark annotation cannot be added
> after NhlCreate
> warning:tmXBBorderOn is not a valid resource in
> colour_table_diff_2_contour.PlotManager at this time
> warning:tmXBOn is not a valid resource in
> colour_table_diff_2_contour.PlotManager at this time
> warning:tmXTBorderOn is not a valid resource in
> colour_table_diff_2_contour.PlotManager at this time
> warning:tmXTOn is not a valid resource in
> colour_table_diff_2_contour.PlotManager at this time
> warning:tmYLBorderOn is not a valid resource in
> colour_table_diff_2_contour.PlotManager at this time
> warning:tmYLOn is not a valid resource in
> colour_table_diff_2_contour.PlotManager at this time
> warning:tmYRBorderOn is not a valid resource in
> colour_table_diff_2_contour.PlotManager at this time
> warning:tmYROn is not a valid resource in
> colour_table_diff_2_contour.PlotManager at this time
> warning:gsnTickMarksPointOutward is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:gsnCenterString is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpLimitMode is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpMinLonF is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpMaxLonF is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpMinLatF is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpMaxLatF is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpCenterLonF is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpLeftCornerLonF is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpRightCornerLonF is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpLeftCornerLatF is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpRightCornerLatF is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpCenterLatF is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpOutlineOn is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:gsnAddCyclic is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpDataBaseVersion is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpOutlineBoundarySets is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:sfXArray is not a valid resource in map at this time
> warning:sfYArray is not a valid resource in map at this time
> warning:cnFillOn is not a valid resource in map at this time
> warning:cnInfoLabelOn is not a valid resource in map at this time
> warning:cnLineLabelsOn is not a valid resource in map at this time
> warning:cnLevelSelectionMode is not a valid resource in map at
> this time
> warning:cnMinLevelValF is not a valid resource in map at this time
> warning:cnMaxLevelValF is not a valid resource in map at this time
> warning:cnLevelSpacingF is not a valid resource in map at this time
> warning:gsnAddCyclic is not a valid resource in map at this time
> warning:cnLineLabelBackgroundColor is not a valid resource in map
> at this time
> warning:cnLinesOn is not a valid resource in map at this time
> warning:PlotManagerSetValues: TickMark annotation cannot be added
> after NhlCreate
> warning:tmXBBorderOn is not a valid resource in
> colour_table_diff_2_contour.PlotManager at this time
> warning:tmXBOn is not a valid resource in
> colour_table_diff_2_contour.PlotManager at this time
> warning:tmXTBorderOn is not a valid resource in
> colour_table_diff_2_contour.PlotManager at this time
> warning:tmXTOn is not a valid resource in
> colour_table_diff_2_contour.PlotManager at this time
> warning:tmYLBorderOn is not a valid resource in
> colour_table_diff_2_contour.PlotManager at this time
> warning:tmYLOn is not a valid resource in
> colour_table_diff_2_contour.PlotManager at this time
> warning:tmYRBorderOn is not a valid resource in
> colour_table_diff_2_contour.PlotManager at this time
> warning:tmYROn is not a valid resource in
> colour_table_diff_2_contour.PlotManager at this time
> warning:gsnTickMarksPointOutward is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:gsnCenterString is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpLimitMode is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpMinLonF is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpMaxLonF is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpMinLatF is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpMaxLatF is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpCenterLonF is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpLeftCornerLonF is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpRightCornerLonF is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpLeftCornerLatF is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpRightCornerLatF is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpCenterLatF is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpOutlineOn is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:gsnAddCyclic is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpDataBaseVersion is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpOutlineBoundarySets is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:sfXArray is not a valid resource in map at this time
> warning:sfYArray is not a valid resource in map at this time
> warning:cnFillOn is not a valid resource in map at this time
> warning:cnInfoLabelOn is not a valid resource in map at this time
> warning:cnLineLabelsOn is not a valid resource in map at this time
> warning:cnLevelSelectionMode is not a valid resource in map at
> this time
> warning:cnMinLevelValF is not a valid resource in map at this time
> warning:cnMaxLevelValF is not a valid resource in map at this time
> warning:cnLevelSpacingF is not a valid resource in map at this time
> warning:gsnAddCyclic is not a valid resource in map at this time
> warning:cnLineLabelBackgroundColor is not a valid resource in map
> at this time
> warning:cnLinesOn is not a valid resource in map at this time
> warning:PlotManagerSetValues: TickMark annotation cannot be added
> after NhlCreate
> warning:tmXBBorderOn is not a valid resource in
> colour_table_diff_2_contour.PlotManager at this time
> warning:tmXBOn is not a valid resource in
> colour_table_diff_2_contour.PlotManager at this time
> warning:tmXTBorderOn is not a valid resource in
> colour_table_diff_2_contour.PlotManager at this time
> warning:tmXTOn is not a valid resource in
> colour_table_diff_2_contour.PlotManager at this time
> warning:tmYLBorderOn is not a valid resource in
> colour_table_diff_2_contour.PlotManager at this time
> warning:tmYLOn is not a valid resource in
> colour_table_diff_2_contour.PlotManager at this time
> warning:tmYRBorderOn is not a valid resource in
> colour_table_diff_2_contour.PlotManager at this time
> warning:tmYROn is not a valid resource in
> colour_table_diff_2_contour.PlotManager at this time
> warning:gsnTickMarksPointOutward is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:gsnCenterString is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpLimitMode is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpMinLonF is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpMaxLonF is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpMinLatF is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpMaxLatF is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpCenterLonF is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpLeftCornerLonF is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpRightCornerLonF is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpLeftCornerLatF is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpRightCornerLatF is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpCenterLatF is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpOutlineOn is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:gsnAddCyclic is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpDataBaseVersion is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:mpOutlineBoundarySets is not a valid resource in
> colour_table_diff_2_contour at this time
> warning:sfXArray is not a valid resource in map at this time
> warning:sfYArray is not a valid resource in map at this time
> warning:cnFillOn is not a valid resource in map at this time
> warning:cnInfoLabelOn is not a valid resource in map at this time
> warning:cnLineLabelsOn is not a valid resource in map at this time
> warning:cnLevelSelectionMode is not a valid resource in map at
> this time
> warning:cnMinLevelValF is not a valid resource in map at this time
> warning:cnMaxLevelValF is not a valid resource in map at this time
> warning:cnLevelSpacingF is not a valid resource in map at this time
> warning:gsnAddCyclic is not a valid resource in map at this time
> warning:cnLineLabelBackgroundColor is not a valid resource in map
> at this time
> warning:cnLinesOn is not a valid resource in map at this time
>
> Best regards
>
> Stephan
>
> -----Original-Nachricht-----
>
> Betreff: Re: [ncl-talk] panel plot and contour levels
>
> Datum: Fri, 21 Mar 2014 18:59:12 +0100
>
> Von: Adam Phillips <asphilli@ucar.edu>
>
> An: Stephan Herrmann <stephan.w.herrmann@t-online.de>,
> ncl-talk@ucar.edu
>
> Hi Stephan,
> In your example code you specify three different resource lists:
> res, res1, and res2.. Your contour levels are set up in res1 and
> res2, but your map, draw, frame and title resources are set using
> res.. Try this, keeping your res resource list as it is..
>
> res1 = res
>
> res1@cnLevelSelectionMode = "ManualLevels"
> res1@cnMinLevelValF = 0
> res1@cnMaxLevelValF = 6000
> res1@cnLevelSpacingF = 200
>
> res2 = res
>
> res2@cnLevelSelectionMode = "ManualLevels"
> res2@cnMinLevelValF = -1500
> res2@cnMaxLevelValF = 1500
> res2@cnLevelSpacingF = 50
>
> res1@gsnCenterString = "Bolivien Niederschlag 1961-1990"
> plot(0) = gsn_csm_contour_map(wks,M,res1)
>
> res2@gsnCenterString = "Absolute Aenderung (1991-2020)-(1961-1990)"
> plot(1) = gsn_csm_contour_map(wks,N,res2)
>
> res2@gsnCenterString = "Absolute Aenderung (2021-2050)-(1961-1990)"
> plot(2) = gsn_csm_contour_map(wks,O,res2)
>
> res2@gsnCenterString = "Absolute Aenderung (2051-2080)-(1961-1990)"
> plot(3) = gsn_csm_contour_map(wks,P,res2)
>
> gsn_panel(wks,plot,(/2,2/),False) ; now draw as one plot
>
>
> If the above does not help, or if you have any further questions,
> please respond to the ncl-talk email list..
> Adam
>
> On 03/21/2014 09:27 AM, Stephan Herrmann wrote:
>
> Hello everybody,
>
> I created a panel plot with the following NCL code:
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>
> begin
>
> f = addfile("MPIM-REMO_EH5OMA1Br3_HR_044_BOL_1961-1990_142_143_minus_1_hour_mean_30_years.nc","r")
> M=f->var142(0,:,:)
>
> latsize = getfilevardimsizes(f,"rlat")
> lonsize = getfilevardimsizes(f,"rlon")
> rotpole = f->rotated_pole ; need attributes for correct remap
>
> ll = asciiread("ll.out",(/latsize,lonsize,2/),"float")
> lat2d = ll(::,:,0)
> lon2d = ll(::,:,1)
>
> M@lat2d = lat2d
> M@lon2d = lon2d
>
> ;printMinMax(lon2d,0)
> ;printMinMax(lat2d,0)
>
> f = addfile("MPIM-REMO_EH5OMA1Br3_HR_044_BOL_1991-2020_minus_1961-1990_142_143_minus_1_hour_mean_30_years.nc","r")
> N=f->var142(0,:,:)
>
> latsize = getfilevardimsizes(f,"rlat")
> lonsize = getfilevardimsizes(f,"rlon")
> rotpole = f->rotated_pole ; need attributes for correct remap
>
> ll = asciiread("ll.out",(/latsize,lonsize,2/),"float")
> lat2d = ll(::,:,0)
> lon2d = ll(::,:,1)
>
> N@lat2d = lat2d
> N@lon2d = lon2d
>
> f = addfile("MPIM-REMO_EH5OMA1Br3_HR_044_BOL_2021-2050_minus_1961-1990_142_143_minus_1_hour_mean_30_years.nc","r")
> O=f->var142(0,:,:)
>
> latsize = getfilevardimsizes(f,"rlat")
> lonsize = getfilevardimsizes(f,"rlon")
> rotpole = f->rotated_pole ; need attributes for correct remap
>
> ll = asciiread("ll.out",(/latsize,lonsize,2/),"float")
> lat2d = ll(::,:,0)
> lon2d = ll(::,:,1)
>
> O@lat2d = lat2d
> O@lon2d = lon2d
>
> f = addfile("MPIM-REMO_EH5OMA1Br3_HR_044_BOL_2051-2080_minus_1961-1990_142_143_minus_1_hour_mean_30_years.nc","r")
> P=f->var142(0,:,:)
>
> latsize = getfilevardimsizes(f,"rlat")
> lonsize = getfilevardimsizes(f,"rlon")
> rotpole = f->rotated_pole ; need attributes for correct remap
>
> ll = asciiread("ll.out",(/latsize,lonsize,2/),"float")
> lat2d = ll(::,:,0)
> lon2d = ll(::,:,1)
>
> P@lat2d = lat2d
> P@lon2d = lon2d
>
> wks = gsn_open_wks("ps","colour_table_diff") ; open a ps file
> plot = new(4,graphic) ; create a plot array
>
> gsn_define_colormap(wks,"cb_9step")
>
> res = True
> res@gsnMaximize = True
> res@gsnAddCyclic = False
> res@mpDataBaseVersion = "mediumres"
> res@mpOutlineBoundarySets = "national"
>
> res@mpCenterLonF = rotpole@grid_north_pole_longitude
> res@mpCenterLatF = rotpole@grid_north_pole_latitude -90
> res@cnFillOn = True
> res@cnLinesOn = False
> res@cnLineLabelsOn = False
>
> ;res@cnLevelSelectionMode = "ManualLevels"
> ;res@cnMinLevelValF = 0
> ;res@cnMaxLevelValF = 6000
> ;res@cnLevelSpacingF = 200
>
> res@pmTickMarkDisplayMode = "Always"; use NCL default lat/lon labels
> res@mpMinLatF = -23
> res@mpMaxLatF = -10
> res@mpMinLonF = -72
> res@mpMaxLonF = -55
> res@mpLimitMode = "latlon"
> res@mpLeftCornerLatF = lat2d(0,0)
> res@mpLeftCornerLonF = lon2d(0,0)
> res@mpRightCornerLatF = lat2d(latsize-1,lonsize-1)
> res@mpRightCornerLonF = lon2d(latsize-1,lonsize-1)
>
> res@gsnCenterString = "Bolivien Niederschlag 1961-1990"
> plot(0) = gsn_csm_contour_map(wks,M,res)
>
> res@gsnCenterString = "Absolute Aenderung (1991-2020)-(1961-1990)"
> plot(1) = gsn_csm_contour_map(wks,N,res)
>
> res@gsnCenterString = "Absolute Aenderung (2021-2050)-(1961-1990)"
> plot(2) = gsn_csm_contour_map(wks,O,res)
>
> res@gsnCenterString = "Absolute Aenderung (2051-2080)-(1961-1990)"
> plot(3) = gsn_csm_contour_map(wks,P,res)
>
> gsn_panel(wks,plot,(/2,2/),False) ; now draw as one plot
>
> end
>
> Now I want to change the contour levels for each plot in a different way. I tried this in the following way:
>
> res1 = True
>
> res1@cnLevelSelectionMode = "ManualLevels"
> res1@cnMinLevelValF = 0
> res1@cnMaxLevelValF = 6000
> res1@cnLevelSpacingF = 200
>
> res2 = True
>
> res2@cnLevelSelectionMode = "ManualLevels"
> res2@cnMinLevelValF = -1500
> res2@cnMaxLevelValF = 1500
> res2@cnLevelSpacingF = 50
>
> res@gsnCenterString = "Bolivien Niederschlag 1961-1990"
> plot(0) = gsn_csm_contour_map(wks,M,res1)
>
> res@gsnCenterString = "Absolute Aenderung (1991-2020)-(1961-1990)"
> plot(1) = gsn_csm_contour_map(wks,N,res2)
>
> res@gsnCenterString = "Absolute Aenderung (2021-2050)-(1961-1990)"
> plot(2) = gsn_csm_contour_map(wks,O,res2)
>
> res@gsnCenterString = "Absolute Aenderung (2051-2080)-(1961-1990)"
> plot(3) = gsn_csm_contour_map(wks,P,res2)
>
> gsn_panel(wks,plot,(/2,2/),False) ; now draw as one plot
>
> But this don't work. What am I doing wrong?
>
> Attachment:
>
> - graphic: panel_plot.png
> - file: MPIM-REMO_EH5OMA1Br3_HR_044_BOL_1961-1990_142_143_minus_1_hour_mean_30_years.nc
> - file: MPIM-REMO_EH5OMA1Br3_HR_044_BOL_1991-2020_minus_1961-1990_142_143_minus_1_hour_mean_30_years.nc
> - file: MPIM-REMO_EH5OMA1Br3_HR_044_BOL_2021-2050_minus_1961-1990_142_143_minus_1_hour_mean_30_years.nc
> - file: MPIM-REMO_EH5OMA1Br3_HR_044_BOL_2051-2080_minus_1961-1990_142_143_minus_1_hour_mean_30_years.nc
>
>
> Best regards
>
> Stephan
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
> --
> ______________________________________________________________
> Adam Phillipsasphilli@ucar.edu
> NCAR/Climate and Global Dynamics Division (303) 497-1726
> P.O. Box 3000
> Boulder, CO 80307-3000http://www.cgd.ucar.edu/staff/asphilli
>
>
> --
> ______________________________________________________________
> Adam Phillipsasphilli@ucar.edu
> NCAR/Climate and Global Dynamics Division (303) 497-1726
> P.O. Box 3000
> Boulder, CO 80307-3000http://www.cgd.ucar.edu/staff/asphilli

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Mar 27 18:42:22 2014

This archive was generated by hypermail 2.1.8 : Mon Mar 31 2014 - 11:47:09 MDT