CALL SEQUENCE (gpasg)... gpasg GPFLD GSLNSP GSFLD [ GPTOP ] INPUT OUTPUT \ -n VAL1 -kind VAL2 -i VAL3 -b VAL4 -c VAL5 \ -j VAL6 [VAL7] -k VAL8 [VAL9] [-l VAL10 [VAL11] ] \ -def [APPEND][FREEFMT] CALL SEQUENCE (gsasg)... gsasg GSFLD GSLNSP GSFLD [ GPTOP ] INPUT OUTPUT \ -n VAL1 -kind VAL2 [ VAL3 ] -i VAL4 [ VAL5 [ VAL6 ] ] -b VAL7 \ -c VAL8 -j VAL8 [ VAL9 ] -k VAL10 [ VAL11 [ VAL12 ] ] \ -def [APPEND][AABB][DEFLEVS][FREEFMT] DESCRIPTIONS... gpasg - INTERPOLATE FROM PRESSURE TO SIGMA/HYBRID/GEM/GEM(2/3/4) LEVELS gsasg - INTERPOLATE BETWEEN SIGMA/HYBRID/GEM/GEM(2/3) LEVELS AUTHORS - Nils Ek, Bernard Dugas, RPN: Sept 1998 (after GSAPL) LAST REVISION: $Header: Implementer-les-comdecks-toc_gest_formats-et-set_a_b_formats @ 2019-01-12 16:31:28 -0500 (dugas) $ PURPOSE - INTERPOLATES FROM PRESSURE OR ETA (SIGMA/HYBRID/GEM/GEM2/GEM3/GEM4) LEVELS TO ANOTHER SET OF MODEL ETA LEVELS. THE INTERPOLATION IS LINEAR IN LN(PRES) INPUT FILES... GPFLD = SETS OF PRESSURE LEVEL GRID DATA (gpasg) GSFLD = SETS OF ETA (SIGMA/HYBRID/GEM/GEM2/GEM3/GEM4) LEVEL GRID DATA (gsasg) GSLNSP = SERIES OF GRIDS OF LN(SF PRES), WHERE SF PRES IS IN UNITS OF HPa [ GPTOP = SERIES OF GRIDS OF PRESSURE AT TOP OF MODEL (OPTIONAL, GEM ONLY) ] GPTOP AND GSLNSP HAVE UNITS OF MB AND LN(MB), RESPECTIVELY. OUTPUT FILE... GSFLD = SETS OF ETA (SIGMA/HYBRID/GEM/GEM2/GEM3/GEM4) LEVEL GRID DATA INPUT PARAMETERS USED BY ALL COMMANDS... NSL (n) = NUMBER OF REQUESTED MODEL LEVELS (DEF 28, MAX 999). IF NSL IS NEGATIVE, THE -NSL LEVS VALUES ARE READ WITH EITHER A I10 FORMAT OR AN E10.0 DEPENDING ON WETHER ANY OF THESE VALUES CONTAINS A DECIMAL POINT. INTEGER VALUES ARE THEN ASSUMED TO BE ENCODED. COORD (kind) = 'SIG'/'ETA'/'GEM'/'GEM2'/'GEM3'/'GEM4' FOR OUTPUT SIGMA/ETA AND FOUR VARIANTS OF THE GEM VERTICAL COORDINATES. If the APPEND-mode is set and COORD='GEM4' (see note #11), the output file content is used to determine all of the coordinate parameters. RLUP (b) = LAPSE RATE USED TO EXTRAPOLATE UPWARDS (DEF 0.0). RLDN (c) = LAPSE RATE USED TO EXTRAPOLATE DOWNWARDS (DEF 0.0). PTOIT (i) = PRESSURE (PA) AT THE OUTPUT LID (DEF pression_au_toit). PREF (j) = REF PRESSURE USED WHEN COORD='GEM2' OR 'GEM3' (DEF 80000 PA). R (k) = (FIRST) EXPONENT ONLY USED WHEN COORD='GEM2','GEM3' or 'GEM4' (DEF 1.0). LEVS = MONOTONIC ETA LEVELS (READ FROM STANDARD INPUT). THE DEFAULTS ARE AS SPECIFIED IN THE EXAMPLE BELOW. THE NEXT TWO INPUT PARAMETRES ARE ONLY USED BY GSASG... COORDI (kind2) = INPUT DATA VERTICAL COORDINATE. SUPPORTED OPTIONS INCLUDE 'SIG'/'ETA'/'GEM'/'GEM2'/'GEM3'/'GEM4' AND SEVERAL VARIANTS OF THE CCCMA GCM VERTICAL COORDINATE. PTOITI (i2) = PRESSURE (PA) AT THE LID OF INPUT MODEL (DEF = PTOIT) THE NEXT TWO INPUT PARAMETRES ARE ONLY USED BY GSASG IF COORDI='GEM2' OR 'GEM3'... PREFI (j2) = INPUT REFERENCE PRESSURE (DEF = PREF). RI (k2) = INPUT EXPONENT (DEF = R). THE NEXT THREE INPUT PARAMETRES ARE ONLY USED IF COORD='GEM4'... R2 (k2) = Second exponent (DEF = R). G4LEV (l) = 'MOMENTUM' (default) or 'THERMODYN' to output interpolated data on the GEM4 momentum or thermodynamic set of levels, resp. lastTatU (l2) = 'T' => Put last thermodynamic level at last momentum level. 'F' => Do not do this (DEF='F'). Notes: 1) When COORD='GEM', PTOIT is only used if GPTOP is empty 2) When COORD='GEM', RLUP and LAY are ignored 3) Units for RLUP and RLDN are that of D(GSFLD)/D(LN PRES). Accordingly, it is assumed that only one variable is to be found in the GPFLD or GSFLD input files, possibly on several timesteps. 4) The first input line is NOT read if any command-line parameters are passed. 5) Furthermore, the second set of lines will not be read either if the "-def" defaults processing mode is requested without a value. However, if either an 'AABB' and/or an 'APPEND' value is set in GSASG (see notes #9, #11 for more details), a 'DEFLEVS' character sequence must also be added to activate this option, as in "-def AABB/DEFLEVS". 6) 'GEM' is the original gem coordinate. 'GEM2' is the hybrid coordinate implemented by Edouard & Gravel in GEM/DM V2.2.0, while 'GEM3' is the normalized version that was implemented in GEM/DM v2.3.1, while 'GEM4' is the version used onward from GEM/DM v4.0.6. 7) The default value of COORDI is determined by the file type and the program will also try to determine it by the (internal) coding used for the coordinate itself. 8) The parametres needed to read/write 'GEM2' or 'GEM3' arrays can only be specified in command-line input mode. 9) Specifying "-def AABB" in GSASG will force an attempt to read a text file called aabb.nml, containing a FORTRAN namelist AABB_NML, which in turns will hold two arrays, A and B such that the input data local pressure at level K, PL(K), is defined as "A(K)+B(K)*PS" for most coordinates. For 'GEM4', the corresponding formula to calculate the K-level natural logaritm of the local pressure is rather "A(K)+B(K)*LN(PS/PREF)". The A and B terms should be such as to produce local pressures in Pa units, even though PS is usually read in units of hPa (before being converted to Pa units internally). In all cases, this approach then by-passes the normal COORDI-related calculations for PL(K). The program is then said to operate in AABB-mode. ************* Given the above, correctly using the AABB option with a GEM4 file requires specifying the "COORDI=GEM4" argument. ************* 10) When COORD='GEM4' *AND* AABB has not been specified, the levels read on input will first be used to generate the two sets of dynamic and thermodynamic GEM4 staggered coordinate levels. Which set will be later used is determined by the value of the G4LEV ('-l') parametre interpolated to the (chosen) set of GEM4 levels. (see above). The input data will then be interpolated to the (chosen) set of GEM4 levels. 11) Note that at this time, only VKIND=5002 or 5003 (if lastTatU=T) are supported when actually building a new !! GEM4 vertical level descriptor record. To use more recent versions of this record (eg. VKIND=5004 or 5005), please refer to note #12. 12) Alternatively, specifying "-def APPEND" when COORD='GEM4' indicates that the program should instead attempt to find a !! GEM4 vertical level descriptor record on the output file and use it, instead of creating one. The newly interpolated data that will result will then be appended to the file. All of the VKIND=500x (x=2,3,4,5) are then supported. 13) Specifying "-def FREEFMT" indicates that the output model levels should read with a list-directed free format. This is obviously not the default behaviour. Level values should then only be separated by spaces or comas, and spread over one or more lines. These numbers are then always assumed to be the actual real model levels, and not their possibly encoded integer values. Only one of either "FREEFMT" or "APPEND" can be be defined at any one time. Turning on the "FREE_FORMAT_LEVEL_IO" environment variable will also act as if "-def FREEFMT" had been specified. READ( 5,5010 ) NSL,COORD,PTOIT, RLUP,RLDN (gpasg) READ( 5,5015 ) NSL,COORD,PTOIT,COORDI,PTOITI,RLUP,RLDN (gsasg) IF (FREEFMT) READ( 5,* ) ( ETA(I),I=1,ABS(NSL)) ELSEIF (NSL.GT.0) READ( 5,5020 ) (LEVS(I),I=1, NSL) ELSEIF (NSL.LT.0) READ( 5,5030 ) (LEVS(I),I=1, -NSL) 5010 FORMAT(10X,I5,1X,A4,3E10.0) 5015 FORMAT(10X,I5,2(1X,A4,E10.0),2E10.0) 5020 FORMAT(16E5.0) 5030 FORMAT(8E10.0) EXAMPLE OF (gsasg) INPUT CARDS (with format 5010 & 5020)... GSASG. 27 GEM2 0.01 ET15 7.2E-3 0. 0. 0. .010 .020 .040 .061 .091 .131 .177 .222 .273 .328 .384 .444 .500 .555 .611 .666 .722 .773 .818 .859 .894 .925 .950 .970 .985 .995 01234567890123456789012345678901234567890123456789012345678901234567890 1 2 3 4 5 6 7 (gsasg+gpasg) EXIT CONDITIONS... 0 NO PROBLEMS 1 NUMBER ETA LEVELS GREATER THAN MAXLEV 2 PRESSURE OR MODEL VERT COORDINATE NOT MONOTONIC 3 ERROR READING FIRST SET IN GSLNSP 4 ERROR READING FIRST SET IN GPFLD OR GSFLD 5 GPFLD OR GSFLD AND GSLNSP NOT THE SAME SIZE 6 ERROR READING FIRST SET IN GPTOP 7 GPTOP, GSLNSP NOT THE SAME SIZE 8 ERROR UNPACKING FIRST SET IN GPFLD 9 MORE THAN ONE SIZE IN GPFLD OR GSFLD 10 MISSING GSLNSP FIELD 11 MORE THAN ONE SIZE IN GSLNSP 12 MISSING GPTOP FIELD 13 MORE THAN ONE SIZE IN GPTOP 14 ERROR ABORT READING INPUT CARD 1 15 ERROR ABORT READING OUTPUT LEVELS 16 UNSUPPORTED VERTICAL COORDINATE IN GPFLD 17 COORD PARAMETRE AND GPFLD DATA MISMATCH 19 UNSUPPORTED VERTICAL COORDINATE ON INPUT CARD 2 20 UNABLE TO READ AABB NAMELIST 21 GSLNSP DOES NOT CONTAIN LN( SURFP ) FOR EARTH 22 WRONG NUMBER OF A,B VALUES IN AABB 23 UNRECOGNIZED VALUE OF THE G4LEV PARAMETRE 24 UNABLE TO ALLOCATE WORKING MEMORY 25 GPASG UNABLE TO CREATE (GEM4) TocToc record 26 GEM4 INPUT LEVEL MISMATCH 27 FOUND DATA NOT OF TYPE 'GRID' OR 'SUBA' 28 UNRECOGNIZED -DEF ARGUMENT VALUE 29 'APPEND' and 'FREEFMT' are both specified 101 MORE THAN ONE VARIABLE NAME DETECTED, CHECK RLDN/RLUP VALIDITY (gsahy) EXIT CONDITIONS... 1 CODE NOT YET ACTIVE