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

20000811: Problems with MCENV under a shell script...



>From: McIDAS <address@hidden>
>Organization: University of Puerto Rico
>Keywords: 200008111642.e7BGgYN02913 McIDAS-X scripting

Karli,

It has been so long since I heard from you that I figured that you
had moved on from UPR.

>  I've been working on a shell script for creating a looped image and
>saving it on to disk.  It works well on one resolution (480x640) however
>on a higher resoltion it failes.  I've tried increating the amount of
>memory for the frames, and searched through the archives but didn't find
>the reference for the error. 

OK.

>  I am using a shell script that then calls another batch file:
> 
>-----------------------------------------------------------------
>mcenv -f 10@600x800 -e 1000000 -g 16 -i 64 << 'EOF'
>batch.k \"/user2/people/webmaker/mcidas/data/TEMP0025.BAT
>exit
>EOF
>exit 0

First off, the '-f 10@600x800' is sufficient to create the frames
you want.  The '-e 1000000' sets aside additional memory so that
more frames can be created by the McIDAS routine MAKFRM (makfrm.k).
You don't need it here.

>-----------------------------------------------------------------
>and the batch file is as folows:
>-----------------------------------------------------------------
>EG 1 10
>
>SF 1 10
>
>IMGDISP RTIMAGES/GE-IR ALL=1 10 LATLON=32 82 MAG=-2 EU=IMAGE SF=YES
>REFRESH='MAP H GRA=(GRA);BAR GRA=(GRA) ORI=VER NO SU=IRTEMP'; RUN 1 10 3
>10 CL=Y FILE=LBDR.MCB;TERM L ON

A quick comment here.  There is no need to setup the loop before saving
the frames to disk.

>-----------------------------------------------------------------
>This combination works fine at 640 by 480, but at 600 by 800 it fails
>after drawing the 8th frame, and gives the following set of errors:
>-----------------------------------------------------------------
>
>
>MAP: completed frame  7
>IMGDISP: loaded frame  10
>MAP H GRA=  10 ;BAR GRA=  10  ORI=VER NO SU=IRTEMP
>IMGDISP: done
>EU: Restoring IMAGE.ET     to frame(s)=  10
>EU: Done
>Done
>LB 1 10
>    Image Frame=    1    2    3    4    5    6    7    8    9   10
>          Dwell=    9    6    6    6    6    6    6    6    6    6
>LB: Done
>DR 9*3 10
>MAP: completed frame  8
>    Image Frame=    1    2    3    4    5    6    7    8    9   10
>          Dwell=    3    3    3    3    3    3    3    3    3   10
>DR: Done
>Done
>batch.k: BATCH done /user2/people/webmaker/mcidas/data/TEMP0027.BAT
>Done
>MAP: Failed to attach to shared memory
>MAP: completed frame  9
>Cannot connect to existing positive UC
>BAR failed, rc=1
>MAP: Failed to attach to shared memory
>MAP: completed frame  10
>Cannot connect to existing positive UC
>BAR failed, rc=1
>-----------------------------------------------------------------


>as you could see all of the 10 frames are loaded with IMGDISP, but then
>the last few MAP commands fail, and then BAR fails, stopping the
>execution of the batch file.

Right.  What is happening is that the MAP commands are being run
asynchronously.  They are still running when the BATCH execution
finishes.  When batch.k finishes, the mcenv invocation exits and the
shared memory segments that represent the frames are freed.  When MAP
finally gets around to running for the last frames, they have
disappeared, so the error message is sent.

>I think that the process is running out of
>memory based on the error messages, but even if such is the case i can't
>give it more.  Do you have any suggestions as for ways to fix this
>problem? 

I don't think that the memory is the issue.  I suggest modify your
shell script to be:

#!/bin/sh
MCDATA=...
MCPATH=...
PATH=...
cd $MCDATA
export MCDATA MCPATH PATH
mcenv -f 10@600x800 -g 16 -i 64 << 'EOF'
  batch.k \"/user2/people/webmaker/mcidas/data/TEMP0025.BAT
  exit
EOF
exit 0

Then modify the BATCH file to be:

EG B 1 10
SF 1
IMGDISP RTIMAGES/GE-IR ALL=1 10 LATLON=26 73 MAG=-2 EU=IMAGE SF=YES 
REFRESH='MAP H GRA=(GRA);BAR GRA=(GRA) ORI=VER NO SU=IRTEMP'
WAIT 10
RUN 1 10 3 10 CL=Y FILE=LBDR.MCB;TERM L ON

(I changed the image load point so that the images would fill the
frames).

The 'WAIT 10' will pause for 10 seconds allowing the MAP and BAR
invocations from the REFRESH= keyword of IMGDISP to finish.  How long
you have to wait depends on how fast your system is.  After the WAIT,
you can then save the frames as you originally intended.

Of course, you could do everything from the Bourne shell script:

#!/bin/sh
MCDATA=...
MCPATH=...
PATH=...
cd $MCDATA
export MCDATA MCPATH PATH
mcenv -f 10@600x800 -g 16 -i 64 << EOF
  imgdisp.k RTIMAGES/GE-IR ALL=1 10 LATLON=26 73 MAG=-2 EU=IMAGE SF=YES 
REFRESH='MAP H GRA=(GRA);BAR GRA=(GRA) ORI=VER NO SU=IRTEMP'
  wait.k 10
  lb.k 1 10
  dr.k 9\*3 10
  term.k L ON
  exit
EOF
exit 0

>Thanks,

Did you ever get your ADDE setup working correctly?  The last time we
talked, there was a problem in doing compressed data transfers.

Also, try the following:

DATALOC ADD RTGINI ADDE.UCAR.EDU
DSINFO I RTGINI
SF 1
IMGDISP RTGINI/GPR1KVIS STA=KSJU EU=IMAGE MAG=-3 REFRESH='EG;MAP H 9'
SF 2
IMGDISP RTGINI/GPR1KVIS STA=KSJU EU=IMAGE MAG=-2 REFRESH='EG;MAP H 9'
SF 3
IMGDISP RTGINI/GPR1KVIS STA=KSJU EU=IMAGE MAG=1 REFRESH='EG;MAP H 9'
LB 1 3
DR 2*5 20
TERM L ON

What do you think?

Tom Yoksas