ATMOSPHERIC SCIENCES routines in *

All GAMAP Routines

List routines by category:
Atmospheric Sciences | Benchmarking | Color | Date/Time | Doc | File & I/O | BPCH Format | Scientific Data Formats | GAMAP Examples | GAMAP Internals | GAMAP Utilities | GAMAP Data Manipulation | GAMAP Models & Grids | GAMAP Plotting | General | Graphics | Math & Units | Plotting | Regridding | Strings | Structures | Time Series

List routines by alphabetical order:
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z

Last modified: Tue Apr 4 10:50:21 2017.


List of Routines


Routine Descriptions

ADD_DATA

[Next Routine] [List of Routines]
 NAME:
        ADD_DATA

 PURPOSE:
        Add a variable to a data array and its header, units,
        cfact, and mcode fields.  For use with CHEM1D.

 CATEGORY:
        Atmospheric Sciences

 CALLING SEQUENCE:
        ADD_DATA,data,header,units,cfact,mcode,    $
           newdat,newhead,newunit,newfact,newcode [,keywords]

 INPUTS:
        DATA --> the array containing all the data
        HEADER --> string vector of variable names
        UNITS --> string vector of variable units (maybe undefined)
        CFACT --> float vector of conversion factors (maybe undefined)
        MCODE --> float vector of missing value codes (maybe undefined)
        NEWDATA --> data vector containing new variable
        NEWHEADER --> name of new variable
        NEWUNIT --> physical unit of new variable (may be omitted)
        NEWFACT --> conversion factor of new variable (may be omitted)
        NEWCODE --> missing value code for new variable (may be omitted)

 KEYWORD PARAMETERS:
        /INFO  --> prints number of variables (elements of HEADER)
               after merging the new column with the old array
        /TRANSPOSE --> NEWDAT is being transposed before merging it
               with DATA
        /FIRST --> add variable at first position rather than last

 OUTPUTS:
        DATA, HEADER, UNITS, CFACT, MCODE will contain the extra data

 SUBROUTINES:
        None

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLE:
        suppose DATA is a 3x10 array, and HEADER contains 
        the names A, B, and C. Then 

            ADD_DATA,DATA,HEADER,DUMMY,DUMMY,DUMMY,findgen(10),'COUNT'

        will add the variable COUNT to the dataset and the name to HEADER.

        A more realistic example:
            ADD_DATA,DATA,HEADER,UNITS,CFACT,MCODE, $
                     NEWDAT,'SATURATION_PRESSURE','mbar',1.0,-999.99

 MODIFICATION HISTORY:
        mgs, 05 Nov 1997: VERSION 1.00
            extracted from CREATE_MASTER.PRO, added flexibility for
            optional parameters
        mgs, 06 Nov 1997: - added FIRST keyword
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10

(See /n/home09/ryantosca/IDL/gamap2/atm_sci/add_data.pro)


AIRDENS (FUNCTION)

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
        AIRDENS (function)

 PURPOSE:
        Compute air mass density for a given pressure and 
        temperature. If the temperature is not provided, a
        temperature is estimated using the US Standard atmosphere.

 CATEGORY:
        Atmospheric Sciences

 CALLING SEQUENCE:
        idens = AIRDENS(p [,T])

 INPUTS:
        P  -> pressure in hPa (mbar)

        T  -> temperature in K

 KEYWORD PARAMETERS:
        HELP -> print help information

 OUTPUTS:
        The air mass density in molec/cm^3. The result type will 
        match the type and array dimensions of p unless p is a 
        scalar and T an array.

 SUBROUTINES:
        External Subroutines Required:
        ===========================================
        USSA_ALT (function)   USSA_TEMP (function)

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLES:
        (1) 
        PRINT, AIRDENS( 1013.25, 273.15 )
           2.69000e+19
 
             ; Prints air density at std temperature & pressure

        (2)
        P = FINDGEN(5)*100+500
        PRINT,AIRDENS(P,T)     ; T undefined !
           1.44840e+19  1.67414e+19  1.89029e+19  2.10104e+19  2.30998e+19
        PRINT, T
           250.334      259.894      268.538      276.117      282.534

             ; Prints air density w/ undefined temperature
             ; Temperature profile from the US Std atmosphere
             ; will be returned.

        (3)
        PRINT,AIRDENS(800.,T)  ; T from previous calculation
           2.31744e+19  2.23218e+19  2.16033e+19  2.10104e+19  2.05332e+19

             ; Use T from previous example and print
             ; air density at 800 hPa

 MODIFICATION HISTORY:
        mgs, 12 Nov 1998: VERSION 1.00
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10

