Re: Plot producing same contour rather than looping to produce different contour for each step

From: Cannavina, Dominique <d.cannavina11_at_nyahnyahspammersnyahnyah>
Date: Thu Jul 05 2012 - 12:48:30 MDT

Thanks Rick, I didn't actually mean to have an inner and outer loop-and your explanation explains the messages and outputs I had when I was playing about with the two loops. I have tried the plot(i) and the inr but I still only get one plots but it has cleared up in my mind what I am trying to now, I have readjusted the end of the script to the following;

So can I ask anothe ncl-talk question?

My aim being to produce a plot to output a contour plot of each duration length (spell_tot) i.e 1 day, 2 days ...30 days which relates to consecutive days of cold spells. So I need 1 loop to give me a plot for each value of 'nr' that relates to each spell length.

I have taken the 'outer loop' away and tidied up the inner part.

plot = new(8, graphic)

istart = nr + 1

iend = istart +7

iplot = 0

do inr = istart,iend

 

res1@tiMainString = ("DEMETER_ENSEMBLES -run length =" + (nr+1)+"days"); add a title

res1@tiMainFontHeightF = .018 ; font height

plot(i) = gsn_csm_contour_map(wks,spell_tot(0,{spell(nr)},:,:),res1)

end do

But get the following error message related to the plot(i) line.

fatal:Subscript out of range, error in subscript #0

fatal:An error occurred reading spell

Any advice would be greatly appreciated

Kind regards

Dominique

________________________________
From: Rick Brownrigg [brownrig@ucar.edu]
Sent: 05 July 2012 18:27
To: Cannavina, Dominique
Cc: ncl-talk@ucar.edu
Subject: Re: Plot producing same contour rather than looping to produce different contour for each step

Hi Dominique,

I'm not sure what you are trying to do here. It looks like there's an inner loop that iterates 8 times: on the line

plot = gsn_csm_contour_map(wks,spell_tot(0,{spell(nr)},:,:),res1)

should that perhaps be:

plot(i) = gsn_csm_contour_map(wks,spell_tot(0,{spell(nr)},:,:),res1)

And the index "inr" vs. "nr"?

If this is what you are trying to do, I suspect you'll also have a problem with the size of the plot array, as the inner loop of 8 iterations is encompassed by the outer loop of indeterminable iterations (i.e, the "do nr =0,(spell(0)-1), 5")

Hope that helps…

Rick

On Jul 5, 2012, at 11:16 AM, Cannavina, Dominique wrote:

Hi NCL-Talk

First of thank to for all the help so far with my script particularly Dennis and Adam.

I would like to ask another NCL-Talk question please plotting the output for the number of consecutive days below the critical temp zero degC.

The following loop, gives 8 plots but of the same contour and the res1@tiMainString<mailto:res1@tiMainString>=.... shows that that I am outputting the same data rather then going to the next value of 'spell_tot'

I have also attached the whole script (this also contains some of my attempts) and a file with the main variables.

Any advice would be greatly appreciated.

Kind regards

Dominique

plot = new(8, graphic)
do nr =0,(spell(0)-1), 5
istart = nr + 1
iend = istart +7
iplot = 0
do inr = istart,iend

 

res1@tiMainString = ("DEMETER_ENSEMBLES -run length =" + (nr+1)+"days"); add a title
res1@tiMainFontHeightF = .018 ; font height

plot = gsn_csm_contour_map(wks,spell_tot(0,{spell(nr)},:,:),res1)
end do
end do
<demeter_v1_plots.ncl><Variables.o1827871>_______________________________________________
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 Thu Jul 5 12:49:42 2012

This archive was generated by hypermail 2.1.8 : Mon Jul 09 2012 - 10:45:32 MDT