* +-======-+ * Copyright (c) 2003-2007 United States Government as represented by * the Admistrator of the National Aeronautics and Space Administration. * All Rights Reserved. * * THIS OPEN SOURCE AGREEMENT ("AGREEMENT") DEFINES THE RIGHTS OF USE, * REPRODUCTION, DISTRIBUTION, MODIFICATION AND REDISTRIBUTION OF CERTAIN * COMPUTER SOFTWARE ORIGINALLY RELEASED BY THE UNITED STATES GOVERNMENT AS * REPRESENTED BY THE GOVERNMENT AGENCY LISTED BELOW ("GOVERNMENT AGENCY"). * THE UNITED STATES GOVERNMENT, AS REPRESENTED BY GOVERNMENT AGENCY, IS AN * INTENDED THIRD-PARTY BENEFICIARY OF ALL SUBSEQUENT DISTRIBUTIONS OR * REDISTRIBUTIONS OF THE SUBJECT SOFTWARE. ANYONE WHO USES, REPRODUCES, * DISTRIBUTES, MODIFIES OR REDISTRIBUTES THE SUBJECT SOFTWARE, AS DEFINED * HEREIN, OR ANY PART THEREOF, IS, BY THAT ACTION, ACCEPTING IN FULL THE * RESPONSIBILITIES AND OBLIGATIONS CONTAINED IN THIS AGREEMENT. * * Government Agency: National Aeronautics and Space Administration * Government Agency Original Software Designation: GSC-15354-1 * Government Agency Original Software Title: GEOS-5 GCM Modeling Software * User Registration Requested. Please Visit http://opensource.gsfc.nasa.gov * Government Agency Point of Contact for Original Software: * Dale Hithon, SRA Assistant, (301) 286-2691 * * +-======-+ function track (args) ******************************************************** **** **** Usage: track filename **** ******************************************************** * Determine if tracking file exists * --------------------------------- if (args="") name = dum.track ioflag = 0 tbeg = 1 'getinfo tdim' tend = result write(name,tend) else name = subwrd(args,1) tbeg = subwrd(args,2) tend = subwrd(args,3) if(tbeg="" ) ; tbeg=1 ; endif if(tend="" ) 'getinfo tdim' tend = result endif ioflag = 1-sublin( read(name),1 ) if(ioflag!= 0) close = close(name) else write(name,tend) endif endif * Get tbeg & tend for time loop * ----------------------------- if (ioflag!=0) dummy = sublin( read(name),2 ) t = 1 while (t1) 'set line 1 1 3' 'draw line 'xold' 'yold' 'x' 'y 'set line 8 1 1' 'draw line 'xold' 'yold' 'x' 'y endif xold = x yold = y i = i + 1 endwhile 'swap' * Re-establish World Environment after SWAP * ----------------------------------------- 'set gxout contour' 'set ccolor 0' 'set clab off' 'set grads off' 'd slp' 'set ccolor rainbow' * Draw Mark at Current Position * ----------------------------- say 'Click on center position' 'q pos' x = subwrd(result,3) y = subwrd(result,4) 'q xy2w 'x' 'y lon.t = subwrd(result,3) lat.t = subwrd(result,6) 'define s = sqrt( us*us + vs*vs )' 'set gxout stat' 'set grads off' 'd slp/100' tmp = sublin(result,8) pmin = subwrd(tmp,4) slp.t = pmin 'd s' tmp = sublin(result,8) wmax = subwrd(tmp,5) write(name,lon.t,append) write(name,lat.t,append) write(name,slp.t,append) write(name,wmax ,append) * Final Picture * ------------- if(t=tend) * Draw Background BaseMap * ----------------------- 'set gxout contour' 'set ccolor 0' 'set clab off' 'set grads off' 'd slp' 'set rgb 99 236 236 236' 'basemap L 99 1' 'set ccolor rainbow' * Plot Main Picture (User Defined within trackplot.gs) * ---------------------------------------------------- 'trackplot.gs' * Draw Track to Previous Position * ------------------------------- i = 1 while (i<=t) 'q w2xy 'lon.i' 'lat.i x = subwrd(result,3) y = subwrd(result,6) 'set line 1' 'draw mark 3 'x' 'y' 0.1' 'set line 8' 'draw mark 3 'x' 'y' 0.05' if (i>1) 'set line 1 1 3' 'draw line 'xold' 'yold' 'x' 'y 'set line 8 1 1' 'draw line 'xold' 'yold' 'x' 'y endif xold = x yold = y i = i + 1 endwhile 'swap' endif t = t + 1 endwhile * 'wi geos1.'frame'.gif' close = close(name) endif ******************************************************** **** **** Display Track **** ******************************************************** if (ioflag!=0) frame = 1000 while (t1) 'set line 1 1 3' 'draw line 'xold' 'yold' 'x' 'y 'set line 8 1 1' 'draw line 'xold' 'yold' 'x' 'y endif xold = x yold = y i = i + 1 endwhile 'swap' t = t + 1 endwhile * 'wi geos1.'frame'.gif' close = close(name) * Write SLP Trace file * -------------------- '!remove sedfile' '!touch sedfile' '!remove 'name'.ctl' '!remove 'name'.data' 'run getenv "GEOSUTIL"' geosutil = result 'q ctlinfo' n = 1 while( n >0 ) line = sublin(result,n) word = subwrd(line,1) if( word = 'tdef' ) dt = subwrd(line,5) n = 0 else n = n + 1 endif endwhile 'set t 'tbeg 'getinfo date' begdate = result 'set gxout fwrite' 'set fwrite 'name'.data' tdim = tend-tbeg+1 i = 1 while( i<=tdim ) 'd 'slp.i i = i + 1 endwhile 'disable fwrite' 'set gxout contour' '!echo "s?track.data?"'name'.data?g >> sedfile' '!echo "s?DT?"'dt'?g >> sedfile' '!echo "s?TDIM?"'tdim'?g >> sedfile' '!echo "s?BDATE?"'begdate'?g >> sedfile' '!/bin/cp 'geosutil'/plots/grads_util/track.tmpl .' '!sed -f sedfile track.tmpl > 'name'.ctl' endif