(See /n/home09/ryantosca/IDL/gamap2/atm_sci/airdens.pro)


E_H2O

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
        E_H2O  

 PURPOSE:
        Calculate water vapour pressure for a given temperature

 CATEGORY:
        Atmospheric Sciences

 CALLING SEQUENCE:
        RESULT = E_H2O( TEMPERATURE [,/WATER,/ICE,minval=minval] )

 INPUTS:
        TEMPERATURE --> dew or frostpoint reading in K. If you supply
              the dry air temperature (or static air temperature),
              you will get a value for the water vapor saturation 
              pressure.

 KEYWORD PARAMETERS:
        /WATER --> interprete temperature as dewpoint (default)

        /ICE --> interpret temperature as frostpoint

        MINVAL -> minimum valid data value (default -1.0E30)

 OUTPUTS:
        RESULT -> The water vapour pressure [hPa]

 SUBROUTINES:
        None

 REQUIREMENTS:
        None

 NOTES:
        The algorithm has been taken from the NASA GTE project data
        description.

 EXAMPLE:
        PH2O = E_H2O(266.)

             ; Calculate water vapor pressure for a 
             ; dewpoint reading of 266 K

        RH = PH2O/E_H2O(283.)

             ; Compute relative humidity 
             ; (divide ph2o by saturation pressure of DRY temperature)

        PRINT,PH2O,RH
          3.61742     0.294607
 
             ; Prints values        

 MODIFICATION HISTORY:
        mgs, 23 Feb 1997: VERSION 1.00
        mgs, 03 Aug 1997: split e_h2o and rh, renamed, added template
        mgs, 23 May 1998: changed default behaviour to set reference
               temperature to given TD value
        mgs, 29 Aug 1998: VERSION 2.00
          - much simpler and more logical interface
          - no automatic detection of dew- or frostpoint any longer
          - can now accomodate arrays
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10

(See /n/home09/ryantosca/IDL/gamap2/atm_sci/e_h2o.pro)


FORMAT_INP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
        FORMAT_INP

 PURPOSE:
        Display one line of S-type input file for CHEM1D model
        formatted so that each line contains name, unit, value and
        scaling factor of 1 species (may help to find errors).
        
 CATEGORY:
        Atmospheric Sciences

 CALLING SEQUENCE:
        FORMAT_INP, FILENAME [ , Keywords ]

 INPUTS:
        FILENAME -> name of the input file

 KEYWORD PARAMETERS:
        OUTFILE -> filename for ASCII file with formatted output
             (default: FILENAME+'.formatted')

        SKP1, SKP2, DELIM -> parameters for READDATA routine:
             number of lines to skip before variable names and 
             delimiter for variable names (defaults: 1, 3, and ' ')

        LINE -> data line to be displayed (default=1)

        SIMPLE -> assume no unit and scale factor line, and print
             dummies instead. Will be automatically set if SKP2 is 
             less than 2.

 OUTPUTS:
        Screen output and output to file OUTFILE

 SUBROUTINES:
        External Subroutines Required:
        ===============================
        READDATA

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLE:
        FORMAT_inp, 'test.inp', LINE=3

        will display the third line of a chem1d input file test.inp in a
        format similar to:
               NAME         UNIT       VALUE       SCALE
          O3_COLUMN           DU     227.330   2.687e+16
        DECLINATION          deg      -1.634   1.000e+00
               PSMB           mb     238.434   1.000e+00
    ...

 MODIFICATION HISTORY:
        mgs, 18 Dec 1997: VERSION 1.00
        mgs, 11 Jun 1998: - added SIMPLE and SKP2 keyword
        mgs, 30 Oct 1998: - bug fix with units and scale
                          - improved formatting for large numbers
                            (allows display of chem1d output files)
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10
                          - Updated comments

(See /n/home09/ryantosca/IDL/gamap2/atm_sci/format_inp.pro)


