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

20040714: gempak script colors



Mark,

You must use the GPCOLOR program befor drawing in 24 bit.
You script sets the colors after thay are draw, which will reset the color
indicies in 8 bit, but cannot change direct color mapping in 24 bit.
Rather, the next program you run will inherit those settings.

You can either run gpcolor whith you settings before drawing, or use a 
specific coltbl.xwp for your application. Both should work, but the
coltbl.xwp approach should be faster since it eliminates the running
of another program.

Steve Chiswell



>From: Mark Tucker <address@hidden>
>Organization: UCAR/Unidata
>Keywords: 200407141938.i6EJcsaW022819

>
>--Boundary-00=_vsY9ADNi4SdmHBo
>Content-Type: text/plain;
>  charset="us-ascii"
>Content-Transfer-Encoding: 7bit
>Content-Disposition: inline
>
>
>I've just installed the most recent release of gempak (5.7.2p2) on Linux.  The
>  
>interactive gempak applications on these machines all behave normally.  
>Several of the scripts that we have for generating graphics on our web server 
>are not producing the expected colors.  For some reason, altering the color 
>number 101 does not change the background color, but changes the US map line 
>colors instead. I am trying to get a white background on my maps.  The other 
>colors are also incorrect compared with how they were produced with gempak 
>5.6m but I figure if I can resolve the background issue the rest will make 
>sense.  I have attached a copy of the csh script I have been working with.  
>There is no coltbl.xwp in the working directory for this script.
>
>
>-- 
>Mark Tucker
>Meteorology Dept. Systems Administrator
>Lyndon State College
>http://apollo.lsc.vsc.edu
>address@hidden
>(802)-626-6328
>
>--Boundary-00=_vsY9ADNi4SdmHBo
>Content-Type: application/x-shellscript;
>  name="avntest.csh"
>Content-Transfer-Encoding: 7bit
>Content-Disposition: attachment;
>       filename="avntest.csh"
>
>#!/bin/tcsh
>
># DESCRIPTION: This script crates AVN Model IMAGERY for the web.
>
>#=============================================================================
>
>echo Running $0 at `date`
>
>#------------------
>#Standard Variables
>#------------------
>setenv DISPLAY localhost:60
>source ~gempak/Gemenviron
>
>#------------------
># job Variables
># Set Variables needed for Global Variable Lists
>#------------------
>set MNAME  = "avn"
>set GMNAME = "avn213"
>set LEVEL  = "250"
>
>#------------------
>#Source the Global Variable Lists
>#------------------
>#source $HOME/scripts/models/models.var
>set LDM_DATA = /mnt/data
>set WORKDIR = $HOME/workdir/${MNAME}/${LEVEL}
>set GDFILE = $MODEL/`ls $MODEL | grep ${GMNAME} | tail -1`
>set RUCGDFILE = $MODEL/`ls $MODEL | grep ${GMNAME} | tail -3 | head -1`
>set DATE=`date -u +%m%d`
>set TIME=`date -u +%H`
>set SAVEDIRROOT = $LDM_DATA/web/models
>set SAVEDIR = ${SAVEDIRROOT}/${MNAME}/${LEVEL}
>set RUN=`ls $MODEL | grep ${GMNAME} | tail -1 | awk -F_ '{print $1}'`
>set DIMENSIONS = "766;587"
>set MAPAREA = "15;-120;60;-25"
>set MAPAREA_US = "17;-116;52;-50"
>#
>
># Xvfb :60 is a 1024x768x24 display Started with the following command:
># /usr/X11R6/bin/Xvfb :60 -screen 0 1024x768x24
>setenv DISPLAY localhost:60
>#
>
># testing variables
>set WORKDIR = $HOME/test
>set SAVEDIR = $HOME/testout
>
>#------------------
>#Create Working or Scratch Directory and Saving Directory
>#------------------
>if( ! -d $WORKDIR ) then 
>    mkdir $WORKDIR
>endif
>if( ! -d $SAVEDIR ) then
>    mkdir $SAVEDIR
>endif
>
>
>#Move into working directory
>cd $WORKDIR
>
>#------------------
>#Foreach Loop for Full Run
>#------------------
>foreach FORECAST ( 00 24 )
>
>
>#Run Proper GEMPAK Programs
>
>
>#Run GDCNTR for Wind Contouring and Filling
>gdcntr << EOF
>
>    GDFILE=   $GDFILE
>    GDATTIM=  f$FORECAST    
>    GVCORD=   pres
>    PANEL=    0/0
>    SCALE=    999    
>    CTYPE=    c/f    
>    LINE=     0
>    HILO=
>    HLSYM=
>    REFVEC=
>    TEXT=     1/3//HW
>    CLEAR=    NO
>    GAREA=    ${MAPAREA}
>    PROJ=     STR/90.0;-95.0;0.0
>    MAP=      30
>    \$MAPFIL= HIPOWO.CIA
>    LATLON=   0
>    CONTUR=   3/3
>    SKIP=     0
>    CTYPE    = c/f
>    DEVICE=   GF|$SAVEDIR/$FORECAST.gif.1|${DIMENSIONS}
>    CLRBAR=   32/V/LL/.002;.05//    
>    TITLE=    32/-2/AVN 250mb Wind Speed and Heights (m)  
>    GLEVEL=   $LEVEL
>    GFUNC=    knts(sped)
>    CINT=     1
>    FINT=     20/0/600
>    FLINE   = 0;6;21;22;20;23;24;25;26;27;28;29;30
>
>r
>
>e
>
>EOF
>
>#Run GDCNTR for Height Countours
>gdcntr << EOF
>
>    GDFILE=   $GDFILE
>    GDATTIM=  f$FORECAST
>    GVCORD=   pres
>    PANEL=    0/0  
>    SCALE=    999
>    CTYPE=    C
>    LINE=     32/-3/2/2
>    HILO=
>    HLSYM=
>    CLRBAR=   32
>    GVECT=
>    WIND=
>    REFVEC=
>    TEXT=     1/3//HW
>    CLEAR=    NO
>    GAREA=    ${MAPAREA}
>    PROJ=     STR/90.0;-95.0;0.0
>    MAP=      30
>    \$MAPFIL= HIPOWO.CIA
>    LATLON=   0
>    DEVICE=   GF|$SAVEDIR/$FORECAST.gif.1
>    STNPLT=      
>    SATFIL=
>    RADFIL=
>    LUTFIL=
>    CONTUR=   3/3
>    SKIP=     0
>    FINT=     
>    FLINE=    
>    CLRBAR=   
>    TITLE=    32/-3/Lyndon State College Meteorology  
>    GLEVEL=   $LEVEL
>    GFUNC=    hght
>    CINT=     120
>    FINT=     
>    FLINE   = 
>
>r
>
>e
>
>EOF
>
>
>#Run GDPLOT for Wind Barbs
>gdplot << EOF
>
>    gdfile=   $GDFILE
>    gdattim=  f$FORECAST
>    glevel=   $LEVEL
>    gvcord=   pres
>    device=   gf|$SAVEDIR/$FORECAST.gif.1
>    panel=    0/0
>    skip=     0/2
>    scale=    999
>    gfunc=
>    gvect=    kntv(wnd)
>    wind=     bk1/0.7/0.7//10.7
>    title=    32/-1/Valid ~
>    clear=    no
>
>r
>
>e
>
>EOF
>
>
>
>#Run GPCOLOR for Custom Colors
>gpcolor << EOF
>
>   COLORS= 101=WHITE;1=BLACK;26=139:0:0;25=205:0:0;24=238:64:0;23=255:127:0
>   DEVICE= GF|$SAVEDIR/$FORECAST.gif.1
>
>r
>
>e
>
>EOF
>
>gpcolor << EOF
>
>    COLORS= 30=139:71:38
>    DEVICE= GF|$SAVEDIR/$FORECAST.gif.1
>
>r
>
>e
>
>EOF
>
>
>
>#Run gpend to clean up processes
>gpend
>
>  
>#Check to Replace File
>set filesize=`ls -l ${SAVEDIR}/${FORECAST}.gif.1 | awk '{print $5}'`
>echo $filesize
>if($filesize > 10100) then
>     echo creating ${FORECAST}.gif with size ${filesize} bytes
>     mv ${SAVEDIR}/${FORECAST}.gif.1 ${SAVEDIR}/${FORECAST}.gif
>else
>     echo empty file -- not moving
>     rm ${SAVEDIR}/${FORECAST}.gif.1
>endif
>
>echo done with ${FORECAST} forecast time
>
>
>#End forecast loop
>end
>
>
>#Run GPEND again
>gpend
>
>
>#Cleanup NTS files in the Workding Directory
>cd $WORKDIR
>rm -f *.nts
>
>
>echo done.
>#
>
>--Boundary-00=_vsY9ADNi4SdmHBo--
>
--
NOTE: All email exchanges with Unidata User Support are recorded in the
Unidata inquiry tracking system and then made publically 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.