Display Time sequence of a formula

Post any questions, ideas, or topics related to Jython and Python scripting.
Post Reply
User avatar
carlospsneto
Posts: 68
Joined: Thu Mar 14, 2013 1:38 pm

Display Time sequence of a formula

Post by carlospsneto »

How can i display a time sequence image of a field originated from a formula?
Load 2 channels of Meteosat, (WV and IR) and display a time sequence of the subtraction of those channels. When i do for a single image it work. But i couldn't do that for a time sequence image.
I tried selecting the formula as a list, but didn't worked.

For exemplo:

Code: Select all

Arquivos =getLocalADDEEntry(dataset='CCM',imageType = 'MSG')                   
    
parametros = dict(
    debug=True,
    server='localhost',
    dataset='CCM',
    size='ALL',
    localEntry=Arquivos,
    mag=(1, 1),
    unit='TEMP',
    position='ALL',
)

dirList_times = listADDEImageTimes(time=('20:30:00','21:31:00'), **parametros)

Times_Loop = []
for Images in dirList_times:             
    metaData,dataIR = getADDEImage(band=9,time=Images['time'],**parametros)
    metaData,dataWV = getADDEImage(band=5,time=Images['time'],**parametros) 
    BTD = sub(dataWV,dataIR)                 
    Times_Loop.append(BTD)


Other exemplo is Load U and V wind component of a netcdf file and try to display the time sequence of wind flow vectors.

Thank you
User avatar
bobc
Posts: 990
Joined: Mon Nov 15, 2010 5:57 pm

Re: Display Time sequence of a formula

Post by bobc »

Hello carlospsneto -

Are you using one of the McIDAS-V nightly builds (version 1.5beta1 or 1.5beta2)? If so, are you seeing errors involving 'mcidasv.jar\edu\wisc\ssec\mcidasv\resources\python\utilities\decorators.py'? If this is the case, it's a problem with the nightly build because I am seeing the same problem. I will make the programmers aware.

I went back to McIDAS-V version 1.4 and my script worked fine. If you have 1.4 on your machine, can you try your script there?

Thanks for reporting this problem -
Bob Carp
McIDAS Help Desk
User avatar
carlospsneto
Posts: 68
Joined: Thu Mar 14, 2013 1:38 pm

Re: Display Time sequence of a formula

Post by carlospsneto »

Oh, sorry. I think my question wasn't clear.
This part of script is working fine.
My problem is when i try to display the field that i applied the formula. In that case: BTD = sub(dataWV,dataIR).
Adding the field in list and trying to display that list as a Image Sequence Display, like it's done direct with Satellite data, didn't worked.

For exemplo if i set:

Code: Select all

panel = activeDisplay()
dataLayer = panel.createLayer('Image Sequence Display', Times_Loop) # That will result in a error.


But if i only add to the list the direct image display:

Code: Select all

Times_Loop.append(dataIR) or Times_Loop.append(dataWV). 

McIDAS will display that with no problem.

And, if i display only one image of BTD, will work fine too.

Code: Select all

dataLayer = panel.createLayer('Image Sequence Display', BTD) #Only one time


My question is: how do I display a field derived from a formula as a Time Sequence?
User avatar
bobc
Posts: 990
Joined: Mon Nov 15, 2010 5:57 pm

Re: Display Time sequence of a formula

Post by bobc »

Hello -

It looks like some changes need to be made to your loop. See my example script below that works with some local AREA files to create a loop of band subtracted temperatures. I essentially pulled this from the classify-movie.py script included with the scripting tutorial. Note that this script works in 1.4 and the 1.5beta2 build from today. In previous nightlies, createLayer was not handling a list (time sequence) of objects that had been through a formula.

Code: Select all

dataPath = 'C:/Users/rcarp/AREA2/'

localData=makeLocalADDEEntry(dataset='AREA', imageType='AREA2', mask=dataPath, format='McIDAS Area', save=True)

ADDE_listRequest = dict(
    localEntry = localData,
    day = '2014181',
    time = ('16:00:00','16:30:00'),
    position = 'ALL',
    unit = 'TEMP',
    coordinateSystem = LATLON,
    location = (40, -80),
    size = (800, 800),
    )

dateTimeList = listADDEImageTimes(**ADDE_listRequest)
print dateTimeList

myLoop = []
for dateTime in dateTimeList:
    imageTime = dateTime['time']

    ADDE_Request = dict(
        localEntry = localData,
        day = '2014181',
        time = (imageTime, imageTime),
        unit = 'TEMP',
        coordinateSystem = LATLON,
        location = (40, -80),
        size = (800, 800),
        )

    irMetaData, irData = getADDEImage(band = 6, **ADDE_Request)
    wvMetaData, wvData = getADDEImage(band = 3, **ADDE_Request)

    subData = sub(wvData, irData)
    myLoop.append(subData)

panel = buildWindow(height=800, width=1000)
subLayer = panel[0].createLayer('Image Sequence Display', myLoop)


If this doesn't help with getting your script working, please let us know.

Thanks -
Bob
Post Reply