Re: Problem with cnLabelBarEndStyle

From: Arne Kriegsmann <arne.kriegsmann_at_nyahnyahspammersnyahnyah>
Date: Fri May 20 2011 - 08:19:10 MDT

Hi Mary,

I use PyNGL 1.3.1.
Sorry, I forgot to mention that the skript in my original posting has to be executed three times, one time for each option.
But, here is the corrected version of the skript that produces all three ps-files.

Thanks
Arne

import sys,os
import Nio
import Ngl

cdf_file = Nio.open_file(os.path.join(Ngl.pynglpath("data"),"cdf","contour.cdf"),"r")
Z = cdf_file.variables["Z"] # geopotential height

#Figure 1 - IncludeMinMaxLabels
wkres = Ngl.Resources()
wkres.wkColorMap = "default"
wks_type = "ps"
wks = Ngl.open_wks(wks_type,"IncludeMinMaxLabels",wkres)
resources = Ngl.Resources()
resources.cnFillOn = True # Turn on contour line fill.
resources.cnMonoFillPattern = True # Turn solid fill back on.
resources.cnLineLabelsOn = False # Turn off line labels.
resources.cnLabelBarEndStyle = "IncludeMinMaxLabels"
resources.tiMainString = "IncludeMinMaxLabels"
plot = Ngl.contour(wks,Z[0,0,:,:],resources) # Draw a contour plot.

#Figure 2 - IncludeOuterBoxes
wkres = Ngl.Resources()
wkres.wkColorMap = "default"
wks_type = "ps"
wks = Ngl.open_wks(wks_type,"IncludeOuterBoxes",wkres)
resources = Ngl.Resources()
resources.cnFillOn = True # Turn on contour line fill.
resources.cnMonoFillPattern = True # Turn solid fill back on.
resources.cnLineLabelsOn = False # Turn off line labels.
resources.cnLabelBarEndStyle = "IncludeOuterBoxes"
resources.tiMainString = "IncludeOuterBoxes"
plot = Ngl.contour(wks,Z[0,0,:,:],resources) # Draw a contour plot.

#Figure 3 - ExcludeOuterBoxes
wkres = Ngl.Resources()
wkres.wkColorMap = "default"
wks_type = "ps"
wks = Ngl.open_wks(wks_type,"ExcludeOuterBoxes",wkres)
resources = Ngl.Resources()
resources.cnFillOn = True # Turn on contour line fill.
resources.cnMonoFillPattern = True # Turn solid fill back on.
resources.cnLineLabelsOn = False # Turn off line labels.
resources.cnLabelBarEndStyle = "ExcludeOuterBoxes"
resources.tiMainString = "ExcludeOuterBoxes"
plot = Ngl.contour(wks,Z[0,0,:,:],resources) # Draw a contour plot.

Ngl.end()

Am Friday 20 May 2011 15:51:17 schrieb Mary Haley:
> Hi Arne,
>
> What version of PyNGL are you running? I just tried your script and got the
> attached PS file. This was with PyNGL 1.3.1.

-- 
Arne Kriegsmann
Wissenschaftlicher Mitarbeiter
Abteilung Klimasystem
Climate Service Center 
Bundesstr. 45a
D-20146 Hamburg
Tel. 040 41173 320
Fax 040 226 338 163
Received on Fri May 20 08:19:16 2011

This archive was generated by hypermail 2.1.8 : Mon Jun 20 2011 - 12:30:20 MDT