invalid dataset error 27

Post any questions, ideas, or topics related to Jython and Python scripting.
Post Reply
User avatar
gdmontoyag
Posts: 5
Joined: Thu May 12, 2016 4:50 pm

invalid dataset error 27

Post by gdmontoyag »

Hi all
I’m new, using McIDAS. I’m trying to download and display real time goes images for teaching and research studies of our students at National University of Colombia, When I do it through the McIDAS-V MAIN DISPLAY ( using: adde.ssec.wisc.edu, server and RTIMAGES dataset) there is no problem and the image is downloaded and displayed successfully. However, when I tray to do it with the following script (adapted from McIDAS-V Tutorial: an Introduction to Jython Scripting):

*******************************************************************************
imageDir=('C:\\ExerScript\\')
dirList = listADDEImages(server='adde.ssec.wisc.edu',
dataset='RTIMAGES',
descriptor='GOES13-IR',position='ALL')
for imageDir in dirList:
print ' '
print 'New image directory %s %s' % (imageDir['sensor-type'], imageDir['nominal-time'])
print '-'*55
for key,value in imageDir.iteritems():
print key,value
imageData = loadADDEImage(size='ALL', **dirList[1])
panel = buildWindow(height=600, width=900, panelTypes=MAP)
dataLayer = panel[0].createLayer('Image Display', imageData)
panel[0].captureImage('C:\\ExerScript\\IR-Image.jpg')
**********************************************************************************
the program stops with the following error messages:

File "<string>", line 3, in <module>
File "<string>", line 1052, in listADDEImages
org.python.proxies.__main__$AddeJythonInvalidDatasetError$27
………………..
__main__.AddeJythonInvalidDatasetError: Check for valid dataset/descriptor. (error code: -118)

I guess that the problem may be in the following line extracted from the mcidas.log file

[MainThread] INFO jython - print: adde://adde.ssec.wisc.edu/imagedirector ... LL&POS=ALL

I can’t go ahead because of this problem. Any help is greatly appreciated

Thanks,

Gerardo Montoya,
Full professor, Universidad Nacional de Colombia, departamento de Geociencias.
Attachments
mcidasv.log
this is the full text of the mcidas.log file
(6.61 KiB) Downloaded 295 times
User avatar
bobc
Posts: 990
Joined: Mon Nov 15, 2010 5:57 pm

Re: invalid dataset error 27

Post by bobc »

Hello Gerardo -

I believe the invalid dataset error you saw is related to how you have the 'descriptor' defined. You have it set as 'GOES13-IR', where it should be 'GE-IR'. To determine what the descriptor of these remote datasets should be defined, you can look at the Image Type dropdown in the Data Sources tab of the Data Explorer:
descriptor.png

In the image above, the Image Type dropdown first lists the 'descriptor', followed by a comment about the dataset. The descriptor is the first block of letters before the '- comment'. For this case, you would use 'GE-IR'. Other valid options would be 'GE-1KVIS', 'GE-39', 'GE-CO2', ... .

There are also a few other issues:
  • You are defining your output directory variable as imageDir, which you are also using in your for loop. This leads to problems if you try using this imageDir variable in your captureImage/writeMovie command. In my example script below, I changed this variable's name to outDir.
  • The indentation doesn't look correct. This might just be because of how the script was copied/pasted in the forum. As a hint, to maintain any indentations you have used, after pasting your script in the forum, highlight the text and then click the "Code" button above the text you are entering (below where the "Subject" text line is).
  • You are specifying position='ALL'. This will look for every position in the RTIMAGES/GE-IR dataset, which as I'm writing this has 192 timesteps.

I am not sure if you are looking load in a single image or a loop of images, but here's a sample script you can use to load a loop of the x most recent images and write a movie:

Code: Select all

# user defined variable for output directory
outDir=('C:\\ExerScript\\')

# user defined variable for how many images to load
numImgs = 5

