* monthly.gs v1.1 * * generally grads needs 3 environment variables to be set up * (1) path, (2) gaddir, (3) gascrp, and location of control files. * * However for demo purposes, assume the 3 variables are not set. * Works by cd-ing to directory with (1) grads, (2) grad scripts * (3) grads data files and running grads from that directory, * and (4) the location of the control files. * * disk='/cdrom' disk='e:' day='14mar93' mon='mar' year='93' latr='-90 90' lonr='-180 180' proj='latlon' maptype='' mpvals='' plev='' var='mslp' print='off' metafile='' cint='default' clab='on' factor=0.01 offset=0 dfull='yes' danom='yes' dclim='yes' while(1) 'reinit' 'clear' say ' ' say ' ' say ' ' say ' ' say ' ' say ' ' say ' ' say ' ' say ' ' say ' Monthly-Averaged Fields v1.1' say ' ' say 'v) change variable (' var plev ')' say 't) change time (' mon year ')' say '+) change time to next month' say '++) change time to next year' say '-) change time to previous month' say '--) change time to previous year' say 'l) change lat-lon of display (lat: ' latr ' lon:' lonr ')' say 'p) change projection of display (' proj ')' say 'c) change contour interval (' cint ')' say 'f) change scaling factors (display = ' factor '*' var ' + ' offset ')' say 'e) enable display of (field:' dfull ', anomaly:' danom ' climatology:' dclim ')' say 's) save next display to metafile (' print ')' say 'd) display: ' var plev ' ' mon year say 'D) display (no shading): ' var plev ' ' mon year say ' ' say 'q) return to main menu' say ' ' say ' ' prompt 'Enter Choice: ' pull c if (c = 't' | c = 'T') say 'Enter new date: ' say ' only monthly data for 1982-1994' say ' the date must be in the form of mmmyy' say ' mmm is first 3 letters of the month; example jan, feb, mar ..' say ' yy is year (last 2 digits)' prompt 'enter date: (ex. mar93) ' pull day day='01' day mon=substr(day,3,3) year=substr(day,6,2) say ' ' say 'you entered date=' day ' month=' mon ' year=19' year say ' ' if (year < 82 | year > 94) say ' ' say 'Date is not correct, use menu t option again' say ' ' endif prompt 'press return for menu ' pull x endif if (c = 'd' | c = 'D') 'open ' disk '/monthly/prfl.ctl' 'open ' disk '/climate/prflcl.ctl' 'set lat ' latr 'set lon ' lonr 'set mproj ' proj if (maptype != '') 'set mpdset ' maptype endif if (mpvals != '') 'set mpvals ' mpvals endif 'set time ' day 'set clab ' clab if (print = 'on') 'enable print ' metafile say 'printing to ' metafile endif if (plev != '') 'set lev ' plev endif if (dfull = 'yes') 'clear' 'set grads off' if (cint != 'default') 'set cint ' cint endif if (c = 'd') 'set gxout shaded' 'set cterp off' 'set map 0' if (factor = '1' & offset = '0') 'd ' var else 'd ' factor ' * (' var ') + ' offset endif 'run cbar.gs' endif 'set gxout contour' if (cint != 'default') 'set cint ' cint endif if (factor = '1' & offset = '0') 'd ' var else 'd ' factor ' * (' var ') + ' offset endif 'draw title ' mon year ' ' var plev if (print = 'on') 'print' endif prompt 'press return ' pull x endif if (danom = 'yes') 'clear' 'set grads off' if (cint != 'default') 'set cint ' cint endif if (c = 'd') 'set gxout shaded' 'set cterp off' 'set map 0' 'd (' var '-' var '.2(time=' mon '82) ) * ' factor 'run cbar.gs' endif 'set gxout contour' if (cint != 'default') 'set cint ' cint endif 'd (' var '-' var '.2(time=' mon '82) ) * ' factor 'draw title ' mon year ' ' var plev ' (departure from 82-94 normal)' if (print = 'on') 'print' endif prompt 'press return ' pull x endif if (dclim = 'yes') 'clear' 'set grads off' if (cint != 'default') 'set cint ' cint endif if (c = 'd') 'set gxout shaded' 'set cterp off' 'set map 0' 'd ' factor ' * ' var '.2(time=' mon '82) + ' offset 'run cbar.gs' endif 'set gxout contour' if (cint != 'default') 'set cint ' cint endif 'd ' factor ' * ' var '.2(time=' mon '82) + ' offset 'draw title ' mon ' ' var plev ' (82-94 normal)' if (print = 'on') 'print' endif prompt 'press return ' pull x endif if (print = 'on') 'disable print' print='off' endif endif if (c = 'l' | c = 'L') prompt 'enter latitude range: (-90 90): ' pull latr if (latr = '') latr='-90 90' endif prompt 'enter longitude range: (-180 180): ' pull lonr if (lonr = '') lonr='-180 180' endif endif if (c = 's' | c = 'S') say ' ' say 'GrADS can write graphics metafiles which can be' say ' printed from Windows (gv.exe)' say ' saved in the Windows clipboard (gv.exe)' say ' converted to a postscript file (gxps.exe)' say ' or converted to an EPS file (gxeps.exe)' say ' ' print='on' prompt 'enter name of new meta file (dos: c:/meta.gmf) ' pull metafile if (metafile = '') metafile = 'c:/meta.gmf' endif endif xc='x' c if (xc = 'x+' | xc = 'x-' | xc = 'x++' | xc = 'x--') 'open ' disk '/monthly/prfl.ctl' 'set time ' day 'q dims' line1=sublin(result,5) itime=subwrd(line1,9) if (xc = 'x-') itime=itime-1 endif if (xc = 'x+') itime=itime+1 endif if (xc = 'x--') itime=itime-12 endif if (xc = 'x++') itime=itime+12 endif 'set t ' itime 'q time' line1=sublin(result,1) word=subwrd(line1,3) day=substr(word,4,9) mon=substr(day,3,3) year=substr(day,8,2) day=substr(day,1,2) mon year endif if (c = 'f' | c = 'f') say ' ' say ' Common conversions' say ' ' say ' factor offset' say 'K->C 1 -273.16' say 'K->F 1.8 -459.7' say 'kg/m*2/sec -> mm/day 86400 0' say 'kg/m*2/sec -> inches/day 3402 0' say 'W/m*2/sec -> mm/day (evap) 0.03456 0' say 'Pa -> mb 0.01 0' say 'Pa -> in Hg 0.0002953 0' say 'm -> foot 3.28 0' say 'm/s -> km/hr 3.6 0' say 'm/s -> knot 1.94 0' say 'm/s -> mi./hr 2.24 0' say ' ' prompt 'enter factor: ' pull factor if (factor = '') factor=1 endif prompt 'enter offset: ' pull offset if (offset = '') offset=0 endif endif if (c = 'c') prompt 'enter new contour interval: ' pull cint if (cint = '') cint='default' endif endif if (c = 'C') if (clab = 'on') clab='off' else clab='on' endif endif if (xc = 'xe' | xc = 'xE') prompt 'display full field (yes|no)? ' pull x dfull='yes' if (x = 'n' | x = 'no') dfull='no' endif prompt 'display anomaly (yes|no)? ' pull x danom='yes' if (x = 'n' | x = 'no') danom='no' endif prompt 'display climatology (yes|no)? ' pull x dclim='yes' if (x = 'n' | x = 'no') dclim='no' endif endif if (c = 'p' | c = 'P') say 'change projection of the display:' say ' nps (north-pole stereographic)' say ' sps (sorth-pole stereographic)' say ' lola (lat-lon)' say ' usa, usa2 or n_amer' say ' s_amer, africa, europe, asia, aust' prompt 'enter projection: ' pull proj latr='' maptype='' mpvals='' if (proj = 'nps' | proj = 'NPS') proj='nps' latr='20 90' lonr='-270 90' endif if (proj = 'sps' | proj = 'SPS') proj='sps' latr='-90 -20' lonr='-270 90' endif if (proj = 'usa' | proj = 'USA') maptype='mres' proj='latlon' latr='24 52' lonr='-127 -65' endif if (proj = 'usa2' | proj = 'USA2') maptype='mres' proj='nps' latr='15 80' lonr='-150 -45' mpvals='-125 -75 25 55' endif if (proj = 'n_amer' | proj = 'N_AMER') maptype='mres' proj='nps' latr='5 90' lonr='-270 90' mpvals='-135 -65 18 85' endif if (proj = 's_amer' | proj = 'S_AMER') maptype='mres' proj='latlon' latr='-60 20' lonr='-90 -30' endif if (proj = 'africa' | proj = 'AFRICA') maptype='mres' proj='latlon' latr='-40 50' lonr='-20 60' endif if (proj = 'europe' | proj = 'EUROPE') maptype='mres' proj='nps' latr='5 90' lonr='-180 180' mpvals='-10 50 30 75' endif if (proj = 'asia' | proj = 'ASIA') maptype='mres' proj='latlon' latr='0 80' lonr='40 170' endif if (proj = 'aust' | proj = 'AUST' | proj = 'oz') maptype='mres' proj='latlon' latr='-50 0' lonr='100 180' endif if (latr = '') proj='latlon' latr='-90 90' lonr='-180 180' endif endif if (c = 'v' | c = 'v') say ' ' say ' ' say ' ' say ' ' say ' ' say ' ' say ' ' say 'Variables: (subset)' say ' ' say 't, u, v, z temp. (K), zonal wind (m/s), mer. wind (m/s), geo. height (m)' say ' @ 1000,925,850,700,600,500,400,300,250,200,150,100,70,50,30,20,10 mb' say 'w dP/dt (omega) (Pa/s)' say ' @ 1000,925,850,700,600,500,400,300,250,200,150,100 mb' say 'q specific humidity (kg/kg)' say ' @ 1000,925,850,700,600,500,400,300 mb' say 'mslp mean sea level pressure, (Pa)' say ' ' say 'prate model predicted precipitation (kg/m**2/s)' say 'u10m, v10m zonal/meridional winds at 10 meters (m/s)' say 't2m, q2m temp. (K), specific-humidity (kg/kg) at 2 meters' say 'tsfc observed sea-surface temp over water, skin temp over land' say 'ulwrftoa model predicted outgoing long-wave radiation (OLR) (W/m**2)' say 'uflx, vflx negative of surface wind stress (N/m**2)' say 'lhtfl, shtfl latent/sensible heat flux at surface (W/m**2)' say ' ' prompt 'enter one of the above ' pull var plev='' factor=1 offset=0 if (var = 'q') prompt 'enter pressure level (1000,925,850,700,600,500,400,300) ' pull plev endif if (var = 'w') say 'enter pressure level (1000,925,850,700,600,500,400,' prompt ' 300,250,200,150,100) ' pull plev endif if (var = 't' | var = 'u' | var = 'v' | var = 'z') say 'enter pressure level (1000,925,850,700,600,500,400,' prompt ' 300,250,200,150,100,70,50,30,20,10) ' pull plev endif if (var = '') var=z plev=500 endif endif if (c = 'lev') prompt ' enter level ' pull plev endif if (c = 'i') 'open ' disk '/monthly/prfl.ctl' 'q file' say result say sublin(result,2) say sublin(result,3) say sublin(result,4) prompt ' return to menu ' pull x endif if (c = 'q' | c = 'Q') return endif endwhile
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: