#!/bin/tcsh
#if (-e /home/disk/sys/local/NAWIPS-5.10.4/Gemenviron) then
#   source /home/disk/sys/local/NAWIPS-5.10.4/Gemenviron
#else
   source /home/disk/sage2/mm5rt/NAWIPS-5.10.4g2021bigmem/Gemenviron
#endif
setenv DISPLAY :1
foreach fac (1 2 3 5 10)
 @ xs = 711 * 2 * $fac
 @ ys = 663 * 2 * $fac
 set dir = "."
 if ($fac == 2) set dir = highres1
 if ($fac == 3) set dir = highres2
 if ($fac == 5) set dir = highres3
 if ($fac == 10) set dir = highres4
mkdir -p $dir
foreach fhr (`seq -w 0 3 72`)
   foreach fct (tmpc.2.f wind.2.b)
      set field = $fct:r:r
      set cint = $fct:r:e
      set type = $fct:e
      if ($field == "wind") then
        set gfun = "kntv(vecr(u10,v10))"
	if ($fac == 1) then
           set skip = 10
	else if ($fac == 2) then
           set skip = 5
	else if ($fac == 3) then
           set skip = 2
	else if ($fac == 5) then
           set skip = 1
	else if ($fac == 10) then
           set skip = 0
        endif
      else
        set gfun = $field
	set skip = ""
      endif
      if (! -e $dir/$field.$dom.$fhr.gif) then
gdplot2_gf <<EOF
 GDFILE   = mmout_d4.2022110300.f0${fhr}.0000.gem
 GDATTIM  = f$fhr
 GLEVEL   = 0
 GVCORD   = none
 PANEL    = 0
 SKIP     = 0
 SCALE    = 0
 GDPFUN   = $gfun
 TYPE     = $type
 CONTUR   = 0
 CINT     = $cint
 LINE     = 29;30 / 1;1 / 1;1 / 0 / 2 / 1
 FINT     = $cint
 FLINE    = 31-18;9-17
 \$mapfil = hipowo.cia + hirdus.nws + hiisus.nws + hicnus.uni
 HILO     =  
 HLSYM    =  
 CLRBAR   = 31
 WIND     = bk32
 REFVEC   =  
 TITLE    = 0
 TEXT     = 1.24/22//hw
 CLEAR    = YES
 GAREA    = dset
 IJSKIP   = $skip
 PROJ     = lcc/30;-121;60/nm
 MAP      = 32 + 0
 MSCALE   = 0
 LATLON   =  
 DEVICE   = gf|$dir/$field.$dom.$fhr.gif|$xs;$ys
 STNPLT   =  
 SATFIL   =  
 RADFIL   =  
 IMCBAR   =  
 LUTFIL   =  
 STREAM   =  
 POSN     = 0
 COLORS   = 1
 MARKER   = 0
 GRDLBL   = 0
 FILTER   = no
run

EOF
   endif
   if ($field != "tmpc" && ! -e $dir/$field.$dom.$fhr.png) convert -transparent white $dir/$field.$dom.$fhr.gif $dir/$field.$dom.$fhr.png
   end
end

end
gpend