# math done on numImgs to get position value for listADDEImages
x = (numImgs-1)*-1

# dictionary to pass through loadADDEImage
listParms = dict(
    server = 'adde.ssec.wisc.edu',
    dataset = 'RTIMAGES',
    descriptor = 'GE-IR',
    position = (x,0),
    )

# listADDEImages command using listParms dictionary
dirList = listADDEImages(**listParms)

# setting up satLoop as a python list to be used for appending
# data to with loadADDEImage later
satLoop = []

# loop to print out information and load each timestep, appending
# each time to the satLoop list
for imageDir in dirList:
    print ''
    print 'New image directory %s %s' % (imageDir['sensor-type'], imageDir['nominal-time'])
    print '-'*55

    # print out metadata of each position/timestep returned
    # from listADDEImages
    for key, value in imageDir.iteritems():
        print key,value

    # defining time so it can be passed through loadADDEImage
    imageTime = imageDir['time']

    # setting up a new dictionary for loadADDEImage
    loadParms = dict(
        server = 'adde.ssec.wisc.edu',
        dataset = 'RTIMAGES',
        descriptor = 'GE-IR',
        time = imageTime,
        size = 'ALL',
        )

    # loadADDEImage call using loadParms dictionary
    irData = loadADDEImage(**loadParms)

    # appending each irData data object returned from loadADDEImage
    # to the satLoop list defined earlier
    satLoop.append(irData)

# build window and display the data
panel = buildWindow(height=600, width=900, panelTypes=MAP)
dataLayer = panel[0].createLayer('Image Sequence Display', satLoop)

# capture an image of the data, making use of the outDir
# directory specified at the beginning of the script
writeMovie(outDir+'IR-Image.gif')

You can set the outDir variable to be whatever directory on your machine you want, and you can set numImgs to be the number of images to load in. For example, 5 will load in the 5 most recent images. You can find an example similar to this in the "Creating Movies in a McIDAS-V Script" section on page 19 of the tutorial you referenced earlier. If you were looking to do a single image, then the example above gets a little easier:

Code: Select all

outDir=('C:\\ExerScript\\')

# listADDEImages dictionary and command
listParms = dict(
    server = 'adde.ssec.wisc.edu',
    dataset = 'RTIMAGES',
    descriptor = 'GE-IR',

    )
dirList = listADDEImages(**listParms)

# print out information about dirList object
for imageDir in dirList:
    print ''
    print 'New image directory %s %s' % (imageDir['sensor-type'], imageDir['nominal-time'])
    print '-'*55
    for key, value in imageDir.iteritems():
        print key,value

# loadADDEImage dictionary and command
loadParms = dict(
    server = 'adde.ssec.wisc.edu',
    dataset = 'RTIMAGES',
    descriptor = 'GE-IR',
    size = 'ALL',
    )
irData = loadADDEImage(**loadParms)

# build window, display data, and capture the image
panel = buildWindow(height=600, width=900, panelTypes=MAP)
dataLayer = panel[0].createLayer('Image Display', irData)
panel[0].captureImage(outDir+'IR-Image.jpg')

Note that this case doesn't pass anything returned from listADDEImage through loadADDEImage, so you technically wouldn't need any of the lines from "# listADDEImages dictionary and command" through "# loadADDEImage dictionary and command" to generate an image. This script defaults to getting the most recent image from the dataset because date/time/position information isn't passed through loadADDEImage.

If you have any questions about any of this, please let me know.

Thanks again for your interest in McIDAS-V -
Bob Carp
McIDAS Help Desk
User avatar
gdmontoyag
Posts: 5
Joined: Thu May 12, 2016 4:50 pm

Re: invalid dataset error 27

Post by gdmontoyag »

Thanks to Mcidas support team and to Bob for the help. As soon as I sent the post, I understand the error. However, your explanation and suggestions for further improving the code, are very useful. Thanks newly for the time spent in reading and improving my code
Post Reply