CALL SEQUENCE... dxdp XIN XOUT [LNSP] OUTPUT \ [-kind VAL0 [VAL1] -l VAL2 [VAL3] -a VAL4 -d VAL5 \ -i VAL6 [VAL7] -def [AABB][WEIGHT] ] AUTHORS - - R.Laprise ET J.D.Henderson, MAY 14 1983. LAST REVISION: $Header: Implementer-les-comdecks-toc_gest_formats-et-set_a_b_formats @ 2019-01-12 16:31:28 -0500 (dugas) $ PURPOSE - COMPUTES VERTICAL DERIVATIVE FOR ALL SETS IN A FILE INPUT FILE... XIN = INPUT FILE OF PRESSURE/ETA/GEMx LEVEL SETS (REAL OR COMPLEX) (MINIMUM NUMBER OF LEVELS IS 3) LNSP = (OPTIONAL) LOG OF SURFACE PRESSURE FIELD USED BY THE TERRAIN FOLLOWING COORDINATES TO DETERMINE THE LOCAL PRESSURE. OUTPUT FILE... XOUT = VERTICAL (PRESSURE OR LOG-PRESSURE) DERIVATIVES AT THE SAME LEVELS AS THE DATA IN FILE XIN NOTE THAT THERE SHOULD BE AT LEAST 3 AND AT MOST 999 LEVELS IN XIN COMMAND-LINE PARAMETERS... KIND (1) = 0, (DEFAULT) USES SIMPLE CENTERED DIFFERENCES. 1, USE A WEIGHTED ALGORITHM, TAKING INTO ACCOUNT THE POSSIBLY UN-EVEN LEVEL SPACING, SO THAT THE SCHEME BECOMES SECOND-ORDER ACCURATE. SPECIFYNG 2, ALLOWS TO DO THE DERIVATIVE USING A WEIGHTED LOG-PRESSURE DISCRETIZATION. KIND (2) = INPUT VERTICAL COORDINATE: POSSIBLE OPTIONS ARE 'PRES'/'ETA' FOR PRESSURE/GCM-ETA AND 'GEM'/'GEM2'/ 'GEM3'/'GEM4' FOR THE DIFFERENT VERSIONS OF THE GEM MODEL COORDINATE. LEVTYP (l 1) ='FULL' FOR 'ETA' MOMENTUM VARIABLE, AND 'HALF' FOR 'ETA' THERMODYNAMIC ONE. LAY (l 2) = DEFINES THE POSITION OF LAYER INTERFACES IN RELATION TO LAYER CENTRES FOR THE 'ETA' COORDINATE (SEE BASCAL). PTOIT (a) = PRESSURE (PA) AT THE LID OF MODEL. THE DEFAULT VALUE IS 0.01 OTHERWISE. THIS VALUE IS ONLY REQUIRED WITH THE CCCma GCM VERTICAL COORDINATES. The next parametres are only used when COORD='GEMx', where x=2,3 or 4. PREF (d) = REF PRESSURE (DEF 80000 PA). R (i) = REFERENCE EXPONENT (DEF 1.0) R2 (i2) = EXPONENT USED ONLY WHEN COORD='GEM4' (DEF 1.0) Notes: 1) Specifying "-def" command-line parameter by itself (no values) tells the program to use the same weighted finite difference as discussed above for the "-kind" argument, but this last has precedence. However, if a 'AABB' value is set (see note #5 for more details), a 'WEIGHT' character sequence must also be added to activate this option, as in "-def AABB/WEIGHT". 2) The program requires that data types be either of 'GRID', 'SUBA' or 'ZONL' when operating with any of the terrain following vertical coordinates. The other types of data are only supported with pressure vertical coordinates. 3) 'GEM' is the original GEM ETA coordinate, while 'GEM2' is the first GEM HYBRID coordinate as implemented by Edouard & Gravel in GEM/DM V2.2.0. 'GEM3' is the normalized version that was implemented in the V2.3.1 GEM/DM. 'GEM4' is the staggered hybrid coordinate version of GEM/DM from v4.0.6. 4) The default value of KIND(2) is determined by the file type and the program will also try to determine it by the (internal) coding used for the coordinate itself. 5) Specifying "-def AABB" will force the 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 local pressure at level K, PL(K), can be calculated 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 COORD-related calculations for PL(K). ************* Given the above, correctly using the AABB option with a GEM4 file requires specifying the "-kind GEM4" argument. ************* EXIT CONDITIONS... 0 NO PROBLEMS 1 NOT ENOUGH OR TOO MANY LEVELS IN FIRST SET OF XIN 2 MORE THAN ONE SIZE IN FILE XIN 3 NOT ENOUGH LEVELS IN LAST SET READ 4 LEVELS DO NOT VARY MONOTONICALLY 5 ILLEGAL "KIND" VALUE 6 LNSP FILE MISSING OR EMPTY 7 LNSP AND XIN NOT THE SAME SIZE 8 PROBLEM READING PARAMETRES 9 UNRECOGNIZED COORDINATE TYPE 10 UNABLE TO CONTINUE (SEE NOTE 1) 11 UNABLE TO ALLOCATE WORKING MEMORY 12 LP DOES NOT CONTAIN LN( SURFACE PRESSURES ) FOR EARTH 16 UNSUPPORTED VERTICAL COORDINATE IN XIN 17 KIND(2) PARAMETRE AND XIN DATA MISMATCH 18 UNABLE TO FIND A GEM4 '!!' RECORD 20 UNABLE TO READ AABB NAMELIST 21 MORE THAN ONE VERTICAL COORDINATE IN XIN 22 WRONG NUMBER OF A,B IN AABB 23 UNRECOGNIZED -DEF ARGUMENT VALUE