Re: Simple line plot -need help

From: Madeleine Patterson <madeleine.patterson77_at_nyahnyahspammersnyahnyah>
Date: Thu Jan 27 2011 - 12:19:56 MST

Hi Again,

I was able to graph the line plots I wanted, but even though I've had a look
at various bits of the NCL site, I haven't been able to produce lots of
different individual plots (both x11 and pdf) from the one script. I figured
out that I can only have one pdf workstation at a time, but I was trying to
get around it by naming them differently. (doesn't work, but would if I were
trying to produce ps plots -why???)

Is there any way round this - can I close a pdf workstation and open another
one in the same script? I tried delete(wks) but my script still hangs after
the first x11 plot pops up onto my screen (i.e):

wks1a = gsn_open_wks("pdf","tsa-diff")
wks1b= gsn_open_wks("x11","tsa-diff")

res=True
res@tiMainString = "monthly output TSA-difference over time"

plot = gsn_csm_xy(wks1a,time,tsa_diff,res) <---- GETS STUCK HERE
plot = gsn_csm_xy(wks1b,time,tsa_diff,res)

delete(wks1a)
delete(wks1b)

;;;

wks2a = gsn_open_wks("pdf","fcev_diff")
wks2b= gsn_open_wks("x11","fcev_diff")

res=True
res@tiMainString = "monthly output FCEV -difference over time"

plot = gsn_csm_xy(wks2a,time,fcev_diff,res)
plot = gsn_csm_xy(wks2b,time,fcev_diff,res)

Any suggestions? Or will I have to be content to output ps files?

Thanks

Maddy

On Tue, Jan 25, 2011 at 12:28 PM, Dennis Shea <shea@ucar.edu> wrote:

