Hi,
I have tried executing my NCL code below inorder to generate multiple graphs of Temperature versus Pressure and Salinity versus Pressure but it generating error as "missing value as input, can't continue". Can anyone please help me out on this one. The code are given 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"
;************************************************
begin
;************************************************
; get list of files
;************************************************
diri = "pacific-12-2012/pacific/2012/12/" ; input directory
fili = systemfunc("cd "+diri+" ; ls nodc_D5902072*nc")..................................is this statement correct?...because over here am trying to call 3 profiles from one float and merge the graph, but am not sure is this the valid code?
print(fili)
nfili = dimsizes(fili)
;************************************************
; plot resources
;************************************************
res = True ; plot mods desired
res@trYReverse = True ; reverse Y-axis
res@xyLineThicknessF = 2 ; choose dash patterns
res@gsnDraw = False
res@gsnFrame = False
resP = True
resP@gsnMaximize = True
plot = new (2, "graphic")
plot1 = new(nfili,"graphic")
plot2 = plot
do nf=0,nfili-1
f = addfile (diri+fili(nf),"r")
t = f->temperature(0,:,0,0)
s = f->salinity(0,:,0,0)
sfx = get_file_suffix(fili(nf),0)
pname = sfx@fBase
wks = gsn_open_wks ("ps",pname)
res@xyLineColor = (/"blue"/)
plot1(nf) = gsn_csm_xy (wks,t,t&pressure,res) ; create plot
res@xyLineColor = (/"red"/)
plot2(nf) = gsn_csm_xy (wks,s,s&pressure,res) ; create plot
if (nf.ne.0) then
overlay(plot1(0),plot1(nf))
overlay(plot2(0),plot2(nf)) .................Error occurs in these lines!!!!
end if
delete([/t,s/])
end do
resP@txString = fili(nf)
gsn_panel(wks,(/plot1(0),plot2(0)/),(/2,1/),resP)
end
Thanks
Sachin.
From: ncl-talk-bounces@ucar.edu [mailto:ncl-talk-bounces@ucar.edu] On Behalf Of Adam Phillips
Sent: Wednesday, April 24, 2013 9:51 AM
To: ncl-talk@ucar.edu
Subject: Re: Request
Hello,
I think you are close. You are currently reading in each file and plotting each separately. I think you need to save each plot and use the overlay procedure to overlay them onto the first set of plots. Try this:
wks = gsn_open_wks ("ps",pname)
color1 = (/"blue","steelblue1","royalblue4"/) ; set these to whatever you would like
color2 = (/"red","sienna1","firebrick"/) ; http://www.ncl.ucar.edu/Document/Graphics/named_colors.shtml
plot1 = new(nfili,graphic)
plot2 = plot
do nf=0,nfili-1
f = addfile (diri+fili(nf),"r")
t = f->temperature(0,:,0,0)
s = f->salinity(0,:,0,0)
sfx = get_file_suffix(fili(nf),0)
pname = sfx@fBase
res@xyLineColor = color1(nf)
plot1(nf) = gsn_csm_xy (wks,t,t&pressure,res) ; create plot
res@xyLineColor = color2(nf)
plot2(nf) = gsn_csm_xy (wks,s,s&pressure,res) ; create plot
if (nf.ne.0) then
overlay(plot1(0),plot1(nf))
overlay(plot2(0),plot2(nf))
end if
delete([/t,s/])
end do
resP@txString = fili(nf)
gsn_panel(wks,(/plot1(0),plot2(0)/),(/2,1/),resP)
(untested)
If that does not help, or if you have further questions, please respond to ncl-talk.
Adam
On 04/23/2013 03:28 PM, nand_s wrote:
Hello,
I was working with ARGO dataset and I was able to project graphs of Temperature versus Pressure and Practical Salinity versus Pressure with the help of the code which is attached in this mail as "argo.ncl" and currently am trying to merge three separate graphs of one ARGO Float into one XY plot and am finding it difficult to do the coding of it. I tried my best but still am not able to get it done. The one of the images for the graphs of the particular float of the attached dataset is attached with this mail.
Can you please help me out with the functions needed to merge the graphs because am still the beginner and self learner of NCL?
Attached file names and their content:
1). Argo_072 - image file for the graph 2). Three ".ps" files for the one ARGO Float 3). NCL code which I had used to project these graphs, i.e. "argo.ncl".
Thanks and best regards.
Sachin Ravilesh Nand | Software Engineer (Consultant) B.C.A (Bangalore University-India) European Union Global Climate Change Alliance Project.
Pacific Centre for Environment and Sustainable Development.
University of the South Pacific.
E: sachin.nand@usp.ac.fj<mailto:sachin.nand@usp.ac.fj>
T: (+679) 32 32205
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-- ______________________________________________________________ Adam Phillips asphilli@ucar.edu<mailto: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/cas/asphilli
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sun May 5 23:04:51 2013
This archive was generated by hypermail 2.1.8 : Tue May 07 2013 - 08:38:33 MDT