Reading and Displaying data in a script without a bundle

Post any questions, ideas, or topics related to Jython and Python scripting.
Post Reply
User avatar
tomw
Posts: 296
Joined: Tue Dec 23, 2008 3:40 pm

Reading and Displaying data in a script without a bundle

Post by tomw »

I offer two examples here:

#1 - From a local NetCDF file where I know the name of the parameter, resizing the display to 400x400, and applying my one display label:

setOffScreen(1)
idv.getStateManager().setViewSize(java.awt.Dimension(400,400))
ds = makeDataSource("/temp/mydata.nc","netcdf.grid")
a = getData(ds.getName(), "GOES_WndSpd")
dc = createDisplay('planviewcolor',a)
pause()
dc.setDisplayListTemplate("This is My Stuff!");
dc.applyPreferences();
writeImage("/temp/myimage.png")

2. From an ADDE server -- using Joleen's previous "ADDE request" setup, but not using "load()", and where I do not know the parameter name -- I just use the first (and only) one.

setOffScreen(1)
idv.getStateManager().setViewSize(java.awt.Dimension(400,400))
server="adde://rets3.ssec.wisc.edu/imagedata?"
portname="PORT=112&COMPRESS=gzip"
project="USER=idv&PROJ=0"
GROUP="GROUP=CIMSSP3&DESCRIPTOR=SABI_137W"
date="DAY=2008178&TIME=21:00:00 21:00:00 I"
keywords="BAND=10&LATLON=31.2 -100.5&PLACE=CENTER&SIZE=250 250&UNIT=TEMP&MAG=1 1&SPAC=4&AUX=YES"

url=server+"&"+portname+"&"+project+"&VERSION=1&DEBUG=false&TRACE=0&"+GROUP+"&"+date+"&"+keywords

ds = makeDataSource(url,"adde.image")
ch = ds.getDataChoices();
a = getData(ds.getName(), ch[0])
dc = createDisplay('planviewcolor',a)
pause()
writeImage("/temp/myimage.png")
Post Reply