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

[McIDAS #GYT-719991]: Interesting batch file errors



Hi Paul,

re:
> Here is a new one.
> 
> I have a script that runs a series of batch files. It reads thought an
> array of maybe 100 or more sectors that get passed to a batch file like this
> 
> system("batch.k $lat $lon $mag $region $res $goes $sattype
> /home/scripts/mcidas2/radarcomps/RADARCOMP.BAT");

OK.  Given your comment below about getting errors with the graphics
color number(s) specified being larger than what is allowed, I will
need to see the part of your procedure that creates the McIDAS
environment in which the BATCH file is run.  The McIDAS environment
is created by a 'mcenv' invocation either explicitly by the user
or by a program run independently (like BATCH).

If one creates the McIDAS environment by running 'mcenv', then there
is the opportunity to specify how many graphic and image levels exist
in the environment, etc.  The set of command line flags that are
valid for a 'mcenv' invocation can be seen from the McIDAS HELP:

% help.k mcenv
mcenv -- execute in a McIDAS environment
  mcenv [-f <framespec>]... [-e <bytes>] [prog arg...]
Remarks:
  Command line arguments:
     -f <framespec>  specifies a set of frames to include in the
                     McIDAS environment

                     A <framespec> of the form address@hidden in which N, L,
                     and E represent integers, and x is the small
                     letter x, means to allocate N frames of L lines
                     by E elements.

                     A <framespec> of the form LxE means to allocate
                     1 frame of L lines by E elements.

                     A <framespec> of the form N means to allocate N
                     frames of 480 lines by 640 elements.

                     Multiple -f options can be given in order to
                     specify frames of different sizes.

                     If there are no -f options, the default
                     environment is as if ``-f address@hidden'' were
                     given.

     -e <bytes>      specifies how large to make the MAKFRM free
                     space pool in the McIDAS environment

                     The <bytes> number can be suffixed with a k or
                     an m, for kilobytes or megabytes.

                     If there is no -e option, the default
                     environment is as if ``-e 0'' were given.

     -g <number>     specifies number of graphics color levels
                     (McIDAS-X only)

     -i <number>     specifies number of image color levels
                     (McIDAS-X only)

     prog arg...     program to run in the McIDAS environment

                     If no program is specified, the default
                     program to run is $SHELL.

  The mcenv command creates an environment (shared memory block) and
  then forks and execs the given program.  When the program exits,
  mcenv removes the shared memory object and exits.

  mcenv processes can nest; commands run under an inner mcenv can
  not see or affect the environment created by the outer mcenv.
----------

If you are relying on BATCH to create the environment, it should be
the case that a default environment is created: 480x640, 8 graphic
levels, etc.  Since you are using at least 12 graphic levels, you want
to make sure to create the environment yourself with a purposeful
invocation of 'mcenv'.

Reminder: Unidata McIDAS has a couple of example shell scripts that
have the pieces for setting up the McIDAS environment:

% ls ~mcidas/data/*.sh
/home/mcidas/data/mcbatch.sh*  /home/mcidas/data/mcrun.sh*

The operative part of 'mcrun.sh' is the piece:
mcenv << EOF

# put McIDAS-X commands you want to run here, one command per line.

# Example (note that these lines are commented out!!):
#
# dataloc.k ADD GINIEAST adde.ucar.edu
# eg.k
# imgdisp.k GINIEAST/GE1KVIS STA=KMIA MAG=-2 EU=IMAGE SF=YES
# map.k H
# bar.k
# frmsave.k 1 miamivis.gif

# done
  exit

EOF

This invocation of 'mcenv' creates a default environment.  If I want
to create an environment that has a single frame that is 600x800 with
16 graphic levels and 128 image levels, the 'mcenv' invocation would
look like:

mcenv -f address@hidden -g 16 -i 128 << EOF

 ... McIDAS commands followed by 'exit'

EOF

re:
> Do you have any idea why these things may be happening? And if so, what can
> I do about it?

I have a question and an observation:

- why are you running the 'K' command in your script?

  'K' toggles the state of the image portion of the display.
  Multiple invocations of 'K' have to be done carefully so
  that the toggle is in the state desired after each invocation.

  Also, I am not sure if 'K' is run synchronously or asynchronously,
  so when the image portion of the display is toggled on/off might
  not be as predictable as you might think.  A 'WAIT' invocation
  after a 'K' invocation could be used to insure that the result of
  the 'K' invocation is active before proceeding.

Cheers,

Tom

> __________________________________________________
> Here is RADARCOMP.BAT
> 
> REM This batch file makes the images for the NEXRAD COMPS
> REM
> REM It should be called by createnexcomps.pl
> REM
> 
> REM %1 and %2 are lat and lon as stored in images_hashes
> REM %3 is magnification
> REM %4 is the name of the plot
> REM %5 is for resolution of images, 1km, 2km, regional for the directory
> REM %6 is east or west for GOES I will need this for regional
> 
> ERASE F 1
> GU REST RADAR 1
> 
> IF "%6"=="west" GOTO WEST
> IF "%6"=="regional" GOTO REGIONAL
> IMGDISP SAT.4467 1 LAT=%1 %2 EU=MYBREF MAG=%3
> GOTO CONTINUE
> 
> :WEST
> IMGDISP SAT.4468 1 LAT=%1 %2 EU=MYBREF MAG=%3
> GOTO CONTINUE
> 
> :REGIONAL
> IMGDISP SAT.4469 LAT=%1 %2 EU=MYBREF MAG=%3
> GOTO CONTINUE
> 
> REM /home/apache/climate/sirvatka/rad
> 
> :CONTINUE
> MAP H 14 GRA=1 IMA=1
> FRMLABEL IMA=1 "NEXRAD 1KM MOSAIC (DAY)  (HHMM)
> BAR COLOR=16 SU=MYBREF GRA=1
> ZA 6 7 C GRA=1 POS=8 700 "NEXLAB-College of DuPage
> ZA 6 12 L GRA=1 POS=5 789 "$T
> 
> REM FRMSAVE 1 /home/apache/climate/data/satellite/%5/%4/current/%4.rad.gif
> FRMSAVE 1 /home/apache/climate/sirvatka/rad/%4.rad.gif
> 
> REM EU REST IMAGE
> REM FRMSAVE 1
> /home/apache/climate/data/satellite/%5/%4/current/%4.radgray.gif
> REM EU REST MYBREF
> 
> WWDISP NAV=C WID=1 COL=5 6 5 6 12 12 1 7 7 9 16 PLO=NBOX WLI=YES
> REM FRMSAVE 1 /home/apache/climate/data/satellite/%5/%4/current/%4-ww.gif
> FRMSAVE 1 /home/apache/climate/sirvatka/rad/%4-ww.gif
> 
> EG 1
> BAR COLOR=16 SU=MYBREF GRA=1
> REM FRMSAVE 1
> /home/apache/climate/data/satellite/%5/%4/current/%4.rad.nomap.gif
> FRMSAVE 1 /home/apache/climate/sirvatka/rad/overlays/%4-ww.gif
> K
> 
> EG 1 LEV=16
> WWDISP NAV=C WID=1 COL=5 6 5 6 12 12 1 7 7 9 16 PLO=NBOX WLI=YES
> REM FRMSAVE 1 /home/apache/climate/data/satellite/%5/%4/overlays/%4-ww.gif
> FRMSAVE 1 /home/apache/climate/sirvatka/rad/overlays/%4-ww2.gif
> K
> 
> 
> :END
> 
> _______________________________________________________
> 
> Everything works *USUALLY* But sometimes the file that is saved does not
> have the actual radar imagery on it. Its as though the file is saved before
> the imagery is plotted (even though the map has been put on. This is random
> and fails at diverse times.
> 
> Also, there are times (around 15 times within the various calls that this
> error comes out
> WWDISP NAV=C WID=1 COL=5 6 5 6 12 12 1 7 7 9 16 PLO=NBOX WLI=YES
> WWDISP:
> WWDISP: Invalid Color Level.
> WWDISP: 5th COL= argument is too big --> 12
> WWDISP: Must be valid 'Color Level' integer value within range 1 thru 8.
> WWDISP:
> WWDISP: done
> WWDISP failed, RC=1
> 
> Now, this is a command used many times and there are 16 graphics levels. I
> works most of the time. nothing else changes.
> 
> Do you have any idea why these things may be happening? And if so, what can
> I do about it?
> 
> Thanks

Cheers,

Tom
--
****************************************************************************
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: GYT-719991
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.