script: display AREA file with bundle

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

script: display AREA file with bundle

Post by joleenf »

Hi,

This is a similar question to another forum post, except in this scenario a display that I have bundled. I want to change the data within the bundle, change the color table, change the layer label and save the image.

So far I have made a bundle with data loaded with relative position numbers.
In the Field Selector>Data Sources>Right click on my data and select "Properties", I have changed the name of the data to 'mydata'. Under the 'Times' tab, I have deselected "Use Default" and have chosen only the "Second most recent" in an effort to avoid problems if the most current time is not fully loaded.

I click "Create Display"

Under the "Layer Controls">Edit>Properties
Under the settings tab, I have made the Id: "mydisplay"
Click OK

I save the bundle as one_image.mcv.

Now I can use a script which replaces "mydata" with data specified in the script. It also uses the "mydisplay" id to connect to the display control and replace the existing color bar with the color bar specified in the script.

I now need to change my display label, I could do this with write image, but believe there must be a way to take advantage of the %timestamp% and other macros in combination with other text.

I have not yet tested what happens if I add a color bar and insert new data into the display.

The current version of the script:

# The contents of the mydata dictionary was copied directly from the Field Selector. This data was loaded through the chooser.
# Right click on the data and select properties>Details. This information was under location, BAND=ALL was changed to BAND=10.

server="adde://rets3.ssec.wisc.edu/imagedata?" #server where data resides
portname="PORT=112&COMPRESS=gzip" #port information (I think 112 is default)
project="USER=idv&PROJ=0" #project name and project number
GROUP="GROUP=CIMSSP3&DESCRIPTOR=SABI_137W" #adde GROUP/DESCR
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&SPAC=4&AUX=YES"
lat=31.2
lon=-100.5

mydictionary={"mydata":server+"&"+portname+"&"+project+"&VERSION=1&DEBUG=false&TRACE=0&"+GROUP+"&"+date+"&"+keywords}

#setOffScreen(1) #run in background

loadBundle("/Users/joleenf/mcidas/bundles/one_image.mcv",mydictionary,1000,1000)
pause()

###---center on the chosen lat/lon location ---###
lalo=Util.makeEarthLocation(lat,lon)
islInterpreter.getIdv().getVMManager().center(lalo)
islInterpreter.getIdv().getVMManager().center(lalo)
islInterpreter.getIdv().getVMManager().center(lalo)
islInterpreter.getIdv().getVMManager().center(lalo)
###---end of commands which center the image to user chosen location---###

###---changing the color table---###
ctm=idv.getColorTableManager()
ct=ctm.getColorTable("Blues")
df=findDisplayControl("mydisplay")
df.setColorTable(ct)
###---end of commands for changing the color table---###


#change the legend lable to "GOES-15 (0.65 um Radiance) - %timestamp%
#add another label "UW/CIMSS"

writeImage("/Users/joleenf/mcidas/images/test_image2.jpg",\
"overlay text=GOES-R place=LM,0,-20 anchor=LM color=yellow")



Thanks,
Joleen
Post Reply