* +-======-+ * 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 * * +-======-+ * * script to draw a label * function label(args) 'set vpage off' while(1) maxlength = 0 if (args="") name = dum.stack ioflag = 0 else name = subwrd(args,1) ioflag = subwrd(args,2) endif say " " i = 1 numline = 1 while (i<=numline) say " " say "Enter Label" if (ioflag!=1) pull title.i write(name,title.i) else title.i = sublin( read(name),2 ) endif i = i+1 endwhile i = 1 length = getbits (title.i) if( length > maxlength ) maxlength = length endif * * Determine Position and Draw Legend Box * -------------------------------------- xlow =0. ylow =0. xhigh=0. yhigh=0. if (ioflag!=1) say "Draw Box Location for Label" 'set rband 21 box .25 .25 10.75 7.75' 'q pos ' xlow = subwrd(result,3) ylow = subwrd(result,4) xhigh = subwrd(result,8) yhigh = subwrd(result,9) write(name,xlow,append) write(name,ylow,append) write(name,xhigh,append) write(name,yhigh,append) else xlow = sublin (read(name),2) ylow = sublin (read(name),2) xhigh = sublin (read(name),2) yhigh = sublin (read(name),2) endif * White-out Legend Region * ----------------------- 'set line 0' *'draw recf 'xlow' 'ylow' 'xhigh' 'yhigh 'set line 1 1 1' 'draw rec 'xlow' 'ylow' 'xhigh' 'yhigh * Write in Legend Titles * ---------------------- vsize = (yhigh-ylow)/(2.5*numline) hsize = (xhigh-(xhigh-xlow)/10)/maxlength hsize = 0.95*(xhigh-xlow)/maxlength 'set strsiz 'hsize' 'vsize 'set string 1 c 6' xtspot = (xlow + xhigh)/2 yspace = (yhigh-ylow)/(numline+1) i = 1 while (i<=numline) yspot = yhigh - i*yspace ytspot = yspot-0.00 'set line 1 1 3' *'draw string 'xtspot' 'ytspot' 'title.i i = i+1 endwhile break endwhile function getbits (string) tb = "" i = 1 while (i<=80) blank = substr(string,i,1) if( blank = tb ) size = i-1 i = 81 else i = i + 1 endif endwhile return size