* +-======-+ * 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 * * +-======-+ ************************************************************** * * * This script computes the Time Average of the INPUT field * * * ************************************************************** function timeave (args) name = subwrd(args,1) file = subwrd(args,2) offset = subwrd(args,3) if( offset="" ) offset = 0 endif 'set t 1' tmax = gettmax() xdim = getinfo(xdim) ydim = getinfo(ydim) 'set x 1 'xdim 'set y 1 'ydim if( xdim>1 ) 'set lon 0 360' endif say " " say "Processing Time Average for: "name say "t_max = "tmax" offset = "offset say " " t1 = 1 + offset 'define 'name'ave'file' = ave('name',t='t1',t='tmax')' say " " say "Defined "name"ave"file function gettmax(args) 'query file ' tmax = sublin(result,5) tmax = subwrd(tmax,12) return tmax function gettbeg(args) month = getinfo(month) if(month="JAN") tbeg = 1 endif if(month="FEB") tbeg = 2 endif if(month="MAR") tbeg = 3 endif if(month="APR") tbeg = 4 endif if(month="MAY") tbeg = 5 endif if(month="JUN") tbeg = 6 endif if(month="JUL") tbeg = 7 endif if(month="AUG") tbeg = 8 endif if(month="SEP") tbeg = 9 endif if(month="OCT") tbeg = 10 endif if(month="NOV") tbeg = 11 endif if(month="DEC") tbeg = 12 endif return tbeg function getinfo (args) 'query file' xlab = sublin(result,1) file = subwrd(xlab,2) label = substr( xlab,10,80 ) tabl_file = sublin(result,2) tabl_file = substr( tabl_file,14,80) data_file = sublin(result,3) data_file = substr(data_file,11,80) resolution = sublin(result,5) xdim = subwrd(resolution,3) ydim = subwrd(resolution,6) zdim = subwrd(resolution,9) tdim = subwrd(resolution,12) 'q dims' lons = sublin(result,2) lons = substr(lons,16,16) lats = sublin(result,3) lats = substr(lats,16,16) levl = sublin(result,4) levl = substr(levl,21,4) time = sublin(result,5) time = substr(time,22,15) month = substr(time,7,3) if (args="file") return file endif if (args="label") return label endif if (args="time") return time endif if (args="xdim") return xdim endif if (args="ydim") return ydim endif if (args="zdim") return zdim endif if (args="tdim") return tdim endif if (args="month") return month endif