McIDAS-V Commands line

How do I...?
Post Reply
User avatar
rriosalido
Posts: 28
Joined: Wed May 01, 2019 12:40 pm

McIDAS-V Commands line

Post by rriosalido »

Hello:

Where can I find documentation about command line options on McIDAS-V?
In the User's Guide there is only a list of arguments but there is no explanation of how it works.
I'm interested in collaboration server mode, image server: how to make an http request? etc

Thank you

Ricardo
User avatar
barryr
Posts: 213
Joined: Thu Jan 08, 2009 5:42 pm
Contact:

Re: McIDAS-V Commands line

Post by barryr »

Hello Ricardo,

You are correct that most of the command line options have only this documentation in the McIDAS-V User's Guide for now. We plan to take a closer look at them and work with the programmers to improve the documentation.

In the meantime, can you describe what you are trying to accomplish? We can then get you information that helps in those areas.

Thanks,
Barry
User avatar
rriosalido
Posts: 28
Joined: Wed May 01, 2019 12:40 pm

Re: McIDAS-V Commands line

Post by rriosalido »

Hello Barry:

I'm interested in explore the capabilities of:

-imageserver <port number or .properties file>
(run McIDAS-V in image generation server mode, and support http requests on the given port)

Thanks

Ricardo
User avatar
barryr
Posts: 213
Joined: Thu Jan 08, 2009 5:42 pm
Contact:

Re: McIDAS-V Commands line

Post by barryr »

Hi Ricardo,

Thanks for your patience. It turns out that the -imageserver flag is an untested feature that was submitted by another group. Because it's untested and we have not found a good use for it in its current form, we will likely remove it from the McIDAS-V documentation.

If you have a specific task that you would like help with, please describe it in detail so we can advise. For example, if you are looking to regularly capture images in the background we can help with a simple example script that can be scheduled to run every X number of minutes.

Thanks,
Barry
User avatar
rriosalido
Posts: 28
Joined: Wed May 01, 2019 12:40 pm

Re: McIDAS-V Commands line

Post by rriosalido »

Hi Barry:

Some of the tasks I would like to implement is, for example, to maintain an updated image loop on a web page. I have no problem doing this with a script, but I don't know how to make the script update the loop without loading all the images each time. That is, I need that the script just loads the last image and adds it to the loop by removing the oldest one and update the .mov file.

Another task would be to know if with McIDAS-V I can generate, in background, local datasets that are automatically updated and that can be accessed by different users within the same network, that is, somehow build a local data server (satellite, models, etc).

Thank you very much

Ricardo
User avatar
bobc
Posts: 988
Joined: Mon Nov 15, 2010 5:57 pm

Re: McIDAS-V Commands line

Post by bobc »

Hello,

As far as running a script from the background where you:

  1. Display a loop of data, capture a movie
  2. Check for a new image every x-number of seconds
  3. If a new image is available, remove the oldest image from the loop and replace it with the new one
  4. Capture a movie every time the animation is updated

You could use this as a template:

Code: Select all

# set up empty list to append to later
satList = []

# dictionary for loadADDEImage
addeParms = dict(
    server = 'adde.ucar.edu',
    dataset = 'RTGOESR',
    descriptor = 'M1C13',
    unit = 'TEMP',
    size = 'ALL',
    showUrls = False,
    )

# number of images to have in the loop:
numImgs = 10

# loop through the x most recent images, loading them and
# appending them to the satList list
for pos in range(numImgs*-1,0):
    data = loadADDEImage(position=pos, **addeParms)
    satList.append(data)

# display a loop in a display window
panel = buildWindow(height=1000, width=1000)
layer = panel[0].createLayer('Image Sequence Display', satList)

# save an image of the most recent display
movieDir = 'C:/Users/rcarp/updatingLoop/'
writeMovie('%sInitialLoop.mov' % movieDir)

# get a reference to the times in the display')
numTimes = len(satList)
for x in range(0, numTimes):
    print satList[x]['datetime']

print '\n'
numCycles = 10
pauseTime = 20
# cycles is iterations through loop
# pause time is number of seconds between iterations
for x in range(0, numCycles):
    print('Begin cycle %s' % x)
    time.sleep(20)
    curTime = listADDEImageTimes(position=-1, **addeParms)
   
    # if no new data then don't update
    if str(curTime[0]['datetime']) == str(satList[numImgs-1]['datetime']):
        print('Times match!\n')
   
    # if new data, add to list and remove oldest time
    # remove current loop from display and replace with new
    # capture an animation of the display   
    else:
        print('New image available! - %s - appending to loop' % curTime[0]['datetime'])
        # load new image and append to existing loop
        data = loadADDEImage(position=-1, **addeParms)
        satList.append(data)
        print('Removing old time from loop - %s\n' % satList[0]['datetime'])
        satList.pop(0)
        # remove current loop in display
        layer = panel[0].getLayer(1)
        layer.getJavaInstance().doRemove()
        # display new loop
        layer = panel[0].createLayer('Image Sequence Display', satList)
        # capture movie
        movieName = 'Cycle_%s.mov' % x
        writeMovie('%s%s' % (movieDir, movieName))
print('Loop Complete')

There are comments throughout the script explaining what's going on. Essentially:

  • The first 34 lines display the data. The number of images is specified by the numImgs variable on line 15. The initial movie is captured on line 29. You can set the directory to write the movies to using the movieDir variable on line 28.
  • Lines 37 and 38 are key. Line 37 (the numCycles variable) goes over the number of times to iterate through the loop. I have this set to 10 for testing purposes. In theory, you could set this to a very large number to keep the script running and updating. Line 38 (pauseTime) is the number of seconds to pause each iteration.
  • In the beginning of the for loop (lines 41 through 44), I grab the most recent time in the dataset. If the most recent time has already been added to the loop, nothing is done and we pause again for 20 seconds (what pauseTime is set to) before trying again.
  • Starting in line 50, if a new image is available, it's loaded and added to the satList list. We also remove the oldest time from the loop. A reference to the layer object in the display (the old loop) is obtained and the old layer is removed in lines 61 and 62. The updated loop is then added to the display and a new movie is captured.

Please note that I've only tested this script as-is, but in theory you should be able to bump up the numCycles variable to a higher number (e.g. 1000) so you could just keep the script running.

As for the other part of your question, local datasets can be set up through a script using makeLocalADDEEntry, which is documented on the Create an Object - Imagery page of the User's Guide. There's no way that you can set up a local dataset on your own machine and have other users access it. However, if you have a shared network drive, you could put the data there and other users could all access the same data. For example, you could write up a script with various makeADDEEntry commands where you create local datasets and this same script could be run by every user assuming they have access to the data directory.

Hopefully this is enough information to get you going in the right direction.

Thanks,
Bob Carp
McIDAS User Services
User avatar
rriosalido
Posts: 28
Joined: Wed May 01, 2019 12:40 pm

Re: McIDAS-V Commands line

Post by rriosalido »

Great Bob!

Thank you very much.

Ricardo
Post Reply