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

20040511: Sporadic McIDAS GOES-E Coverage



>From: "Luis A. Lopez" <address@hidden>
>Organization: UPRM
>Keywords: 200405111732.i4BHWntK009151 McIDAS scripts

Hi Luis,

>I'm having some problems when I execute mcidas command from the command
>line, for example this one:
>
>./imgdisp.k GINIEAST/GPR4KIR LINELE= 240 240 PLACE=C MAG= 1 1 EU=IMAGE
>SU=X ALL=1 SF=YES REFRESH='EG GRA=(GRA);MAP FILE=OUTLHRES MCOL=1 WID=1
>GRA=(GRA);BAR (GRA) SU=IRTEMP X COL=7 ORIENT=VER;TE ?LASTFRM (GRA)'
>
>I get this error:
>
>Beginning Image Data transfer, bytes= 308480
>IMGDISP: loaded frame  1
>EG GRA=   1 ;MAP FILE=OUTLHRES MCOL=1 WID=1 GRA=   1 ;BAR    1  SU=IRTEMP
>X COL=7 ORIENT=VER;TE ?LASTFRM    1
>./imgdisp.k: done
>EU: Restoring IMAGE.ET to frame(s)= 1
>EU: Done
>Cannot connect to existing positive UC
>EG failed, rc=1
>
>But if I try this command from the GUI (using the command window) it works
>fine. (It complain in the field ALL=11, but I change it to 4 and it
>works).

The problem is that the McIDAS environment that is created by running
imgdisp.k is exiting befoe the REFRESH= commands have run.  This is
an unfortunate, but known behavior of REFRESH= command execution.

>I need to execute the commands from a script to be run on a cron job every
>hour, so I cannot use the GUI .

You can accomplish your goal in a script easily in either of two ways:

- put a WAIT (wait.k) for a couple of seconds after the full imgdisp.k
  command (full meaning that you keep the REFRESH= set of commands

- create a McIDAS environment in a script and then run the sequence of
  commands one after another:

mcenv << EOF
imgdisp.k GINIEAST/GPR4KIR LINELE= 240 240 PLACE=C MAG= 1 1 EU=IMAGE SU=X ALL=1 
SF=YES
eg.k
map.k FILE=OUTLHRES MCOL=1 WID=1
bar.k SU=IRTEMP X COL=7 ORIENT=VER
etc.
EOF

Notice that I did not include the GRA=(GRA) or (GRA) construct when the
commands are run individually.  This syntax is only valid for the
REFRESH= keyword of IMGDISP.

I include two example scripts in the McIDAS distribution that are
designed to be copied by the user into local files, edited, and then
run from the Unix command line or cron:  mcrun.sh, mcbatch.sh.   You
will find both of these commands in the ~mcidas/data directory.  Make
sure you make a local copy of them; don't use the ones in the
distribution as they will be overwritten the next time you upgrade your
McIDAS distribution.

For instance, do the following:

<as you>
cd ~/mcidas/data
cp ~mcidas/data/mcrun.sh mymcrun.sh

-- edit mymcrun.sh and change:

mcenv << EOF

# put McIDAS-X commands you want to run here, one command per line.

# Example (note that these lines are commented out!!):
#
# dataloc.k ADD RTGINI adde.unidata.ucar.edu
# imgdisp.k RTGINI/GE1KVIS STA=KMIA EU=IMAGE SF=YES REFRESH='EG;MAP H'
# frmsave.k 1 miamivis.gif

# done
  exit

EOF

to:

mcenv << EOF

# put McIDAS-X commands you want to run here, one command per line.

# Example (note that these lines are commented out!!):
#
# dataloc.k ADD RTGINI adde.unidata.ucar.edu
# imgdisp.k RTGINI/GE1KVIS STA=KMIA EU=IMAGE SF=YES REFRESH='EG;MAP H'
# frmsave.k 1 miamivis.gif

  imgdisp.k GINIEAST/GPR4KIR LINELE= 240 240 PLACE=C MAG= 1 1 EU=IMAGE SU=X 
ALL=1 SF=YES
  eg.k
  map.k FILE=OUTLHRES MCOL=1 WID=1
  bar.k SU=IRTEMP X COL=7 ORIENT=VER

# done
  exit

EOF


You will probably want to save the display as a GIF (tm), JPEG, or
other raster format, so you will include something like:

frmsave.k 1 example.gif

before you 'exit'

Another thing, 'mcenv' takes command line arguments that allow you to
specify things like the numbe and size of frames, number of image color
levels, number of graphic levels, etc.  Here is the same example for a
frame that is 600x800, has 64 image levels, and 32 graphic levels:

mcenv -f 1@600x800 -i 64 -g 32 << EOF

# put McIDAS-X commands you want to run here, one command per line.

# Example (note that these lines are commented out!!):
#
# dataloc.k ADD RTGINI adde.unidata.ucar.edu
# imgdisp.k RTGINI/GE1KVIS STA=KMIA EU=IMAGE SF=YES REFRESH='EG;MAP H'
# frmsave.k 1 miamivis.gif

  imgdisp.k GINIEAST/GPR4KIR LINELE= 240 240 PLACE=C MAG= 1 1 EU=IMAGE SU=X 
ALL=1 SF=YES
  eg.k
  map.k FILE=OUTLHRES MCOL=1 WID=1
  bar.k SU=IRTEMP X COL=7 ORIENT=VER
  frmsave.k 1 example.gif

# done
  exit

EOF

Check out the online help for 'mcenv' for more information:

HELP mcenv

>Another question:  these commands get the image from mcidas servers and if
>used from GUI it display them on a window, but what happen when they are
>executed from the command line??,

The display occurs in shared memory.  This means that you don't even
have to have X Windows running for the display to succeed.

You see the display from the session running the MCGUI since an
application, mcimage, is running to visualize the contents of shared
memory in which the image is displayed.  mcimage does not have to run
for the display to occur.

>does the image is saved locally??,

It is in shared memory.

>which extension??

You have to run the FRMSAVE (frmsave.k) command to save the contents of
shared memory to a raster file.  You tell FRMSAVE what kind of raster
file you want through a command keyword.  Check out the online help for
FRMSAVE for more information:

HELP FRMSAVE

>Thank you for your support.

No worries.

Cheers,

Tom
--
NOTE: All email exchanges with Unidata User Support are recorded in the
Unidata inquiry tracking system and then made publically available
through the web.  If you do not want to have your interactions made
available in this way, you must let us know in each email you send to us.