Re: panel plot and contour levels

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Fri Mar 21 2014 - 11:59:04 MDT

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 Phillips                                asphilli@ucar.edu
NCAR/Climate and Global Dynamics Division       (303) 497-1726
P.O. Box 3000				
Boulder, CO 80307-3000    http://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 Fri Mar 21 11:59:16 2014

This archive was generated by hypermail 2.1.8 : Fri Mar 21 2014 - 15:49:21 MDT