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

[McIDAS #ZIF-240347]: McIDAS frmsave.k destination directory?

Hi Darrin,

> Hope this is the right place for this ...
> I've inherited an LDM/McIDAS installation and am trying to get some
> legacy code to work. I'm pretty close but am stuck on one thing.

OK.  Out of curiosity can you tell me:

- what version of McIDAS you are running (output of
  'cat ~mcidas/data/VERSION.TXT')

- what OS and OS version you are running on (output of 'uname -a')

- what version of the LDM you are running (output of 'ldmadmin config'
  in the LDM account)

If you are running a very old version of McIDAS, it would be a
good idea to upgrade.

> One of my shell scripts executes a few McIDAS commands via mcenv. One
> of these cmds is frmsave.k, which the script is using to save a gif
> file. frmsave.k seems to work ok, but it puts the gif in the "wrong"
> place - the $MCHOME/.mctmp dir.

This is very odd.  The location of the file created by frmsave.k
should be in the first writable directory of your MCPATH (set in
the MCPATH environment variable) or in the directory specified in
a file REDIRECTion.


- also, can you send me the LWPATH.NAM file that should be
  located in your $MCDATA directory?

> How can I control where frmsave.k writes the gif file?

Through the MCPATH setting that is in scope when the script runs
or by a file REDIRECTion that is in scope when the script runs.

> I would've
> thought this would be controlled by the MCDATA env variable, but I
> think I've got my MCDATA set to $MCHOME/workdata, but the gif doesn't
> end up there.

If your $MCDATA directory is the first directory in the MCPATH that is
in scope when your script runs, then it should be written to your
$MCDATA directory ** UNLESS ** there is a file REDIRECTion in
scope for GIF files.  By modifying the script to 'cd $MCDATA'
(in mod below) you will force McIDAS to use file REDIRECTions set in
the file $MCDATA/LWPATH.NAM.  If there is a REDIRECTion for GIF files
in that copy of LWPATH.NAM, then we either have to remove it or
set it to the location where you want your output file.

> Is invoking frmsave via mcenv causing my environment
> (i.e. MCDATA) to change?

Invoking frmsave.k via the script that runs 'mcenv' is
causing your environment to be set, but your script snippit
below shows that you are setting MCDATA but not MCPATH.

> I'm assuming McIDAS is dropping it
> into .mctmp because it doesn't know what else to do with it.

Putting the output GIF file in ~/.mctmp is strange, but it
may be because of your incomplete environment variable settings.

> I've experimented and discovered that if I hard-code the full path to
> the gif in the frmsave call, the gif goes where I want it.

Correct.  FRMSAVE (frmsave.k) is designed to allow the user to
specify the fully qualified pathname of the output file.

> But, I'd much rather control the destination via a variable.

You should be able to do this by controlling your MCPATH setting
and/or file REDIRECTion for *.GIF files.

> The relevant portions of the scripts/.BATS I'm running are below.
> Also, at the end is a snippet showing the error in my logfile. Note
> how the frmsave.k command just has the file name (i.e. no path to it)
> in the script. That's what I want to change - I want to be able to
> spec the path (via a variable).
> ========
> .BAT file run by batch.k script in my LDM/decoders dir
> ========
> NORTMAPR 9017 %2 9999 N4 NONE 0 9017 MAPAREA=9971 DEV=NNN
> REM Create visible images.
> OS "/home/ocs/mcidas/scripts/ocs_vis.sh > /home/ocs/mcidas/logs/
> vislog.pp 2>&1
> ========
> shell script run by the .BAT above (ocs_vis.sh)
> ========
> # Define path variables
> MCHOME=/home/ocs/mcidas
> MCDATA=$MCHOME/workdata

Add the following line here:

export MCPATH

> AREADIR=/home/ocs/ldm/data/mcidasd
> GIFDIR=/home/web/ocs/html/pub/weather/data/gifs
> GWDIR=$VISDIR/goes_west
> ORDIR=$VISDIR/oregon
> # Extract date/time from AREA files for filename.  Visible images are
> in AREA012* files.
> visname=`$SCRIPTDIR/areadate.pl $AREADIR/AREA012\*`
> ####################    Large Visible Images.    ####################
> # Set frame size for large images.
> mcenv -g 16 -i 238 -f 750x872 << 'EOF'
> # GOES-West.
> imgdisp.k VIS/IMAGES MAG=-2
> frmlabel.k JUST=L NLI=30 \"GOES-WEST Visible Band \(BAND\) FROM \(DAY\) AT 
> \(HHMM\) UTC
> za.k \"Oregon Climate Service
> gu.k MAKE 3 BLACK
> frmsave.k 1 vis_gw.gif
> eg.k
> eg.k I
> =============
> logfile
> =============
> Beginning Image Data transfer, bytes= 613456
> IMGDISP: loaded frame  1
> imgdisp.k: done
> EU: Specified enhancement does not exist
> EU: Done

This error is likely being caused by MCPATH not being set.  It should
go away with the small mod I included above.

> MAP: Completed frame 1
> za.k: Done
> gu.k: Done
> gu.k: Done
> Frame saved in /usr/local/ldm/.mctmp/304087045/vis_gw.gif
> Erased graphic frame(s) 1-1
> Erased image frame(s) 1-1


Unidata User Support                                    UCAR Unidata Program
(303) 497-8642                                                 P.O. Box 3000
address@hidden                                   Boulder, CO 80307
Unidata HomePage                       http://www.unidata.ucar.edu

Ticket Details
Ticket ID: ZIF-240347
Department: Support McIDAS
Priority: Normal
Status: Closed

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.