GET_RANGE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
        GET_RANGE

 PURPOSE:
        Enter the data range into a variable descriptor array

 CATEGORY:
        Atmospheric Sciences

 CALLING SEQUENCE:
        GET_RANGE,data,vardesc [,minvalid]

 INPUTS:
        DATA -> The data array (NLINES, NVARS)

        VARDESC -> The variable descriptor array (see GTE_VARDESC).
            Must contain NVARS elements, and a 2-element vector
            tagged RANGE. These values will be changed.

        MINVALID -> minimum valid data value to discriminate against
            missing values etc. Default is -1.0E30.

 KEYWORD PARAMETERS:
        none

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required
        ===============================
        GTE_VARDESC (function)

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLE:
        ; read binary data and retrieve range
        READ_BDT0001, '~/tmp/*.bdt', DATA, VARDESC
        GET_RANGE, DATA, VARDESC

 MODIFICATION HISTORY:
        mgs, 24 Aug 1998: VERSION 1.00
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10

(See /n/home09/ryantosca/IDL/gamap2/atm_sci/get_range.pro)


HYSTAT (FUNCTION)

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
        HYSTAT (function)

 PURPOSE:
        Compute atmospheric pressures in hydrostatic equilibrium.
        This function is adapted from the Harvard photochemical
        point model (CHEM1D).

 CATEGORY:
        Atmospheric Sciences 

 CALLING SEQUENCE:
        pressure = HYSTAT,alt,temp,psurf,g0,rearth

 INPUTS:
        ALT -> Altitude in km. This can be a single value or an array.

        TEMP -> Temperatures corresponding to the altitudes in ALT

        PSURF -> A surface pressure value in mbar. Default is 1013.25 mbar.

        G0 -> acceleration du eto gravity in m/s2. Default is 9.80665 m/s2 .

        REARTH -> Radius of the earth in km. Default is 6356.77 km.

 KEYWORD PARAMETERS:
        none

 OUTPUTS:
        None

 SUBROUTINES:
        None

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLE:
        ALT = FINDGEN(20)               ; create altitude array 0..19 km
        TEMP = TEMP = 205.+(19-ALT)*4.  ; a semi-realistic temperature 
                                        ; profile
        PRESS = HYSTAT(ALT,TEMP)        ; compute pressures
        PRINT, PRESS

           1013.25   896.496   791.815   698.104   614.349   
           539.613   473.041   413.843   361.298   314.745   
           273.581   237.254   205.261   177.146   152.492   
           130.924   112.098   95.7080   81.4736   69.1443

 MODIFICATION HISTORY:
        mgs, 21 Aug 1998: VERSION 1.00
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10
                          - Updated comments

(See /n/home09/ryantosca/IDL/gamap2/atm_sci/hystat.pro)


KNMHC

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
        KNMHC

 PURPOSE:
        Returns an array of reaction rates for various non-methane 
        hydrocarbon reactions as a function of temperature and pressure.

        NOTE: Reaction rates may need updating to the latest JPL dataset.

 CATEGORY:
        Atmospheric Sciences

 CALLING SEQUENCE:
        RESULT = KNMHC( T, P [, Keywords ] )

 INPUTS:
        T -> Temperature in [K].

        P -> Pressure in [hPa].

 KEYWORD PARAMETERS:
        NAMES -> Returns to the calling program a list of the names
             for the various chemical species 

 OUTPUTS:
        RESULT -> An array of rate constants corresponding to
             the species contained in NAMES.
        

 SUBROUTINES:
        External Subroutines Required:
        ================================
        KTROE (function)

 REQUIREMENTS:
        None

 NOTES:
        (1) This should probably be rewritten to return a structure.
        (2) Definitely needs updating of rate constants.

 EXAMPLE:
        RESULT = KNMHC( 300, 1000, NAMES=NAMES  )
        PRINT, NAMES
          CO CH4 C2H2 C2H4 C2H6 C3H6 C3H8 i-BUT CH3CL
        PRINT, RESULT
          2.40000e-13  6.60071e-15  7.55980e-13  8.14644e-12  
          2.45774e-13  5.08118e-11  1.10803e-12  2.34511e-12
          3.76143e-14

             ; Compute rate constants for 300K and 1000hPa pressure

 MODIFICATION HISTORY:
        mgs, 1998?        INITIAL VERSION
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10
                          - added std doc header
                          - updated comments, cosmetic changes

(See /n/home09/ryantosca/IDL/gamap2/atm_sci/knmhc.pro)


