;------------------------------------------------------------- ;+ ; NAME: ; CTM_TYPE (function) ; ; PURPOSE: ; return basic parameters for various 3D models used in ; the Harvard tropospheric modeling group. This information ; should be sufficient for CTM_GRID to compute grid box edge ; and center vectors. ; ; CATEGORY: ; 3D tools ; ; CALLING SEQUENCE: ; mtype = CTM_TYPE(name [,family] [,keywords] ) ; ; INPUTS: ; NAME --> a string containing the name of the model ; (GISS_II, GISS_II_PRIME (or II_PRIME), GEOS1, ; GEOS_STRAT, FSU, or GENERIC (=DUMMY) ) ; ; FAMILY --> model family (optional, will otherwise be extracted ; from NAME). Possible values: GISS or GEOS or FSU or '' ; ; KEYWORD PARAMETERS: ; NLAYERS --> number of vertical model layers. This number must ; correspond to the number of layers in the model output ; files and is used in conjunction with PTOP to convert ; sigma levels into pressure altitudes. ; [defaults: GEOS1=20, GEOS_STRAT=26, GISS=FSU=9 ] ; ; NTROP --> number of layers in the troposphere ; [defaults: GEOS1=14, GISS=7, FSU=12] ; ; PTOP --> pressure at model top ; [default 10 mbar except for GEOS_STRAT=0.1 mbar] ; ; PSURF --> average surface pressure (needed for conversion of ; sigma levels to altitudes) [default 986 mbar] ; ; RESOLUTION --> either a 2 element vector with [ DI, DJ ] or ; a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 1=1x1, 0.5=0.5x0.5) ; [default for all models is 4x5] ; ; HALFPOLAR= (1 | 0) --> indicates that polar boxes span ; (half | same) latitude as all other boxes (DJ=const.) ; [default: 1] ; ; SMALLCHEM -> indicates that model uses reduced tracer set ; [default is fullchem] ; ; /PRINT --> prints model parameters on the screen ; ; /HELP --> displays help information ; ; OUTPUTS: ; A structure with the following field names will be returned: ; name, family, nlayers, ptop, psurf, resolution, ; halfpolar, center180, fullchem. If input parameters are not correct, ; the function returns -1. ; ; SUBROUTINES: ; ; REQUIREMENTS: ; ; NOTES: ; If you update this routine by adding additional models, make ; sure to update select_model.pro as well ; ; EXAMPLE: ; mtype = ctm_TYPE('GEOS1',resolution=2) ; ; defines model parameters for the GEOS1 model in 2x2.5 degree ; resolution. ; ; For use in conjunction with DEFINE_GRID: ; mtype = ctm_TYPE('GISS_II') ; mgrid = CTM_DEFINE_GRID(mtype) ; ; returns the grid structure for the standard GISS_II model. ; ; MODIFICATION HISTORY: ; mgs, 02 Mar 1998: VERSION 1.00 ; bmy, 07 Apr 1998: - Renamed to ctm_TYPE to keep ; consistent with other CTM subroutines. ; mgs, 24 Apr 1998: - made structure named ; mgs, 19 May 1998: - added NTROP tag and keyword ; bmy, 19 Jun 1998: - now computes FSU model parameters ; - GEOS_STRAT and GEOS-1 troposphere tops ; are now computed separately ; - added small bug fix for fullchem from mgs ; mgs, 14 Aug 1998: - added DUMMY name ; mgs, 15 Aug 1998: - added GEOS-1 as variant of GEOS1 ; bmy, 21 Dec 1998: - changed NLAYERS for GEOS STRAT ; mgs, 22 Dec 1998: - small bug fix for GEOS family NTROP ; mgs, 22 Feb 1999: - added GENERIC (same as DUMMY) and allow ; keyword settings for this name ; bmy, 23 Feb 1999: - Implemented FSU grid information ; mgs, 16 Mar 1999: VERSION 1.21 ; - cosmetic changes ; - changed function name yesno into yesno_val to ; avoid conflicts. ; - removed online tag because it's never used ; ; ;- ; Copyright (C) 1998, 1999, Martin Schultz, Harvard University ; This software is provided as is without any warranty ; whatsoever. It may be freely used, copied or distributed ; for non-commercial purposes. This copyright notice must be ; kept with any copy of this software. If this software shall ; be used commercially or sold as part of a larger package, ; please contact the author to arrange payment. ; Bugs and comments should be directed to mgs@io.harvard.edu ; with subject "IDL routine ctm_type" ;------------------------------------------------------------- pro use_ctm_type print print,' function CTM_TYPE : get basic parameters for various 3D models' print print,' usage: mtype = CTM_TYPE( NAME [,FAMILY] [, options] )' print print,' NAME : model name ( GEOS1, GEOS_STRAT, GISS_II, ', $ 'GISS_II_PRIME, FSU or GENERIC) ' print,' FAMILY : optional model family ( GEOS, GISS, FSU )' print,' [will be extracted from name if not given]' print print,' options:' print,' NLAYERS : number of vertical model layers' print,' [defaults: GEOS1=20, GEOS_STRAT=46, GISS=9, FSU=14 ]' print print,' NTROP : number model layers in ther troposphere' print,' [defaults: GEOS1=14, GEOS_STRAT=14, GISS=7, FSU=12 ]' print print,' PTOP : pressure at model top' print,' [default 10 mbar except for GEOS_STRAT=0.1 mbar]' print print,' PSURF : average surface pressure' print,' [default 986 mbar]' print print,' RESOLUTION : either a 2 element vector with [ DI, DJ ] or ' print,' a scalar (8=8x10, 4=4x5, 2=2x2.5, 1=1x1, 0.5=0.5x0.5)' print,' [default for all models is 4x5]' print print,' HALFPOLAR= (1 | 0) : indicates that polar boxes span ', $ '(half | same)' print,' latitude as all other boxes (DJ=const.)' print,' [default: 1]' print print,' CENTER180= (1 | 0) : longitude grid is CENTER around 180,' print,' i.e. first grid box center is at -180' print,' [default: 1 for all models except GISS_II_PRIME]' print print,' /SMALLCHEM : model uses reduced set of tracers' print print,' /PRINT : print model description (i.e. the structure ', $ 'returned from CTM_TYPE)' print print,' /HELP : print this page' print return end function yesno_val,value if (value) then return,'yes' else return,'no' end function ctm_type,name,family, $ nlayers=nlayers,ntrop=ntrop,ptop=ptop,psurf=psurf, $ resolution=resolution,halfpolar=halfpolar,center180=center180, $ smallchem=smallchem, $ help=help,print=print if (n_elements(name) eq 0 OR keyword_set(HELP)) then begin use_ctm_type return,-1 endif name = strupcase(name) ; handle DUMMY name first if (name eq 'DUMMY' OR name eq 'GENERIC') then begin name = 'generic' if (n_elements(family) eq 0) then family = '' if (n_elements(nlayers) eq 0) then nlayers = 0 if (n_elements(ntrop) eq 0) then ntrop = 0 if (n_elements(ptop) eq 0) then ptop = 0. if (n_elements(psurf) eq 0) then psurf = 0. if (n_elements(resolution) eq 0) then resolution = [ 0., 0. ] if (n_elements(halfpolar) eq 0) then halfpolar = 0 if (n_elements(center180) eq 0) then center180 = 0 fullchem = 0 goto,build_struc endif ; ============================================================ ; standardize a few "historic" model names ; and get family names ; 1st special case : ; change "II_PRIME" to "GISS_II_PRIME" if (name eq 'II_PRIME') then name = 'GISS_II_PRIME' if (strmid(name,0,4) eq 'GISS' and n_elements(family) eq 0) then $ family = 'GISS' ; 2nd special case : ; change GEOS-1 to GEOS1 if (name eq 'GEOS-1') then name = 'GEOS1' ; if name is "GEOS1" then family is GEOS if (strmid(name,0,4) eq 'GEOS' and n_elements(family) eq 0) then $ family = 'GEOS' ; FSU family if ( name eq 'FSU' and n_elements( Family ) eq 0 ) then $ family = 'FSU' ; extract other (??) model family from name if (n_elements(family) eq 0) then begin p = strpos(name,'_') if (p lt 1) then message,'CTM_TYPE: ** invalid model name ! **' family = strmid(name,0,p) endif family = strupcase(family) ; check validity of model family (we don't check the model name ; because new variations should easily be added) if (family ne 'GEOS' and family ne 'GISS' and family ne 'FSU') then $ message,'CTM_TYPE: ** invalid model family ! **' ; ============================================================ ; set general default parameters (some of these may depend on ; model family or model name when new models are added) ; ============================================================ if (n_elements(PSURF) eq 0) then $ psurf = 986. ; typical average surface pressure ; (mostly used to convert sigma levels to pressures) ; default resolution is 4x5 (stored as [ 5., 4.] ) if (n_elements(RESOLUTION) eq 0) then resolution = [ 5., 4. ] ; if resolution "code" is given, complete the information if (n_elements(RESOLUTION) eq 1) then begin case RESOLUTION of 8. : resolution = [ 10., 8. ] 4. : resolution = [ 5., 4. ] 2. : resolution = [ 2.5, 2. ] 1. : resolution = [ 1., 1. ] 0.5 : resolution = [ 0.5, 0.5] else : message,'CTM_TYPE : ** invalid resolution ! **' endcase endif ; error checking if (n_elements(RESOLUTION) ne 2) then $ message,'CTM_TYPE: ** invalid resolution ! **' ; ============================================================ ; set default parameters according to model family or name ; ============================================================ if (family eq 'GISS') then begin if (n_elements(NLAYERS) eq 0) then nlayers = 9 if (n_elements(NTROP) eq 0) then ntrop = 7 if (n_elements(PTOP) eq 0) then ptop = 10. if (n_elements(HALFPOLAR) eq 0) then halfpolar = 1 if (n_elements(CENTER180) eq 0) then begin if (name eq 'GISS_II_PRIME') then center180 = 0 $ else center180 = 1 endif endif if (family eq 'GEOS') then begin if (name eq 'GEOS1') then begin if (n_elements(NLAYERS) eq 0) then nlayers = 20 if (n_elements(NTROP) eq 0) then ntrop = 14 endif else if (name eq 'GEOS_STRAT') then begin if (n_elements(NLAYERS) eq 0) then nlayers = 26 if (n_elements(NTROP) eq 0) then ntrop = 17 endif else begin message,'CTM_TYPE : ** unknown layers for GEOS model ! **' endelse if (n_elements(PTOP) eq 0) then begin if (name eq 'GEOS1') then ptop = 10. $ else ptop = 0.1 ; *** careful !! does this hold for GEOS2 ? endif if (n_elements(HALFPOLAR) eq 0) then halfpolar = 1 if (n_elements(CENTER180) eq 0) then center180 = 1 endif if (family eq 'FSU') then begin if (n_elements(NLAYERS) eq 0) then nlayers = 14 if (n_elements(NTROP) eq 0) then ntrop = 12 if (n_elements(PTOP) eq 0) then ptop = 10. if (n_elements(HALFPOLAR) eq 0) then halfpolar = 0 if (n_elements(CENTER180) eq 0) then center180 = 0 endif fullchem = 1 - keyword_set(smallchem) ; ============================================================ ; return structure with all the information gathered ; ============================================================ build_struc: result = { ctmmt, $ name:name, $ family:family, $ nlayers:fix(nlayers), $ ntrop:fix(ntrop), $ ptop:float(ptop), $ psurf:float(psurf), $ resolution:float(resolution), $ halfpolar:fix(halfpolar), $ center180:fix(center180), $ fullchem:fix(fullchem) } ; ============================================================ ; produce printout if requested ; ============================================================ if (keyword_set(PRINT)) then begin print,'Parameters for model : ',result.name print,'family : ',result.family print,'vertical layers : ',result.nlayers,format='(A,i4)' print,'tropospheric layers : ',result.ntrop,format='(A,i4)' print,'pressure at top : ',result.ptop,format='(A,f6.1)' print,'av. surface pressure : ',result.psurf,format='(A,f6.1)' print,'resolution : ', $ strcompress( $ string(result.resolution(1),format='(f6.1)')+' x '+ $ string(result.resolution(0),format='(f6.1)') ) if (result.halfpolar) then hpstr = 'half' else hpstr='full' print,'polar boxes : ',hpstr,' size' print,'lon. grid centered at 180 : ',yesno_val(result.center180) print,'full chemistry active : ',yesno_val(result.fullchem) endif return,result end