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

19990128: saving GIF (tm) files from McIDAS



>From: address@hidden (Kathy Fryberger)
>Organization: SDSMT
>Keywords: 199901281932.MAA29453 McIDAS SVGIF

Kathy,

>Is there a way to save a mcidas graphics display (i.e., SKEWT nnnn) in a 
>gif file?

Yes, use the SVGIF program.

>I would like to write a script that would obtain the latest skewt
>for our area and display it on a web page.   thanks!   kathyf

This should be easy to do.  Just remember that if you are going to run
multiple McIDAS programs from a Unix shell script, you will need to
make sure that they all run in the same mini-McIDAS session.

Here is a graphic example of what I mean.  Suppose I wrote the following
Unix shell script:

--------------------------- cut begin ---------------------------

#!/bin/sh

# Define macros needed for McIDAS-7.X environment
#
# Set MCHOME to be the home directory of your 'mcidas' installation.

# Set MCDATA to be the working directory of your 'mcidas' installation.
# For this example, I will assume that this is /home/mcidas/workdata
#
# Set MCPATH to include MCDATA as its first directory.  I assume
# in this example that McIDAS-X was installed in /home/mcidas.

MCHOME=/home/mcidas
MCDATA=$MCHOME/workdata
MCPATH=${MCDATA}:$MCHOME/data:$MCHOME/help
MCLOG=$MCDATA/process.log

# Setup PATH so that the McIDAS-X executables can be found

PATH=$MCHOME/bin:$PATH

# Send all textual output to the log file
exec 2>$MCLOG 1>&2

# cd to the MCDATA directory
cd $MCDATA

# Plot a skewt diagram.  Then save the contents of frame 1 into a GIF.

echo Running SKEWT and SVGIF...

MCPATH=$MCPATH PATH=$PATH skewt.k 72469 1
MCPATH=$MCPATH PATH=$PATH svgif.k 1 display.gif

# Done
exit 0

--------------------------- cut end ---------------------------

You might think that this would do what you are after: display a Skew-T
diagram in frame 1 and then save it as a GIF file.  What you would get,
however, is a GIF of a blank frame.  The reason is that each separate
McIDAS invocation will create its own mini-session in which it will run,
but the mini-session will be destroyed after the program finishes.  So,
the skewt gets plotted into frame 1 (there is only one 640x480 frame
created by default in the mini-session, AND then the session is deleted
after skewt.k (i.e. the frame goes away).  When skewt.k is executed
a NEW mini-session which has a new frame 1 which is blank.

What you want to do is replace the separate invocations of skewt.k and
svgif.k with the following code:

echo Plotting a Skew-T diagram and saving it as a GIF

MCPATH=$MCPATH PATH=$PATH mcenv << 'EOF'

skewt.k 72469 1
svgif.k 1 display.gif
exit

EOF

Here the McIDAS routine 'mcenv' is run which creates the mini session
in which both skewt.k and svgif.k run.  The 'exit' at the end of 
the McIDAS routines tells 'mcenv' to exit and remove the mini-session
that was created.

The full script would then look like:

--------------------------- cut begin ---------------------------

#!/bin/sh

# Define macros needed for McIDAS-7.X environment
#
# Set MCHOME to be the home directory of your 'mcidas' installation.

# Set MCDATA to be the working directory of your 'mcidas' installation.
# For this example, I will assume that this is /home/mcidas/workdata
#
# Set MCPATH to include MCDATA as its first directory.  I assume
# in this example that McIDAS-X was installed in /home/mcidas.

MCHOME=/home/mcidas
MCDATA=$MCHOME/workdata
MCPATH=${MCDATA}:$MCHOME/data:$MCHOME/help
MCLOG=$MCDATA/process.log

# Setup PATH so that the McIDAS-X executables can be found

PATH=$MCHOME/bin:$PATH

# Send all textual output to the log file
exec 2>$MCLOG 1>&2

# cd to the MCDATA directory
cd $MCDATA

# Now run 'mcenv' to create a McIDAS-X environment in which all of the
# scouring routines will run.  NOTE that you need to modify the parameters
# in the commands to be run to match your system setup.

echo Plotting a Skew-T diagram and saving it as a GIF

MCPATH=$MCPATH PATH=$PATH mcenv << 'EOF'

skewt.k 72469 1
svgif.k 1 display.gif
exit

EOF

# Done
exit 0

--------------------------- cut end ---------------------------

Tom


pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy