shade colors in color-shaded plan view

Post any questions, ideas, or topics related to Jython and Python scripting.
Post Reply
User avatar
joleenf
Posts: 1123
Joined: Mon Jan 19, 2009 7:16 pm

shade colors in color-shaded plan view

Post by joleenf »

Hi,

Is there any way to set "Shade Colors" from a script when using the Color-Shaded Plan View display type?

Thanks,
Joleen
User avatar
bobc
Posts: 990
Joined: Mon Nov 15, 2010 5:57 pm

Re: shade colors in color-shaded plan view

Post by bobc »

Hi Joleen -

To shade colors, you can run:

Code: Select all

layer.getGridDisplay().setTextureEnable(0)

... as part of a script:

Code: Select all

# setting up dictionary.  note filename may have to change once the 02/09/15 06Z is no longer in the catalog
params = dict(
    filename = 'http://thredds.ucar.edu/thredds/dodsC/grib/NCEP/GFS/CONUS_80km/GFS_CONUS_80km_20150209_0600.grib1/GC',
    time = 0,
    field = 'Pressure_reduced_to_MSL_msl',
    )

# pulling in data
mslp = loadGrid(**params)

# build window and display data
panel = buildWindow()
layer = panel[0].createLayer('Color-Shaded Plan View',mslp)

# shade colors.  note that checkbox in Layer Controls won't change.  set to (1) to turn off shading
layer.getGridDisplay().setTextureEnable(0)

Note that the checkbox for Shade Colors won't change in the Layer Controls. For completeness, you can also change the Mode and Point Size items through a script:
Mode (change to points, won't be reflected in the Layer Controls):

Code: Select all

from ucar.visad.display import Grid2DDisplayable
solidMode = Grid2DDisplayable.POLYGON_FILL
meshMode  = Grid2DDisplayable.POLYGON_LINE
pointMode = Grid2DDisplayable.POLYGON_POINT
layer.setPolygonMode(pointMode)
layer.getPlanDisplay().setPolygonMode(pointMode)

You can also change the point size (won't be reflected in the Layer Controls):

Code: Select all

layer.setPointSize(1)
# enter any numerical value after setPointSize

Thanks -
Bob Carp
Post Reply