XY Plot

From: nand_s <sachin.nand_at_nyahnyahspammersnyahnyah>
Date: Tue May 07 2013 - 16:08:41 MDT

-----Original Message-----
From: nand_s
Sent: Wednesday, May 08, 2013 9:15 AM
To: 'Mary Haley'
Cc: Dennis Shea (shea@ucar.edu); Adam Phillips (asphilli@ucar.edu)
Subject: RE: XY Plot

Hello Mary,

Thank you very much, I really appreciate your assistance. I have gone through each and every response I have got from NCL developers but I was bit confused at some response that's why what ever addition to the code I was given by NCL developers I use to paste it in my original NCL code and run it but still all the time its generating some errors. This is the original code and i wanted to request for the code which can merge the profiles of a single float. The given code generates separate graph's for different profiles.

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_R5900666_288.nc")

 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")

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

; read in data: there is only 1 time, 1 lat, 1 lon

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

 do nf=0,nfili-1

    f = addfile (diri+fili(nf),"r")

    t = f->temperature(0,:,0,0)

    s = f->salinity(0,:,0,0)

    if (nf.eq.0) then

        printVarSummary(t)

        printVarSummary(s)

    end if

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

; plotting parameters

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

    sfx = get_file_suffix(fili(nf),0)

    pname = sfx@fBase

    wks = gsn_open_wks ("ps",pname)

    res@xyLineColors = (/"blue"/)

    plot(0) = gsn_csm_xy (wks,t,t&pressure,res) ; create plot

    res@xyLineColors = (/"red"/)

    plot(1) = gsn_csm_xy (wks,s,s&pressure,res) ; create plot

    resP@txString = fili(nf)

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

    delete([/t,s/]) ; may change size next file

 end do

end

is there any way I can plot the attached profile in one xy plot?

It would be grateful if you can provide me with the assistance as soon as possible.

Thanks
Sachin.

-----Original Message-----
From: Mary Haley [mailto:haley@ucar.edu]
Sent: Wednesday, May 08, 2013 2:51 AM
To: nand_s
Cc: Dennis Shea (shea@ucar.edu); Adam Phillips (asphilli@ucar.edu)
Subject: Re: XY Plot

Sachin,

I just posted a response to your email on ncl-talk, but I'm sending this one offline.

Please do not post your question to ncl-talk *and* CC several NCL developers on the same email. This may cause several people to work on your problem separately - a waste of time.

We have been responding to your emails, but it seems that you are either not reading them or not receiving them, as you have sent different programs multiple times with the same problems.

Please respond to this email and let me know whether or not you are receiving our email responses.

Thank you,

--Mary

On May 7, 2013, at 3:02 AM, nand_s wrote:

> Hello Recipient,
>
> After many trials of merging the profile into one XY plot, I failed. Can anyone please help me out and find out for me what has happened to this code and what are the changes needed in order to make it compile successfully. The code is given below and the image for the error its generating is also given below:
>
> Please find the three ".nc" files attached in this mail, which are the profiles of one float named as "R5900666" and I want to merge the graph projected by each profile into one XY plot. Can anybody asiist me as soon as possible?
>
> 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_R5900666_*.nc")
> 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
> plot1 = new(nfili,"graphic")
> plot2 = new(nfili, "graphic")
> ;************************************************
> ; read in data: there is only 1 time, 1 lat, 1 lon
> ;************************************************
>
> do nf=0,nfili-1
> f = addfile (diri+fili(nf),"r")
> t = f->temperature(0,:,0,0)
> s = f->salinity(0,:,0,0)
>
> if (nf.ne.0) then
> overlay(plot1(0),plot1(nf))
> overlay(plot1(0),plot2(nf)) .......................................Error generated in here as given in the image below
> end if
>
> 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
> delete([/t,s/])
> end do
> resP@txString = fili(nf)
> gsn_panel(wks,(/plot1(0),plot2(0)/),(/2,1/),resP)
> end
>
>
> The Error image is given below:
>
> <image001.png>
>
>
> 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
> T: (+679) 32 32205
>
> <nodc_R5900666_286.nc><nodc_R5900666_287.nc><nodc_R5900666_288.nc>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Received on Tue May 7 16:08:53 2013

This archive was generated by hypermail 2.1.8 : Wed May 15 2013 - 10:19:28 MDT