KTROE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
        KTROE

 PURPOSE:
        compute reaction rate coefficient for a 3rd order reaction
        using Troe's formula as given in JPL97-4

 CATEGORY:
        Atmospheric Sciences

 CALLING SEQUENCE:
        k=KTROE(T,p,k0300,n,kinf300,m [,keywords])

 INPUTS:
        T --> temperature in K

        p --> pressure in mbars

        k0300, n --> constants to get k0(T)  { see JPL97,table 2 }

        kinf300, m --> constants to get kinf(T)  { see JPL97,table 2 }

 KEYWORD PARAMETERS:
        k0, kinf, fc --> will return individual terms of the Troe expression

 OUTPUTS:
        K -> a rate coefficient

 SUBROUTINES:
        None

 REQUIREMENTS:
        None

 NOTES:
        no error checking is done except for the correct 
        number of arguments

 EXAMPLE:

 MODIFICATION HISTORY:
        mgs, 20 Mar 1998: VERSION 1.00
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10

(See /n/home09/ryantosca/IDL/gamap2/atm_sci/ktroe.pro)


MODEL2AIRNUMDENS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
 	MODEL2AIRNUMDENS

 PURPOSE:
 	Returns the monthly averaged Air Number Density in 
       each grid box for one GEOS-Chem model. 

       This let you get the Number Density from the average monthly
       pressure of the model.

 CATEGORY:
	Atmospheric Sciences

 CALLING SEQUENCE:
	airNumDens = Model2AirNumDens( Model [, tau] )

 INPUTS:
	Model : string for model name ("GEOS4_30L", "GEOS5_47L", ...)

 OPTIONAL INPUTS:
 	Tau   : tau0 for which Air Numb density is look for. The year
 	        does not matter, the month value is extracted. Default
 	        is 0D0, which selects January.

 OUTPUTS:
	A 3D array (same size as the model 3D grid) with Air
	Density Number in [molec/cm3].


 PROCEDURE:
	GetModelAndGridInfo, DataInfo, Model, Grid      
 
       airnumden = Model2AirNumDens( CTM_NamExt( Model ), DataInfo.tau0 )


 MODIFICATION HISTORY:
       Wed Sep 2 10:54:41 2009, Philippe Le Sager
       

		Gamap v2.13 - Init version
        bmy, 30 Nov 2010: GAMAP VERSION 2.15
                          - Updated comments and category in header

(See /n/home09/ryantosca/IDL/gamap2/atm_sci/model2airnumdens.pro)


NUMDEN

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
        NUMDEN

 PURPOSE:
        Calculates the number density of air for a given temperature 
        and pressure.

 CATEGORY:
        Atmospheric Sciences

 CALLING SEQUENCE:
        RESULT = NUMDEN( T, P, /DOUBLE )

 INPUTS:
        T -> Temperature (or vector of temperatures) in K.

        P -> Pressure (or vector of pressures) in hPa.  
             Default is 1000 hPa.

 KEYWORD PARAMETERS:
        /DOUBLE -> Set this switch to return the number density
             in double precision.  Default is to return the number
             density in single precision.

 OUTPUTS:
        RESULT -> Number density of air in molec/cm3.  If T and 
             P are vectors, then RESULT will be a vector of
             number densities

 SUBROUTINES:
        None

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLES:
        (1)
        PRINT, NUMDEN( 298.0, 1013.0 )
          2.46206e+19

             ; Prints the number density of air 
             ; at 298K and 1013 hPa.
         
        (2)
        PRINT, NUMDEN( 298.0, 1013.0, /DOUBLE )
          2.4620635e+19

             ; Prints the number density of air ; at 298K and 
             ; 1013 hPa.  Computation is done in double precision.


 MODIFICATION HISTORY:
        dbm, 30 Jul 2007: GAMAP VERSION 2.10
        phs,  1 Sep 2009: GAMAP VERSION 2.13
                          - let you pass array  

(See /n/home09/ryantosca/IDL/gamap2/atm_sci/numden.pro)


