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

20021017: saving frame contents into GIF files using FRMSAVE

>From: Sridharareddy Duggireddy <address@hidden>
>Organization: USF
>Keywords: 200210162107.g9GL7S107707 McIDAS FRMSAVE


>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

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

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

map.k H
sfcplot.k T OLAY FRAME
frmsave.k 1 20022901815.gif


NOTE: All of the commands listed above run within a McIDAS environment
created by 'mcenv'.  The 'exit' after the 'frmsave.k' exits this McIDAS

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

map.k H
sfcplot.k T OLAY FRAME
frmsave.k 1 20022901815.gif


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
map.k H PAN=1

# Panel 2 - GOES-East IR image for 18:15Z
map.k H PAN=2

# Panel 3 - GOES-East H2O image for 18:15Z blown up by 2 to match VIS/IR
map.k H PAN=3

# Panel 4
sfcplot.k T FL 18 PAN=4

# Save the display
frmsave.k 1 20022901815.gif

# Done


The display I got from the last example can be seen in:


>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.


NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly 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.