> Use wgt_areaave_Wrap rather than wgt_areaave.
> The _Wrap preserves the meta data
>
>
> http://www.ncl.ucar.edu/Document/Functions/Contributed/wgt_areaave_Wrap.shtml
>
> ---
>
> TsoiAve_clat = wgt_areaave(tsoi_all, clat, 1.0, 1)
> printVarSummary(TsoiAve_clat)
>
> you will see that there is no meta data
>
> Using
>
> TsoiAve_clat = wgt_areaave_Wrap(tsoi_all, clat, 1.0, 1)
> printVarSummary(TsoiAve_clat)
>
> ====
> The coordinates TsoiAve_clat will be (say) (time,depth)
>
> Do you wish the plot the global average at each level???
> or
> Do you wish the plot the global average of all levels
> where there is only one coordinate (time):
>
> If the latter ...
>
> http://www.ncl.ucar.edu/Document/Functions/Built-in/wgt_volave.shtml
>
> glAve = wgt_volave(tsoi_all, depth, clat, 1.0, 0) ; glAve(ktime)
> glAve!0 = "time"
> glAve&time = tsoi_all&time
> printVarSummary(glAve)
> =====
>
>
>
> Also, There is no need to explicitly read "time" to memory.
> time=fall[:]->time
>
> You can use the coordinate associated with the variable you are trying to
> plot eg ...
>
> plot = gsn_csm_xy(wks1,glAve&time,glAve,res)
>
>
> On 1/25/11 10:14 AM, Madeleine Patterson wrote:
>
>> Hi,
>>
>> I am trying to plot weighted global area averaged soil temperature over
>> time (10 layers of soil temps) over 30 years of monthly values.
>>
>> However I am getting a long list of TsoiAve_clat = 1e+36 at different
>> coords when I run the script and a bunch of warnings and error messages
>> at the end
>>
>> (0) gsn_csm_xy: Fatal: X and Y must have the same dimensions sizes,
>> or one must be one-dimensional and both have the same rightmost dimension.
>>
>> warning:["CoordArrays.c":591]:No Valid values in Array, unable to
>> compute Min or Max
>> warning:LegendInitialize: lgItemTypes exceeds maximum number of
>> elements, 256: ignoring
>> warning:LegendInitialize: lgDashIndexes exceeds maximum number of
>> elements, 256: ignoring
>> warning:LegendInitialize: lgMarkerIndexes exceeds maximum number of
>> elements, 256: ignoring
>> warning:LegendInitialize: lgLineLabelStrings exceeds maximum number of
>> elements, 256: ignoring
>> warning:LegendInitialize: lgLineColors exceeds maximum number of
>> elements, 256: ignoring
>> warning:LegendInitialize: lgMarkerColors exceeds maximum number of
>> elements, 256: ignoring
>> warning:LegendInitialize: lgLineDashSegLens exceeds maximum number of
>> elements, 256: ignoring
>> warning:LegendInitialize: lgLineThicknesses exceeds maximum number of
>> elements, 256: ignoring
>> warning:LegendInitialize: lgMarkerThicknesses exceeds maximum number of
>> elements, 256: ignoring
>> warning:LegendInitialize: lgLineLabelFontHeights exceeds maximum number
>> of elements, 256: ignoring
>> warning:LegendInitialize: lgMarkerSizes exceeds maximum number of
>> elements, 256: ignoring
>> warning:LegendInitialize: lgLabelStrings exceeds maximum number of
>> elements, 256: ignoring
>> warning:LegendInitialize: lgLineLabelFontColors exceeds maximum number
>> of elements, 256: ignoring
>> warning:LegendInitialize: lgItemTypes exceeds maximum number of
>> elements, 256: ignoring
>> warning:LegendInitialize: lgDashIndexes exceeds maximum number of
>> elements, 256: ignoring
>> warning:LegendInitialize: lgMarkerIndexes exceeds maximum number of
>> elements, 256: ignoring
>> warning:LegendInitialize: lgLineLabelStrings exceeds maximum number of
>> elements, 256: ignoring
>> warning:LegendInitialize: lgLineColors exceeds maximum number of
>> elements, 256: ignoring
>> warning:LegendInitialize: lgMarkerColors exceeds maximum number of
>> elements, 256: ignoring
>> warning:LegendInitialize: lgLineDashSegLens exceeds maximum number of
>> elements, 256: ignoring
>> warning:LegendInitialize: lgLineThicknesses exceeds maximum number of
>> elements, 256: ignoring
>> warning:LegendInitialize: lgMarkerThicknesses exceeds maximum number of
>> elements, 256: ignoring
>> warning:LegendInitialize: lgLineLabelFontHeights exceeds maximum number
>> of elements, 256: ignoring
>> warning:LegendInitialize: lgMarkerSizes exceeds maximum number of
>> elements, 256: ignoring
>> warning:LegendInitialize: lgLabelStrings exceeds maximum number of
>> elements, 256: ignoring
>> warning:LegendInitialize: lgLineLabelFontColors exceeds maximum number
>> of elements, 256: ignoring
>> warning:LegendSetValues: lgItemTypes exceeds maximum number of elements,
>> 2::56: ignoring
>> warning:LegendSetValues: lgDashIndexes exceeds maximum number of
>> elements, 256: ignoring
>> warning:LegendSetValues: lgMarkerIndexes exceeds maximum number of
>> elements, 256: ignoring
>> warning:LegendSetValues: lgLineLabelStrings exceeds maximum number of
>> elements, 256: ignoring
>> warning:LegendSetValues: lgLineColors exceeds maximum number of
>> elements, 256: ignoring
>> warning:LegendSetValues: lgMarkerColors exceeds maximum number of
>> elements, 256: ignoring
>> warning:LegendSetValues: lgLineDashSegLens exceeds maximum number of
>> elements, 256: ignoring
>> warning:LegendSetValues: lgLineThicknesses exceeds maximum number of
>> elements, 256: ignoring
>> warning:LegendSetValues: lgMarkerThicknesses exceeds maximum number of
>> elements, 256: ignoring
>> warning:LegendSetValues: lgLineLabelFontHeights exceeds maximum number
>> of elements, 256: ignoring
>> warning:LegendSetValues: lgMarkerSizes exceeds maximum number of
>> elements, 256: ignoring
>> warning:LegendSetValues: lgLabelStrings exceeds maximum number of
>> elements, 256: ignoring
>> warning:LegendSetValues: lgLineLabelFontColors exceeds maximum number of
>> elements, 256: ignoring
>> warning:LegendSetValues: lgItemTypes exceeds maximum number of elements,
>> 256: ignoring
>> warning:LegendSetValues: lgDashIndexes exceeds maximum number of
>> elements, 256: ignoring
>>
>> My various print commands reveal that tsoi_all has 4 dims and TsoiAvg
>> has 2, and I'm not really sure why this would be (or if its the cause of
>> my problem).
>>
>> Can anyone point to where my script goes wrong?
>>
>> Thanks
>>
>> Maddy
>>
>> *************************************
>>
>> My script:
>>
>> begin
>>
>> 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"
>>
>> setfileoption("nc","SuppressClose",False)
>>
>> all_files = systemfunc("ls model-output2000.*")
>>
>> fall = addfiles(all_files,"r")
>> ListSetType(fall,"cat")
>> tsoi_all = fall[:]->TSOI
>> printVarSummary(tsoi_all)
>>
>> lon = fall[1] ->lon
>> lat = fall[1] ->lat
>>
>> rad = 4.0*atan(1.0)/180.0
>>
>> ; use the cosine of the latitudes to calc weighted global avg
>>
>> clat = cos(lat*rad)
>>
>> TsoiAve_clat = wgt_areaave(tsoi_all, clat, 1.0, 1)
>>
>> print(" TsoiAve_clat = " + TsoiAve_clat)
>>
>> TsoiAvg= TsoiAve_clat
>>
>> printVarSummary(TsoiAvg)
>>
>> time=fall[:]->time
>>
>> wks = gsn_open_wks("pdf","tsoi'")
>> wks1= gsn_open_wks("x11","tsoi") ;open two types of workstations
>>
>> res=True
>> res@tiMainString = "Soil Temperature (1970-2000)"
>>
>> plot = gsn_csm_xy(wks1,time,TsoiAvg,res)
>>
>> end
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> 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 Jan 27 12:20:05 2011

This archive was generated by hypermail 2.1.8 : Mon Jan 31 2011 - 10:38:24 MST