PEDGE (FUNCTION)

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
        PEDGE  (function)

 PURPOSE:
        Given the pressures at the centers of a model grid, returns
        the pressures at the edges of the grid.

 CATEGORY:
        Atmospheric Sciences

 CALLING SEQUENCE:
        RESULT = PEDGE( MID, PSURF )

 INPUTS:
        MID -> Vector of pressure centers that defines the grid.  
             MID will be sorted in descending order.

        PSURF -> Surface pressure (which also corresponds to the
             lowest pressure edge).  Default is 1000.0 (mb).

 KEYWORD PARAMETERS:
        None

 OUTPUTS:
        RESULT -> The vector of pressures at level edges [hPa]

 SUBROUTINES:
        None

 REQUIREMENTS:
        None

 NOTES:
        The relationship between sigma centers and sigma edges is
        as follows:
   
              MID[N] = ( EDGE[N] + EDGE[N+1] ) / 2
   
        or conversely:
    
              EDGE[N+1] = ( 2 * MID[N] ) - EDGE[N]
   
        where EDGE[N] is the lower pressure edge, and EDGE[N+1]
        is the upper sigma edge of the box with center MID[N].
          
        The boundary condition PE[0] = PSURF is necessary to
        start the iteration.
      
 EXAMPLE:
        RESULT = PEDGE( [ 900, 700, 500 ], 1000.0 ) 
        PRINT, RESULT
           1000.00      800.000      600.000      400.000

             ; Prints edges between levels 900, 700, 500 hPa
             ; with the surface pressure being 1000 hPa.

 MODIFICATION HISTORY:
        bmy, 17 Jun 1999: VERSION 1.00
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10

(See /n/home09/ryantosca/IDL/gamap2/atm_sci/pedge.pro)


PHYSCONST

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
        PHYSCONST

 PURPOSE:
        Creates a system variable named !PHYSCONST which contains 
        various physical constants.

 CATEGORY:
        Atmospheric Sciences

 CALLING SEQUENCE:
        PHYSCONST

 INPUTS:
        None

 KEYWORD PARAMETERS:
        None

 OUTPUTS:
        None

 SUBROUTINES:
        None

 REQUIREMENTS:

 NOTES:
        The !PHYSCONST system variable contains both the short names
        (e.g. C) and long names (e.g. SPEED_OF_LIGHT) for the various
        physical constatnts.

 EXAMPLE:
        PHYSCONST
        HELP, !PHYSCONST, /STRU

        ** Structure <108c0378>, 18 tags, length=144, data length=144, refs=2:
        C                            DOUBLE   2.9979000e+08
        SPEED_OF_LIGHT               DOUBLE   2.9979000e+08
        H                            DOUBLE   6.6260000e-34
        PLANCK                       DOUBLE   6.6260000e-34
        E                            DOUBLE   1.6020000e-19
        ELEMENTARY_CHARGE            DOUBLE   1.6020000e-19
        ME                           DOUBLE   9.1090000e-31
        ELECTRON_MASS                DOUBLE   9.1090000e-31
        NA                           DOUBLE   6.0220000e+23
        AVOGADRO                     DOUBLE   6.0220000e+23
        R                            DOUBLE   8.3140000
        MOLAR_GAS                    DOUBLE   8.3140000
        K                            DOUBLE   1.3810000e-23
        BOLTZMANN                    DOUBLE   1.3810000e-23
        SIGMA                        DOUBLE   5.6710000e-08
        STEFAN_BOLTZMANN             DOUBLE   5.6710000e-08
        G                            DOUBLE   9.8066500
        ACCELERATION_DUE_TO_GRAVITY  DOUBLE   9.8066500
          

 MODIFICATION HISTORY:
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10
                          - Updated comments, cosmetic changes

(See /n/home09/ryantosca/IDL/gamap2/atm_sci/physconst.pro)


PMID (FUNCTION)

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
        PMID   (function)

 PURPOSE:
        Given the pressures at the vertical edges of a model grid,
        return the pressures at the centers of the grid.

 CATEGORY:
        Atmospheric Sciences

 CALLING SEQUENCE:
        RESULT = PMID( EDGE )

 INPUTS:
        EDGE -> Vector of pressures or pressure-altitudes at
             the edges of the model grid [hPa]

 KEYWORD PARAMETERS:

 OUTPUTS:
        RESULT -> The vector of pressures at the grid centers [hPa]

 SUBROUTINES:
        None

 REQUIREMENTS:
        None

 NOTES:
        The relationship between sigma centers and sigma edges is
        as follows:
   
              MID[N] = ( EDGE[N] + EDGE[N+1] ) / 2.0

        where EDGE[N] is the lower sigma edge, and EDGE[N+1]
        is the upper sigma edge of the box with center MID[N].

 EXAMPLE:
        Result = PMID( [ 1000.0, 800.0, 600.0, 400.0 ] )
        print, Result
            900.000      700.000      500.000

 MODIFICATION HISTORY:
        bmy, 17 Jun 1999: VERSION 1.00
        bmy, 22 Oct 1999: VERSION 1.44
                          - Now use SHIFT to compute the average
                            between successive edges
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10

