Dear Mary,
It worked out well. Many thanks.
-Ibo
________________________________
From: Mary Haley <haley@ucar.edu>
To: Ibo Ze <ibo85@ymail.com>
Cc: Ncl Talk <ncl-talk@ucar.edu>
Sent: Mon, May 3, 2010 3:06:50 PM
Subject: Re: Single color panel plots output
Okay, I see the problem.
You are looping across "5,7" and opening up a different file every time, but then you close the loop without doing anything with the files you opened.
Try something like this (UNTESTED). You probably want to change the "tiMainString" resource to something different each time through the loop.
--Mary
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"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
begin
;
; Open first file to get "x2" values.
;
f2 = addfile("6104_pk_june_avg.nc","r")
x2 = f2->a
;
; Set up some of the graphics code.
;
wks = gsn_open_wks ("x11","pksec_pk_06_panel") ; open ps file
gsn_define_colormap(wks,"Radar")
res = True
res@gsnDraw = False ; Don't draw plots
res@gsnFrame = False ; Don't advance frames
res@cnFillOn = True
res@cnLinesOn = False
res@mpOutlineBoundarySets = "AllBoundaries"
res@mpDataBaseVersion = "MediumRes"
res@mpDataSetName = "Earth..3"
res@mpOutlineOn = True
res@mpFillOn = False
res@mpMaxLatF = 37
res@mpMinLatF = 7
res@mpMaxLonF = 125
res@mpMinLonF = 60
res@cnLevelSelectionMode = "ManualLevels" ; manually set cn levels
res@cnMinLevelValF = -1. ; min level
res@cnMaxLevelValF = 1. ; max level
res@cnLevelSpacingF = .25 ; contour level spacing
res@tiMainFontHeightF = 0.03
res@gsnAddCyclic = False
;
; Loop across three different files, read the data, and
; create a plot.
;
plot = new(3,graphic)
do i = 0,1
j = i+5
filename = "6104_pksec_"+sprinti("%0.2i",j)+".nc"
print(filename)
f1 = addfile(filename,"r")
x1 = f1->a(lat|:,lon|:,time|:)
x1!0 = "lat"
x1!1 = "lon"
x1&lat@units = "degrees_north"
x1&lon@units = "degrees_east"
c = escorc(x2,x1)
copy_VarCoords(x1,c)
res@tiMainString = "Some title to distinguish each plot"
plot(i) = gsn_csm_contour_map_ce(wks,c,res)
delete(c) ; This will not be needed if your data
delete(x1) ; is the same size and type every time.
end do
pres = True ; Set panel resources
pres@gsmMaximize = True ; Maximize plots in panel
pres@gsnPanelLabelBar = True ; Turn on panel labelbal
pres@pmLabelBarWidthF = 0.8 ; Change labelbar width
gsn_panel(wks,plot,(/3,1/),pres)
end
On May 3, 2010, at 1:30 PM, Ibo Ze wrote:
Hi Mary,
>
>
>I am trying to do panel plot with 3 separate maps in the same window. You are right i am getting the same plot three times (no error message) but i have three different files to display (f2 correlation at 0 with three different f1 files). Still unable to figure out the problem. I appreciate your help. Thanks.
>The script i am using is as below:
>
>
>
>
>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"
>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
> do i =5,7
> filename = "6104_pksec_"+sprinti("%0.2i",i)+".nc"
> print(filename)
> f1 = addfile(filename,"r")
> end do
> f1 = addfile("6104_pksec_05.nc","r")
> f2 = addfile("6104_pk_june_avg.nc","r")
> x1 = f1->a(lat|:,lon|:,time|:)
> print(min(x1))
> print(max(x1))
> x2 = f2->a
> print(min(x2))
> print(max(x2))
> x1!0="lat"
> x1!1="lon"
> x1&lat@units="degrees_north"
> x1&lon@units="degrees_east"
> c = escorc(x2,x1)
> copy_VarCoords(x1,c)
> print(min(c))
> print(max(c))
> printVarSummary(c)
> wks = gsn_open_wks ("x11","pksec_pk_06_panel") ; open ps file
> plot = new(3,graphic)
> gsn_define_colormap(wks,"Radar")
> res = True
> resP = True
> res@gsnDraw = False ; Don't draw plots
> res@gsnFrame = False ; Don't advance frames
> res@cnFillOn = True
> res@cnLinesOn = False
> res@mpOutlineBoundarySets = "AllBoundaries"
> res@mpDataBaseVersion = "MediumRes"
> res@mpDataSetName = "Earth..3"
> res@mpOutlineOn = True
> res@mpFillOn = False
> res@mpMaxLatF = 37
> res@mpMinLatF = 7
> res@mpMaxLonF = 125
> res@mpMinLonF = 60
> res@cnLevelSelectionMode = "ManualLevels" ; manually set cn levels
> res@cnMinLevelValF = -1. ; min level
> res@cnMaxLevelValF = 1. ; max level
> res@cnLevelSpacingF = .25 ; contour level spacing
> res@tiMainFontHeightF = 0.03
> res@gsnAddCyclic = False
>
>
> do i=0,2
> plot(i) = gsn_csm_contour_map_ce(wks,c,res)
> end do
> pres = True ; Set panel resources
> pres@gsmMaximize = True ; Maximize plots in panel
> pres@gsnPanelLabelBar = True ; Turn on panel labelbal
> pres@pmLabelBarWidthF = 0.8 ; Change labelbar width
>
>
> gsn_panel(wks,plot,(/3,1/),pres)
>
>
>
>
>
________________________________
From: Mary Haley <haley@ucar.edu>
>To: Ibo Ze <ibo85@ymail.com>
>Cc: Ncl Talk <ncl-talk@ucar.edu>
>Sent: Mon, May 3, 2010 11:33:41 AM
>Subject: Re: Single color panel plots output
>
>
>
>
>If you are getting an error message, please include the full error message in your email.
>
>
>Are you asking about what to do with this code?
>
>
> do i=0,2
>>>> plot(i) = gsn_csm_contour_map_ce(wks,c,res)
>>>> end do
>
>According to your print statements below "c" is two-dimensional, so
>it doesn't make sense to loop three times and create the same plot
>over and over.
>
>
>Please give us more information about what you are trying to do.
>
>
>Thanks,
>
>
>--Mary
>
>
>On May 1, 2010, at 3:41 AM, Ibo Ze wrote:
>
>Hi Mary,
>>
>>
>>I was using "BlWhRe" color plate. The variance in plots were confined to from -0.5 to -0.25, the reason being only single color. When i defined my own four colors with custom ranges it worked fine. The only problem i have is to loop files at f1. Can you please look into it and suggest what is wrong. Thanks.
>>The full script is as follows:
>>
>>
>>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"
>>>>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
>>>> do i =5,7
>>>> filename = "6104_pksec_"+sprinti("%0.2i",i)+".nc"
>>>> print(filename)
>>>> f1 = addfile(filename,"r")
>>>> end do
>>>>
>>>>
>>>> f1 = addfile("6104_pksec_05.nc","r")
>>>> f2 = addfile("6104_pk_june_avg.nc","r")
>>>> x1 = f1->a(lat|:,lon|:,time|:)
>>>> x2 = f2->a
>>>> x1!0="lat"
>>>> x1!1="lon"
>>>> x1&lat@units="degrees_north"
>>>> x1&lon@units="degrees_east"
>>>> c = escorc(x2,x1)
>>>> copy_VarCoords(x1,c)
>>>> printVarSummary(c)
>>>>
>>>>
>>>> wks = gsn_open_wks ("x11","pksec_pk_06_panel") ; open ps file
>>>> plot = new(3,graphic)
>>>> gsn_define_colormap(wks,"BlWhRe")
>>>> res = True
>>>> resP = True
>>>> res@gsnDraw = False ; Don't draw plots
>>>> res@gsnFrame = False ; Don't advance frames
>>>> res@cnFillOn = True
>>>> res@cnLinesOn = False
>>>>
>>>>
>>>> res@mpOutlineBoundarySets = "AllBoundaries"
>>>> res@mpDataBaseVersion = "MediumRes"
>>>> res@mpDataSetName = "Earth..3"
>>>> res@mpOutlineOn = True
>>>> res@mpFillOn = False
>>>> res@mpMaxLatF = 37
>>>> res@mpMinLatF = 7
>>>> res@mpMaxLonF = 125
>>>> res@mpMinLonF = 60
>>>>
>>>>
>>>> res@cnLevelSelectionMode = "ManualLevels" ; manually set cn levels
>>>> res@cnMinLevelValF = -1. ; min level
>>>> res@cnMaxLevelValF = 1. ; max level
>>>> res@cnLevelSpacingF = .25 ; contour level spacing
>>>> res@tiMainFontHeightF = 0.03
>>>> res@gsnAddCyclic = False
>>>> do i=0,2
>>>> plot(i) = gsn_csm_contour_map_ce(wks,c,res)
>>>> end do
>>>>
>>>>
>>>> pres = True ; Set panel resources
>>>> pres@gsmMaximize = True ; Maximize plots in panel
>>>> pres@gsnPanelLabelBar = True ; Turn on panel labelbal
>>>> pres@pmLabelBarWidthF = 0.8 ; Change labelbar width
>>>>
>>>>
>>>> gsn_panel(wks,plot,(/3,1/),pres)
>>
>>>
>>
>>
>>
________________________________
From: Mary Haley <haley@ucar.edu>
>>To: Ibo Ze <ibo85@ymail.com>
>>Cc: Ncl Talk <ncl-talk@ucar.edu>
>>Sent: Fri, April 30, 2010 10:06:49 AM
>>Subject: Re: Single color panel plots output
>>
>>Your values seem to look okay, but I'm not sure which values below correspond to which of your
>>variables.
>>
>>
>>Can you give me your full script and data so I can run it here?
>>
>>
>>Please see:
>>
>>
>>http://www.ncl.ucar.edu/report_bug.shtml
>>
>>
>>for information on where to put the files.
>>
>>
>>Thanks,
>>
>>
>>--Mary
>>
>>
>>On Apr 29, 2010, at 9:45 AM, Ibo Ze wrote:
>>
>>Hi Mary,
>>>
>>>
>>>You are right. I think am missing something in first few lines of script. The following output i got for x1 and c using print:
>>>
>>>
>>>
>>>
>>>Variable: filename
>>>Type: string
>>>Total Size: 8 bytes
>>> 1 values
>>>Number of Dimensions: 1
>>>Dimensions and sizes: [1]
>>>Coordinates:
>>>(0) 6104_pksec_05.nc
>>>
>>>
>>>
>>>
>>>Variable: filename
>>>Type: string
>>>Total Size: 8 bytes
>>> 1 values
>>>Number of Dimensions: 1
>>>Dimensions and sizes: [1]
>>>Coordinates:
>>>(0) 6104_pksec_06.nc
>>>
>>>
>>>
>>>
>>>Variable: filename
>>>Type: string
>>>Total Size: 8 bytes
>>> 1 values
>>>Number of Dimensions: 1
>>>Dimensions and sizes: [1]
>>>Coordinates:
>>>(0) 6104_pksec_07.nc
>>>(0) 0
>>>(0) 62.79183
>>>(0) 0.1176416
>>>(0) 1.319832
>>>(0) -0.3797857
>>>(0) 0.529642
>>>
>>>
>>>Variable: c
>>>Type: float
>>>Total Size: 124800 bytes
>>> 31200 values
>>>Number of Dimensions: 2
>>>Dimensions and sizes: [lat | 120] x [lon | 260]
>>>Coordinates:
>>> lat: [7.125..36.875]
>>> lon: [60.125..124.875]
>>>Number Of Attributes: 1
>>> _FillValue : -999
>>>
>>>
>>>
________________________________
From: Mary Haley <haley@ucar.edu>
>>>To: Ibo Ze <ibo85@ymail.com>
>>>Cc: Ncl Talk <ncl-talk@ucar.edu>
>>>Sent: Thu, April 29, 2010 7:18:20 AM
>>>Subject: Re: Single color panel plots output
>>>
>>>Hi,
>>>
>>>
>>>A single color color plot may happen if you have a data field that is all equal to one value.
>>>
>>>
>>>Look at your "c" array. What do the values look like?
>>>
>>>
>>>print(min(c))
>>>print(max(c))
>>>
>>>
>>>You may want to do the same for x1 and x2, to make sure what you read off the files is correct.
>>>
>>>
>>>--Mary
>>>
>>>
>>>On Apr 29, 2010, at 1:42 AM, Ibo Ze wrote:
>>>
>>>Hi,
>>>>
>>>>
>>>>I am doing cross-correlation and getting single color output panel plots. The immediate cause is not apparent to me. Can anyone please help to rectify this. Thanks.
>>>>Script is as follows:
>>>>
>>>>
>>>>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"
>>>>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
>>>> do i =5,7
>>>> filename = "6104_pksec_"+sprinti("%0.2i",i)+".nc"
>>>> print(filename)
>>>> f1 = addfile(filename,"r")
>>>> end do
>>>>
>>>>
>>>> f1 = addfile("6104_pksec_05.nc","r")
>>>> f2 = addfile("6104_pk_june_avg.nc","r")
>>>> x1 = f1->a(lat|:,lon|:,time|:)
>>>> x2 = f2->a
>>>> x1!0="lat"
>>>> x1!1="lon"
>>>> x1&lat@units="degrees_north"
>>>> x1&lon@units="degrees_east"
>>>> c = escorc(x2,x1)
>>>> copy_VarCoords(x1,c)
>>>> printVarSummary(c)
>>>>
>>>>
>>>> wks = gsn_open_wks ("x11","pksec_pk_06_panel") ; open ps file
>>>> plot = new(3,graphic)
>>>> gsn_define_colormap(wks,"BlWhRe")
>>>> res = True
>>>> resP = True
>>>> res@gsnDraw = False ; Don't draw plots
>>>> res@gsnFrame = False ; Don't advance frames
>>>> res@cnFillOn = True
>>>> res@cnLinesOn = False
>>>>
>>>>
>>>> res@mpOutlineBoundarySets = "AllBoundaries"
>>>> res@mpDataBaseVersion = "MediumRes"
>>>> res@mpDataSetName = "Earth..3"
>>>> res@mpOutlineOn = True
>>>> res@mpFillOn = False
>>>> res@mpMaxLatF = 37
>>>> res@mpMinLatF = 7
>>>> res@mpMaxLonF = 125
>>>> res@mpMinLonF = 60
>>>>
>>>>
>>>> res@cnLevelSelectionMode = "ManualLevels" ; manually set cn levels
>>>> res@cnMinLevelValF = -1. ; min level
>>>> res@cnMaxLevelValF = 1. ; max level
>>>> res@cnLevelSpacingF = .25 ; contour level spacing
>>>> res@tiMainFontHeightF = 0.03
>>>> res@gsnAddCyclic = False
>>>> do i=0,2
>>>> plot(i) = gsn_csm_contour_map_ce(wks,c,res)
>>>> end do
>>>>
>>>>
>>>> pres = True ; Set panel resources
>>>> pres@gsmMaximize = True ; Maximize plots in panel
>>>> pres@gsnPanelLabelBar = True ; Turn on panel labelbal
>>>> pres@pmLabelBarWidthF = 0.8 ; Change labelbar width
>>>>
>>>>
>>>> gsn_panel(wks,plot,(/3,1/),pres)
>>>>
>>>>
>>>>_______________________________________________
>>>>ncl-talk mailing list
>>>>List instructions, subscriber options, unsubscribe:
>>>>http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>
>>>
>>>_______________________________________________
>>>ncl-talk mailing list
>>>List instructions, subscriber options, unsubscribe:
>>>http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>
>>
>>
>
>_______________________________________________
>ncl-talk mailing list
>List instructions, subscriber options, unsubscribe:
>http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
Received on Tue May 4 00:24:29 2010
This archive was generated by hypermail 2.1.8 : Fri May 07 2010 - 10:36:00 MDT