How to display MTSAT HRIT data source using Jython Shell

Post any questions, ideas, or topics related to Jython and Python scripting.
User avatar
rosmadinor
Posts: 13
Joined: Tue Jun 12, 2012 2:36 am

How to display MTSAT HRIT data source using Jython Shell

Post by rosmadinor »

Hi,
I'm a new user of McIDAS-V. Sorry if this question already have answered in this forum.
Right now i'a try to writing a script about MTSAT HRIT data format using the jython shell. The data format is look like this IMG_DK01VIS_201208010432_001 etc. The data have 50 files include all channel.
I've try to write the script like this :

desc=getDescriptor('MTSAT','MTSAT HRIT')
myMetaData,myData=getADDEImage(server='localhost:8112',dataset='MTSAT',descriptor=desc,unit='BRIT')

when i want to display the image, i write:

dataLayer=panel[0].createLayer('Image Display',myData)

BUT, error comes out:

Error: Traceback (most recent call last): File "", line 1, in File"", line 622, in createLayer TypeError: ucar.unidata.data.DataDataChoice(): 2nd arg can't be coerced to visad.Data

For your info, when i tried to read this kind of data by not using the jython shell, i CAN display the IMAGE.
Hope you all can help me solve this problem.

THANKS
REGARDS

alongading
User avatar
joleenf
Posts: 1123
Joined: Mon Jan 19, 2009 7:16 pm

Re: How to display MTSAT HRIT data source using Jython Shell

Post by joleenf »

Has the dataset been added to the local data manager? The easiest way to set up the script to access this data, is to use the information from the ADDE data manager.

1.) Select Tools>Manage ADDE Datassets on Main Display Toolbar.

Step 1
Step 1


2.) Click Local Data tab

Step 2
Step 2


Has the MTSAT data been added? If it has, please check that it can be displayed in an interactive session. A tutorial is here:

http://www.ssec.wisc.edu/mcidas/softwar ... ery1.2.pdf

If you data has already been added to the ADDE local data manager, use the information in the server manager to access the data in your script:

As an example, I will use the dataset highlighted in blue (see picture for step 2 above).

Code: Select all

dataSet = 'AVIATION'
imageType = 'turbulence'
desc = None        # add this assignment to assist in checking code


At that point, I can get the descriptor needed for the script

Code: Select all


localEntries = _mcv.getServerManager().getLocalEntries().toArray()          # get all entries of local servers

for entry in localEntries:
    if entry.getName() == imageType and entry.getGroup() == dataSet:   # check for match of dataSet and imageType
        desc = str(entry.getDescriptor()).upper()                                         #  if a match is found, get current desc
        break                                                                                              # exit loop if match is found
                                                                                                              #  loops blocks defined by indentation
print desc                                                                                               #  dedent means code is outside for/if block


If the dataset has been added to the server manager and the information supplied to the script is correct (i.e. dataSet and imageType), desc will be a mix of numbers an letters (e.g. 'D2725499'), otherwise, it will still be 'None.'
Joleen
User avatar
rosmadinor
Posts: 13
Joined: Tue Jun 12, 2012 2:36 am

Re: How to display MTSAT HRIT data source using Jython Shell

Post by rosmadinor »

tq joleenf for your reply.

actually i've try the second step but the error still comes out.
Here it my step...
step 1 (make sure the data added to local dataset)
step1.gif


step 2 (valid descriptor)
step2.gif


step3 (try to read the data)
step3.gif


step 4 (error comes out)
step4.gif


For your info, i'm using MTSAT HRIT data type not the MCIDAS AREA FORMAT.
HOPEFULLY you can help me to solve this problem. I also can read this MTSAT HRIT data using the MCIDAS interactive software.




This is my final product.

step7.gif


I really need this script to run it automatically. Hope to hear from you soon.
Thanks for helping me sir.
User avatar
joleenf
Posts: 1123
Joined: Mon Jan 19, 2009 7:16 pm

Re: How to display MTSAT HRIT data source using Jython Shell

Post by joleenf »

After getDescriptor is run in the jython shell, could you print it? Is -1 being returned or the descriptor?

Code: Select all

desc = getDescriptor('MTSAT','SECFILE')
print desc


If "desc" is valid, then it might mean that more information needs to be added to the getADDEImage image request.

Also, some error information may already be in your mcidasv.log, located in the McIDAS-V directory. It may help to diagnose the problem if you attach the mcidasv.log information to your next post.

Joleen
User avatar
rosmadinor
Posts: 13
Joined: Tue Jun 12, 2012 2:36 am

Re: How to display MTSAT HRIT data source using Jython Shell

Post by rosmadinor »

thanks jooleenf.

this is the data format MTSAT section file that i've used.

step9.gif


and this is the mcidasv.log that you requested.
mcidasv.log
(593.86 KiB) Downloaded 492 times


thanks for your help.
User avatar
mhiley
Posts: 90
Joined: Mon Jan 23, 2012 10:22 pm

Re: How to display MTSAT HRIT data source using Jython Shell

Post by mhiley »

Hi rosmadinor,

After you do getADDEImage, can you please type this into the Jython Shell:

Code: Select all

print type(myData)
and post the result here?

Thanks,
Mike
User avatar
rosmadinor
Posts: 13
Joined: Tue Jun 12, 2012 2:36 am

Re: How to display MTSAT HRIT data source using Jython Shell

Post by rosmadinor »

Hi Mike,

Here is the result after run the script 'print type(myData)'

printmyDATA.gif


Thanks for your help MIKE.

Hope you can assist me.

Regards
User avatar
mhiley
Posts: 90
Joined: Mon Jan 23, 2012 10:22 pm

Re: How to display MTSAT HRIT data source using Jython Shell

Post by mhiley »

Thanks - that confirms that the failure is happening in getADDEImage and not createLayer.

We need one more piece of information - can you also post the result of this:

Code: Select all

print desc
User avatar
rosmadinor
Posts: 13
Joined: Tue Jun 12, 2012 2:36 am

Re: How to display MTSAT HRIT data source using Jython Shell

Post by rosmadinor »

Hi Mike,

Sorry for my late reply.

This is the result...

printdesc.gif


Regards.

Rosmadinor
User avatar
mhiley
Posts: 90
Joined: Mon Jan 23, 2012 10:22 pm

Re: How to display MTSAT HRIT data source using Jython Shell

Post by mhiley »

Thanks and I'm also sorry for my late reply. It looks like you are getting a valid descriptor so the problem is most likely that you are not including enough information in the getADDEImage request.

I'm not sure exactly which keyword you need to include. You can look at the scripting documentation for examples of valid combinations of keywords:

http://www.ssec.wisc.edu/mcidas/softwar ... ing1.2.pdf

Alternatively, you could upload your file to our FTP server and I'll try tinkering with it myself. You can follow Bob's instructions in this thread:

viewtopic.php?f=24&t=1116&hilit=ftp
Post Reply