(See /n/home09/ryantosca/IDL/gamap2/atm_sci/pmid.pro)


READ_SONDE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
        READ_SONDE

 PURPOSE:
        Read climatological ozone sonde data as compiled by 
        Jennifer A. Logan at Harvard University.
        If successful, the procedure returns a structure 
        with all information from a sondeXXX.* file.
        Ozone concentrations are automatically converted to ppbv.
        The data can be downloaded via ftp from io.harvard.edu
        path= pub/exchange/sonde. Please read the README files!

 CATEGORY:
        Atmospheric Sciences, File & I/O

 CALLING SEQUENCE:
        READ_SONDE,filename,data

 INPUTS:
        filename -> Name of the file containing the sonde data.
            This parameter can contain wildcards (*,?) in which case
            a file selection dialog will be displayed. If filename
            is a variable, it will be replaced by the actual filename
            that was opened.

 KEYWORD PARAMETERS:
        MBAR -> return ozone concentrations in mbar rather than ppbv

        STATIONS -> Can be used either as input or output for a list
            of station codes, locations and names as retrieved with
            procedure read_sondestations. STATIONS must be specified
            (or is returned) as an array of structures.

 OUTPUTS:
        DATA -> A structure containing the following fields:
                TITLE           STRING    'Ozone sonde data'
                STATION         STRING    
                STATIONCODE     INT       
                TIMERANGE       STRING    

(See /n/home09/ryantosca/IDL/gamap2/atm_sci/read_sonde.pro)


READ_SONDESTATIONS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
        READ_SONDESTATIONS

 PURPOSE:
        Retrieve station codes and geographical locations for 
        ozone sonding stations as listed in file station.codes
        from Jennifer A. Logan's ozone sonde climatology.
        This routine is called from procedure READ_SONDE, and
        only needs to be called explicitely if the station.codes
        file resides neither in the current directory nor the 
        directory of the sonde data files.
        The procedure will read the file station.codes once then
        store the information in a common block for later use.

 CATEGORY:
        Atmospheric Sciences, File & I/O

 CALLING SEQUENCE:
        READ_SONDESTATIONS,stations [,filename]

 INPUTS:
        FILENAME (optional) -> if given, it specifies the path and filename
              of the file that is normally called station.codes.
              FILENAME may contain wildcards (*,?) in which case a 
              file selector dialog is displayed. 

 KEYWORD PARAMETERS:
        None

 OUTPUTS:
        STATIONS -> An array with structures containing the stations
              codes (integer), latitude, longitude, altitude (float),
              amd name (string). 

 SUBROUTINES:
        Uses OPEN_FILE and EXTRACT_FILENAME (used in OPEN_FILE)

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLE:
        read_sondestations,stations,'station.codes'
        ; if called for the first time, reads file station.codes
        ; and returns information for all stations in stations.
        ; NOTE: In this case, the filename argument could have been
        ; omitted.


 MODIFICATION HISTORY:
        mgs, 02 Nov 1998: VERSION 1.00
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10

(See /n/home09/ryantosca/IDL/gamap2/atm_sci/read_sondestations.pro)


RH

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
        RH     

 PURPOSE:
        Calculates relative humidity from temperature and
        dew/frostpoint

 CATEGORY:
        Atmospheric Sciences

 CALLING SEQUENCE:
        RESULT = RH( DEWPOINT, TEMPERATURE [,/WATER] [,/ICE] )

 INPUTS:
        DEWPOINT --> dewpoint (or frostpoint) temperature [K]

        TEMPERATURE --> dry (or static) air temperature [K]

 KEYWORD PARAMETERS:
        /WATER --> always calculate dewpoint temperature

        /ICE --> always calculate frostpoint temperature

 OUTPUTS:
        RESULT -> Relative humidity [%]

 SUBROUTINES:
        External Subroutines Required:
        ===============================
        E_H2O (function)

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLE:
        PRINT, RH( 266., 278. )
          41.4736

             ; Prints the RH for dewpoint=266K and temp=278K.

 MODIFICATION HISTORY:
        mgs, 23 Feb 1997: VERSION 1.00
        mgs, 03 Aug 1997: split e_h2o and rh, renamed, added template
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10

