[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
20021017: saving frame contents into GIF files using FRMSAVE
- Subject: 20021017: saving frame contents into GIF files using FRMSAVE
- Date: Fri, 18 Oct 2002 13:18:40 -0600
>From: Sridharareddy Duggireddy <address@hidden>
>Organization: USF
>Keywords: 200210162107.g9GL7S107707 McIDAS FRMSAVE
Sridharareddy,
>Thank you very much for your reply.
>I need to display images and save them in some subdirectory using scripts.
I send out two example Bourne shell scripts that are used to run
McIDAS programs outside of a McIDAS-X session, mcrun.sh and mcbatch.sh
(for example, from the Unix command line; from cron; etc.).
These scripts:
o get installed in the ~mcidas/data directory by the McIDAS installation
process
o are designed to be copied into local versions and used at sites.
Do not use these files directly! If you do (and you don't rename
them), your work will be lost the next time that McIDAS is installed
on your system!!
o the local copy of the files, appropriately renamed, need to be edited
to set environment variables to match the McIDAS installation at your
site. The files contain docuemntation blocks that tell one what
environment variables may need to be modified.
mcrun.sh is designed to run a sequence of McIDAS commands. mcbatch.sh
is designed to run a McIDAS BATCH file whose name is specified on the
mcbatch.sh execution command line (e.g., mcbatch.sh MYSCRIPT.BAT).
McIDAS BATCH scripts can run several McIDAS commands in sequence.
To understand how these scripts work, I recommend that you create a simple
example. Try the following:
o login as the user that will be running the script. Try this as
a user that is NOT 'mcidas' first, say 'user'
o CD to the user's McIDAS working directory:
<login as 'user'>
cd mcidas/data
o copy ~mcidas/data/mcrun.sh into a local, renamed copy in your McIDAS
working directory:
cp ~mcidas/data/mcrun.sh mymcrun.sh
o edit your local copy of mcrun.sh, mymcrun.sh
Set MCHOME to the HOME directory of the user 'mcidas'. If the McIDAS
installation on your system was done as recommended in the Unidata
McIDAS web pages, this variable should not need to be changed.
Set MCLOG to the file that you would like to contain log output messages
from commands run from the script. You can make this anything you like,
but be sure to specify the file with a fully qualified pathname in
a directory you have write permission for.
Setup a sequence of commands to run. This sequence needs to be placed
between the 'mcenv << EOF' and 'EOF' lines near the bottom of the
script.
As a simple example, let's do the following:
1) display a GOES-East IR image for 18:15 Z centered over Tampa Bay, FL
blown up by a factor of 2
2) draw a map on top of the image just loaded
3) display temperatures on top of the satellite image
4) save the display into a GIF (tm) file
Here is an example of how this might look (there are many possibilities):
mcenv << EOF
imgdisp.k RTIMAGES/GE-IR STA=KTBW TIME=18:15 EU=IMAGE MAG=2
map.k H
sfcplot.k T OLAY FRAME
frmsave.k 1 20022901815.gif
exit
EOF
NOTE: All of the commands listed above run within a McIDAS environment
created by 'mcenv'. The 'exit' after the 'frmsave.k' exits this McIDAS
environment.
Once you have that working the way you want, there are some things you can
do to fine tune your display. Here are some things to consider:
o one frame is created by a simple invocation of 'mcenv'
o the default size of the frame created by 'mcenv' is 640x480
o the default number of image colors used in the display created by 'mcenv'
is 48
o the default number of graphics colors used in the display created by 'mcenv'
is 8
You will most likely want to change the default number of image and
graphics colors and the size of the frame. Here is the same example
modified to create a frame with 128 image colors, 32 graphics colors,
and a size of 600x800 (you can get help for 'mcenv' in McIDAS by
running 'HELP mcenv' from the McIDAS command prompt):
mcenv -i 64 -g 32 -f 600x800 << EOF
imgdisp.k RTIMAGES/GE-IR STA=KTBW TIME=18:15 EU=IMAGE MAG=2
map.k H
sfcplot.k T OLAY FRAME
frmsave.k 1 20022901815.gif
exit
EOF
By playing with this simple example, you will be able to create the
kind of displays that you want.
Here is another example. In this case, we will split the display into
4 panels. In the first panel, we will display the GOES-East VIS image
for 18:15Z; in the second we will display the GOES-East IR image for
18:15Z; in the third we will display the GOES-East H2O image for
18:15Z; and in the 4 th we will display a surface map of temperatures
and plot the US interstate highways in white:
mcenv -i 64 -g 32 -f 800x1100 << EOF
# Panelize the frame (2 rows and 2 columns)
panel.k 2 2
# Panel 1 - GOES-East VIS image for 18:15Z
imgdisp.k RTIMAGES/GE-VIS STA=KTBW TIME=18:15 EU=IMAGE PAN=1
map.k H PAN=1
# Panel 2 - GOES-East IR image for 18:15Z
imgdisp.k RTIMAGES/GE-IR STA=KTBW TIME=18:15 EU=IMAGE PAN=2
map.k H PAN=2
# Panel 3 - GOES-East H2O image for 18:15Z blown up by 2 to match VIS/IR
imgdisp.k RTIMAGES/GE-WV STA=KTBW TIME=18:15 EU=IMAGE MAG=2 SU=H2O PAN=3
map.k H PAN=3
# Panel 4
sfcplot.k T FL 18 PAN=4
map.k X 7 FILE=OUTUSINT PAN=4
# Save the display
frmsave.k 1 20022901815.gif
# Done
exit
EOF
The display I got from the last example can be seen in:
http://www.unidata.ucar.edu/staff/tom/gifs/usfexample.gif
>I have to retrieve them and display in webpage.
FRMSAVE can save the GIF (or JPG, PPM, BMP, etc.) output file in the
directory of your choice (assuming you have write permission there).
Simply give it the fully qualified pathname.
>We have operating systems as linux.
The above script will work on any system I support Unidata McIDAS on.
Linux is one of them.
>Can you please explain me how to do this?
Please try the above examples. Once you have the feel for them, we
can discuss more complicated things to do.
>Thank You,
No worries.
Tom