[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[IDV #HYD-141478]: IDV - selecting default display type and labeling image from a formula/Jython routine



Hi HansPeter-

> Number 1 is fine. Should have been obvious to me! Sorry.

No problem.  There are so many options, sometimes I forget what
can and can't be done.

> With number 2 I am rather puzzled for 2 reasons:
> 
> A. I do not get a time stamp with my routines, e.g. the NCOL_RGB formula
> and corresponding Jython code (see attachments). with your "Three Color
> (RGB) Image" formula I get a time stamp. Is there something missing in
> the Jython code?

When you use the AreaAdapter, all you get is the image.  When you go
through the IDV chooser, it creates an object that includes the
time.  You could get the date from the AreaAdapter by using something like:

aa = AreaAdapter(s)
time = aa.getNominalTime()

(I did it like:

  from visad import *
  s= "adde://unidata2.ssec.wisc.edu/imagedata?group=EAST&descr=CONUS&latlon=43 
-89&size=900 900&pos=-1&band=%i&unit=BRIT&mag=1 -2&version=1"

  aa = [AreaAdapter(s % band) for band in [1]][0]
  img1 = aa.getData()
  time = aa.getNominalTime()
  img = [AreaAdapter(s % band).getData() for band in [3,4]]
  range = combine( (img1,img[0],img[1]))
)

Then, once you do your combine(img1,img2,img3)

you could add a time using:

  t = []
  t.append(time)
  ft = FunctionType(RealTupleType.Time1DTuple, range.getType())
  timeField = FieldImpl(ft,SingletonSet(RealTuple(t)))

  timeField.setSample(0,range,0)
  return timeField

and then display timeField.  You will need to have from visad import *
at the beginning.

This all requires an understanding of VisAD to make the timeField
and unfortunately, there are no helper functions for this. 

> B. When ticking the "Show Display List" box in the User Preferences I
> realised that my changes do not get re-applied at IDV start-up. I have
> to apply them manually each time again. This is true for other
> preference features as well; when calling up the User Preferences widget
> at start-up the changes are there though, so changes re not lost. I am
> running 2.1.b1 Built: 20060810-0513 and I do not remember whether also
> former versions lost the changes in the preferences. Do I overlook some
> other tick that would revert to defaults at start-up?

The only thing I can think of is that you have a default bundle saved
(as suggested in a previous e-mail from me).  The default bundle
will override any of the system preferences (since the state of
those preferences at the time.  So, if you saved the default bundle
before you set the Display List preferences after saving your default
bundle, they will not be restored to the primary window.  A quick test
would be to open a new display window (New->Display Window->Map Display
->One Pane) and then load something in there to see if you get the
labels.  If this is the case, then start the IDV with your default bundle,
set all the preferences, then save your default bundle again, or
use the File->Default Bundle->Remove menu to remove your bundle, 
exit and restart the IDV and you should have your preferences.

> BTW I take it that changing style and colour of the label (as well as
> free text) will will be features of the promised enhancements.

You can change the color now through the Edit->Display List Color
menu in the DisplayControl.  Changing the style is on the list.
Finding time to implement it is always the challenge.

I'm cc'ing Tom W on this in case he has suggestions on streamlining
the jython, especially the section on getting the time.  He's much 
better at it than I. ;-)

Don Murray

Ticket Details
===================
Ticket ID: HYD-141478
Department: Support IDV
Priority: Normal
Status: Open