(See /n/home09/ryantosca/IDL/gamap2/atm_sci/rh.pro)


SCHMIDT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
        SCHMIDT

 PURPOSE:
        Computes the SCHMIDT number for a given species.

 CATEGORY:
        Atmospheric Sciences

 CALLING SEQUENCE:
        RESULT = SCHMIDT( TEMPERATURE, XMV, SEAWATER )

 INPUTS:
        TEMPERATURE -> Temperature in Kelvin.

        XMV -> Molar volume of species

        SEAWATER -> set =1 if it is seawater, set =0 otherwise


 KEYWORD PARAMETERS:
        None

 OUTPUTS:
        RESULT -> The Schmidt number

 SUBROUTINES:
        None

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLE:
       PRINT, SCHMIDT( 278, 0.75, 1 )
         165.55126

             ; Compute Schmidt # for seawater

 MODIFICATION HISTORY:
  pip & bmy, 27 Jun 2003: VERSION 1.00
                          - Written by Paul Palmer
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10

(See /n/home09/ryantosca/IDL/gamap2/atm_sci/schmidt.pro)


USSA_ALT (FUNCTION)

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
        USSA_ALT (function)

 PURPOSE:
        Return the altitude for a given pressure corresponding
        to the US Standard Atmosphere.  

 CATEGORY:
        Atmospheric Sciences

 CALLING SEQUENCE:
        ALT = USSA_ALT( PRESSURE )

 INPUTS:
        PRESSURE -> a floating point value, variable or vector
             for which temperatures shall be returned.  Pressure must
             correspond to an altitude of less than 100 km.

 KEYWORD PARAMETERS:

 OUTPUTS:
        ALT -> An altitude value or vector [in km]

 SUBROUTINES:
        External Subroutines Required:
        ===============================
        USSA_PRESS (function)
           
 REQUIREMENTS:
        None

 NOTES:
        Computes approx. altitudes (logp fit to US Standard Atmosphere)
        tested vs. interpolated values, 5th degree polynomial gives good 
        results (ca. 1% for 0-100 km, ca. 0.5% below 30 km)

 EXAMPLE:
        PRINT, USSA_ALT( [ 1000, 800, 600, 400, 200] )
           0.106510  1.95628  4.20607  7.16799  11.8405

             ; Prints altitudes corresponding to 1000, 800,
             ; 600, 400, 200 hPa based on the US Std Atmosphere.

 MODIFICATION HISTORY:
        bmy, 17 Jun 1998: VERSION 1.00
                          - removed section of code from 
                            CTM_GRID.PRO by mgs
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10

(See /n/home09/ryantosca/IDL/gamap2/atm_sci/ussa_alt.pro)


USSA_PRESS (FUNCTION)

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
        USSA_PRESS (function)

 PURPOSE:
        Return the pressure for a given altitude corresponding
        to the US Standard Atmosphere

 CATEGORY:
        Atmospheric Sciences

 CALLING SEQUENCE:
        RESULT = USSA_PRESS( ALTITUDE )

 INPUTS:
        ALTITUDE -> a floating point value, variable or vector
            for which temperatures shall be returned. 
            Altitude must lie in the range of 0-50 km.

 KEYWORD PARAMETERS:
        None

 OUTPUTS:
        RESULT -> A pressure value or vector [in mbar]

 SUBROUTINES:
        None

 REQUIREMENTS:
        None

 NOTES:
        The function evaluates a 5th order polynomial which had
        been fitted to USSA data from 0-100 km. Accuracy is on the
        order of 0.5% below 30 km, and 1% above. 

 EXAMPLE:
        PRINT, USSA_PRESS( [ 0, 10, 20, 30 ] )
          998.965   264.659   55.2812   11.9484

            ; Returns pressures corresponding to 0, 10, 20,
            ; and 30 km, as based on the US Std Atmosphere

 MODIFICATION HISTORY:
        mgs, 23 May 1998: VERSION 1.00
            (designed from USSA_TEMP.PRO)
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10

(See /n/home09/ryantosca/IDL/gamap2/atm_sci/ussa_press.pro)


