I am writing a script where the users in my group have asked for a number of options. They don't want an external setup file, so the options need to come through command line parameters. The problem I have run into is that they want to access the options from the writeImage formatting in captureImage. Perhaps they will set interval, tickmarks and transparency or none of those. I wrote the following code...
useWidth = 500
useHeight = 25
labelColor='Yellow'
anchor = "UM"
place = "UM,0,10"
showUnit=False
tickMarks=3
interval=None
transparency=None
Code: Select all
myFormatting = [
Colorbar(
width=str(useWidth),
height=str(useHeight),
anchor=anchor,
place=place,
showUnit=showUnit,
color=labelColor,
lineColor=labelColor,
),
]
for object in myFormatting:
if isinstance(object,Colorbar):
colorBarObject=object
if (transparency):
myFormatting.append(TransparentBackground())
if (interval is not None):
colorBarObject.interval=interval
if (tickMarks is not None):
colorBarObject.tickMarks=str(tickMarks))
logger.debug('Colorbar settings: {0}'.format(colorBarObject.__dict__))
It seems that tickMarks gets assigned correctly by grabbing the object and then setting tickMarks independently. However, this method does not get interpreted correctly when the object.toIsl() method is used. Unfortunately, this means that the captureImage then fails. Any suggestions on how to approach this? (When the toIsl() method is used, for some reason the tickMarks get tacked onto the height value).
Thanks,
Joleen