[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
20000904: Bourne shell scripting in McIDAS-X
- Subject: 20000904: Bourne shell scripting in McIDAS-X
- Date: Tue, 05 Sep 2000 12:09:39 -0600
>From: Craig Motell <address@hidden>
>Organization: University of Hawaii
>Keywords: 200009040842.e848gEN24519 McIDAS-X Boune shell scripting
Craig,
>I have a simple shell program.
>-------------------- mcopen --------------------------
>#!/bin/sh
>
>HOME=/users2/mcidas
>PATH=$HOME/bin:$HOME/help
>PATH=$PATH:/bin:/usr/bin:/etc:
>PATH=$PATH:/usr/bin/X11:/common/tool/bin:.
>
>MCPATH=/users/hnl/mcidas/data:/users2/mcidas/help:/users2/mcidas/data:/users2/mcidas/help
>
>export PATH
>export MCPATH
>
>DISPLAY=tape-bk:0
>export DISPLAY
>
>args="DANIEL/IMAGES SF=YES DATE=$1 TIME=$2 LATLON=$3 $4"
>
>mcenv -f 512x512 << EOL
>imglist.k DANIEL/IMAGES DATE=$1 TIME=$2
>EOL
>
>-------------- end mcopen -------------------------
Looks OK. I typically use EOF as the delimiter of a section:
mcenv -f 512x512 << EOF
imglist.k DANIEL/IMAGES DATE=$1 TIME=$2
EOF
but EOL is OK.
Also, since HOME is set by the shell, I wouldn't reset it myself. If
you are trying to define the HOME directory of your 'mcidas' user, I
would use MCHOME instead of HOME. This shouldn't be the problem,
however.
I ran your script after making appropriate mods to PATH, MCPATH, and DISPLAY
with no problems here.
>I run it as follows:
>user@gold:$ mcopen 2000208 02:00:00
>Image file directory listing for:DANIEL/IMAGES
>Pos Satellite/ Date Time Center Band(s)
> sensor Lat Lon
>--- ------------- ------------ -------- -------- ------------
>601 G-10 IMG 26 JUL 00208 02:00:00 21 130 4
>imglist.k: done
>odt_user@gold:$
>
>So it works. Now I change the line:
>
>imglist.k .... to imgdisp.k or as follows:
>mcenv -f 512x512 << EOL
>imgdisp.k DANIEL/IMAGES DATE=$1 TIME=$2 SF=YES
>EOL
>
>
>Now I run it:
>
>odt_user@gold:$ mcopen 2000208 02:00:00
>Beginning Image Data transfer, bytes= 263072
>imgdisp.k: Frame 1 does not exist
>imgdisp.k: Failed to write nav for frame 1
>IMGDISP: loaded frame 1
>imgdisp.k: done
>odt_user@gold:$
>
>Question: any suggestions on what I'm missing here?
>
>By the by, if I just type mcenv at the command prompt
>and then enter command:
>
>$ mcenv
>& imgdisp.k DANIEL/IMAGES SF=YES LATLON=14.63 122.9 DATE=2000208 TIME=02:00:00
>
>I get:Beginning Image Data transfer, bytes= 308128
>IMGDISP: loaded frame 1
>imgdisp.k: done
>
>BUT I DON'T SEE ANY IMAGES POP UP.
Wait a minute. Are you expecting an image frame to be created? If
so, you won't. 'mcenv' creates the shared memory segments that McIDAS
uses for a variety of things like the image/graphic frames. It does not,
however, run a process to visualize them for you. To do that, you would
need to run mcimage:
$ mcenv
mcimage &
imgdisp.k DANIEL/IMAGES SF=YES LATLON=14.63 122.9 DATE=2000208 TIME=02:00:00
>I BELIEVE I HAVE SET UP THE DISPLAY TO MY LOCAL MACHINE
>but I am doing something wrong?
Yes, partly. In order to visualize an image, you have to run
'mcimage'. This would explain your comment about not seeing any images
pop up. It doesn't, however, explain the error you saw in 'mcopen'.
While in 'mcopen', you need to ask yourself what you want to do with
the image that you load before exiting the script. If loading it is
all that you want to do, then you need to modify it to be something
like:
#!/bin/sh
MCHOME=/users2/mcidas
PATH=$MCHOME/bin:$MCHOME/help
PATH=$PATH:/bin:/usr/bin:/etc:
PATH=$PATH:/usr/bin/X11:/common/tool/bin:.
MCPATH=/users/hnl/mcidas/data:/users2/mcidas/help:/users2/mcidas/data:/users2/mcidas/help
export PATH
export MCPATH
# check to make sure that this host is allowed (run xhost)
DISPLAY=tape-bk:0
export DISPLAY
args="DANIEL/IMAGES SF=YES DATE=$1 TIME=$2 LATLON=$3 $4"
mcenv -f 512x512 << EOL
mcimage &
imgdisp.k DANIEL/IMAGES DATE=$1 TIME=$2
wait.k 20
EOL
The changes are:
o run mcimage so you can see the image you are loading
o run wait.k so that you have some time to look at the image before the
script exits and the shared memory segments are removed (and the
image frame in shared memory goes away)
>Thanks Tom, Craig
No problem.
>p.s. Tom, I'm thinking about taking a job at FSL
>working on AWIPS software. The job is a great
>opportunity but I'm afraid it might be a culture
>shock for me, my wife and our parrot.
It will definitely be a shock for your parrot!
>I grew up in boulder but that was a long time ago.
Yes, Boulder has really changed since the first time I came here (1973).
I seems to get more crowded and more expensive by the month.
>Anyway, if I come I'll drop on by, maybe I can talk you
>into going to a couple of basketball games.
Sounds good to me!
Tom