USSA_TEMP (FUNCTION)

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
        USSA_TEMP (function)

 PURPOSE:
        Return the temperature for a given altitude corresponding
        to the US Standard Atmosphere

 CATEGORY:
        Atmospheric Sciences

 CALLING SEQUENCE:
        RESULT = USSA_TEMP( ALTITUDE )

 INPUTS:
        ALTITUDE -> a floating point value, variable or vector
            for which temperatures shall be returned. Altitude must lie
            in the range of 0-50 km.

 KEYWORD PARAMETERS:

 OUTPUTS:
        RESULT -> A temperature value or vector [in K]

 SUBROUTINES:
        None

 REQUIREMENTS:
        None

 NOTES:
        The function evaluates a 6th order polynomial which had
        been fitted to USSA data from 0-50 km. Accuracy is on the
        order of 2 K below 8 km, and 5 K from 8-50 km. Note that
        this is less than the actual variation in atmospheric 
        temperatures.

        USSA_TEMP was designed to assign a temperature value to 
        CTM grid boxes in order to allow conversion from mixing 
        ratios to concentrations and vice versa.

 EXAMPLE:
        PRINT, USSA_TEMP( [ 0, 10, 20, 30 ] )
          288.283  226.094  216.860  229.344

             ; Returns the temperature [K] at 0, 10, 20, 30 km
             ; corresponding to the US Standard Atmosphere

 MODIFICATION HISTORY:
        mgs, 16 May 1998: VERSION 1.00
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10

(See /n/home09/ryantosca/IDL/gamap2/atm_sci/ussa_temp.pro)


ZMID (FUNCTION)

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
        ZMID  (function)

 PURPOSE:
        Given a vector of altitudes at vertical edges of a model grid
        computes the altitudes at the grid centers.

 CATEGORY:
        Atmospheric Sciences

 CALLING SEQUENCE:
        RESULT = ZMID( EDGE )

 INPUTS:
        EDGE -> Vector of altitude edges that defines the grid.  
             EDGE will be sorted in ascending order.

 KEYWORD PARAMETERS:
        None

 OUTPUTS:
        RESULT -> Altitudes at grid centers [m, km, etc]

 SUBROUTINES:
        None

 REQUIREMENTS:
        None

 NOTES:
        The relationship between altitude centers and edges is:

              ZMID[N] = ( ZEDGE[N] + ZEDGE[N+1] ) / 2.0
   
 EXAMPLE:
        PRINT, ZMID( [ 0.0, 2.0, 4.0, 6.0, 8.0 ] )
           1.00000  3.00000  5.00000  7.00000

             ; Given the altitude at grid edges at 0, 2, 4, 6, 8 km
             ; returns the altitude at grid centers.
;
 MODIFICATION HISTORY:
        bmy, 21 Jun 1999: VERSION 1.00
        bmy, 22 Oct 1999: VERSION 1.44
                          - Now use SHIFT to compute the average
                            between successive edges
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10

(See /n/home09/ryantosca/IDL/gamap2/atm_sci/zmid.pro)


ZSTAR (FUNCTION)

[Previous Routine] [List of Routines]
 NAME:
        ZSTAR  (function)

 PURPOSE:
        Computes pressure-altitudes from pressures.

 CATEGORY:
        Atmospheric Sciences

 CALLING SEQUENCE:
        RESULT = ZSTAR( PRESS )

 INPUTS:
        PRESS -> The input pressure value, in [hPa].
             PRESS can be either a scalar or a vector.
             
 KEYWORD PARAMETERS:
        None

 OUTPUTS:
        RESULT -> Computed pressure altitude(s) [km]

 SUBROUTINES:
        None

 REQUIREMENTS:
        None

 NOTES:
        Pressure-altitude is defined as:

            Z* = 16 * log10[ 1000 / P(mb) ]

        which, by the Laws of Logarithms, is equivalent to

            Z* = 48 - ( 16 * log10[ P(mb) ] ).

 EXAMPLE:
        PRINT, ZSTAR( [ 900, 700, 500 ] )
          0.732121  2.47843  4.81648

             ; Returns pressure-altitudes at 900, 700, 500 hPa

 MODIFICATION HISTORY:
        bmy, 21 Jun 1999: VERSION 1.00
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10

(See /n/home09/ryantosca/IDL/gamap2/atm_sci/zstar.pro)