---------------------------
MADIS Raobdump Program Usage
---------------------------


1.0  Introduction
-----------------

The MADIS raobdump program can be used to read radiosonde station information, 
observations, and quality control (QC) information for a single time, and dump 
this to an output text file.  The operation of the program is controlled by a 
text parameter file that allows the user to exercise all of the options included 
in the MADIS system for raob data.  The program can be run as needed to access 
any MADIS data stored on your system, or can be run as a time-scheduled task to 
get data keyed to the current time.

This document describes how to setup the parameter file, how to run the 
program, and what to expect in the way of outputs.  Fortran programmers who 
wish to write their own programs to read MADIS data can find much of the same 
information in the raobdump.f source code in the src directory.  In addition to 
being used for the dump utility, the code is annotated to provide a tutorial for 
programmers.


2.0  How to Run
---------------

1.  Make sure you have the necessary environment variables defined:

    - MADIS_STATIC  points to the MADIS static files directory

    - MADIS_DATA    points to the top-level MADIS data directory

    AWIPS users should point MADIS_DATA to FXA_DATA.

    See the INSTALL.* files for information on how to set environment 
    variables on your system.

2.  Setup the desired parameters in a raobdump parameter file.

3.  Move to the directory in which you'll be running the program.

4.  Copy the parameter file to the run directory, and make sure that its 
    name is "raobdump.par".

5.  Run the program.  (bin/raobdump.exe on Unix/Linux, bin/raobdump on Windows)

6.  Outputs:

    a.  An activity log showing the selections made from the parameter file,
        as well as any errors that resulted will be written to standard output.
    
    b.  The data that's been obtained will be written to raobdump.txt in the
        run directory.


3.0  How to Setup the Parameter File
------------------------------------

These sample parameter files can be found in the doc directory:

- raobdump.par   Dumps all variables, using defaults for all options.

- raobdump1.par  Example of how to specify variables to produce tables
                 with the main observed variables, with defaults for all other
                 options.

The parameter file is split into several sections, with each section delimited
by a line of "----------"'s.  With a couple of exceptions noted below, you
must include all lines that are within each section (in other words, the 
sections are "fixed length").  Each of the sections is described below, in the 
order in which they appear in the parameter file.


3.1  Database Section
---------------------

---------------------------------------------------------------------------------
              Database                                    FIXED LENGTH SECTION
              --------
FSL           'FSL' or 'AWIPS'
---------------------------------------------------------------------------------

If you have obtained MADIS files from FSL, leave the line as shown above.  If
you're reading AWIPS data, enter AWIPS at the beginning of the line.


3.2  Time Window Section
------------------------

---------------------------------------------------------------------------------
              Time Window (use 0,0,0 for default)         FIXED LENGTH SECTION
              -----------
-60           Number of minutes relative to nominal time at which to start window
60            Number of minutes relative to nominal time at which to end window
3             0 - return all records within the file containing nominal time
              1 - return one record per fixed station, closest to nominal time
              2 - return one record per fixed station, closest to start of window
              3 - return one record per fixed station, closest to end of window
              4 - return all records within *window*
---------------------------------------------------------------------------------

The user selects the nominal time of the data to be returned in the Time
Selection section below.  Time "windowing" is used so that the program will
know how close in time each station's observation time needs to be to the 
nominal time in order to be included, and whether or not duplicate records from 
the same station that are within the time window should be included.  The time 
window is specified by selecting the number of minutes before and after the 
nominal time to be used for the window, and how duplicates should be handled.  
For radiosonde obs, the "observation time" is sometimes referred to as the
"synoptic time", as contrasted with the "release time" of the balloon.  For
the twice-daily North American radiosonde launches, the observation times are
0000 and 1200 UTC (and the release times are typically +- 70 minutes of the
observation time).

If the default values (0,0,0) are selected, then all records (including multiple 
reports from the same station) will be returned from the file containing the 
nominal time.  

The settings shown in the sample section above will return obs within +- 60 
minutes of the nominal time, and if multiple reports from the same station are 
found, only the latest one will be returned.  If your application runs hourly,
you might want to specify that when multiple reports are found, the one closest
to the nominal time be returned.  For other applications it's suggested that
using the latest record within the window will provide better results in cases
where a second radiosonde launch has been necessary as a result of equipment
problems, or thunderstorms in the area.  Because many radiosondes tend to be 
available with observation times up to an hour earlier than the 0000 and 1200 
UTC periods, it's recommended that you don't use the default window (which will 
only give you the 0000 or 1200 reports), but instead use the +- 60 minute window 
shown here.

If you are running the program as a scheduled task with the nominal time
keyed to the current time, one recommended window setting would be -60,0,3.
This would return the most current observation for every station that had
reported within the last hour.

The maximum window is 180 minutes.  Also note that the window is inclusive,
that is, using start & end minutes -30,30 with a nominal time of 12:00 will
return observations with times ranging from 11:30 through 12:30.


3.3  Domain Filter Section
--------------------------

---------------------------------------------------------------------------------
              Domain Filter                               FIXED LENGTH SECTION
              -------------
0             0 - don't filter
              1 - return stations within latitude/longitude corners
              2 - return stations within specified Polar Stereographic grid
              3 - return stations within specified Lambert Conformal Conic grid

              Latitude/Longitude Corners (lines skipped if not Domain Filter 1)
              --------------------------
37.0          SW corner latitude (north)   
-109.0        SW corner longitude (east)
41.0          NE corner latitude (north)
-102.0        NE corner longitude (east)

              Polar Stereo Specification (lines skipped if not Domain Filter 2)
              --------------------------
190500.0      Grid box size (meters)
7.838         Latitude (north) of 1st grid point (lower left = SW)
-141.028      Longitude (east) of 1st grid point (lower left = SW)
-95.0         Orientation longitude (east)                 
33.0          I-coordinate of pole
45.0          J-coordinate of pole
60.0          Lat (north) at which X-Y scale is true
65            Number of grid points in X-direction (I dimension)
43            Number of grid points in Y-direction (J dimension)

              Lambert Conformal Conic Specification (lines skipped if not Domain Filter 3)
              -------------------------------------
40635.25      Grid box size (meters)
12.19         Latitude (north) of 1st grid point (lower left = SW)
-133.459      Longitude (east) of 1st grid point (lower left = SW)
-95.0         Orientation longitude (east)
25.0          Latitude (north) of first Lambert Conformal tangent
25.0          Latitude (north) of second Lambert Conformal tangent
185           Number of grid points in X-direction (I dimension)
129           Number of grid points in Y-direction (J dimension)
---------------------------------------------------------------------------------

The horizontal domain can be limited to match one of two map projections (polar 
stereographic, Lambert conformal conic) or it can be limited to a 
latitude/longitude rectangle.  Only stations within the domain will be returned.  
If one of the map projections is selected, any winds (of any form) returned will
be rotated to match the projection.  

If the default is selected (as above), no domain filtering will be performed,
and all available stations will be returned, regardless of their location.

(The example Latitude/Longitude specification shown above is for the state of
Colorado, the example Polar Stereographic specification defines AWIPS grid 202 
(NATIONAL-CONUS), and the example Lambert Conformal specification defines AWIPS 
grid 212 (REGIONAL-CONUS-DOUBLE RESOLUTION).)
 
If one of the map projections has been selected for the horizontal domain, the 
station latitude and longitude will be converted to a grid index into the 
2-dimensional grid (RI,RJ).  Note that this works for grids laid out this way:

                     NE (I=NX,J=NY)

  SW (I=1,J=1)

The calculated index will appear in raobdump.txt in the "Grid I" and "Grid J"
columns.  If a map projection isn't being used, Grid I and Grid J will be
output as zeros.


3.4  QC Filter Section
----------------------

---------------------------------------------------------------------------------
              QC Filter                                   FIXED LENGTH SECTION    
              ---------
0              0 - none
               1 - coarse
               2 - screened
              99 - highest possible
---------------------------------------------------------------------------------

The primary variables in all MADIS datasets have been screened by automated 
quality control (QC) checks.  Different variables have different levels of QC, 
or "stages", applied to them.  For example, temperature may have level 1 checks
(validity) and level 2 checks (hydrostatic, superadiabatic lapse rate).  Note 
that each level of QC incorporates the previous levels, i.e., an ob that 
has passed level 2 has also passed any applicable level 1 checks.  See 
raob_qc_variable_list.txt for more information.  (Level 1 checks = "coarse", 
level 2 = "screened".)

Each variable that gets dumped will also have its associated QC information
written to raobdump.txt.  This includes a QC data descriptor (a single 
character summarizing the info), and bitmasks showing which QC checks were
applied and the results of the checks.  These appear in the "QCD", "QCA", and
"QCR" columns of the output.  For details on how to interpret these items see
qc_info.txt.

If the user doesn't want to interpret the QC info, he or she can limit the 
returned obs to selectable levels of quality.  In that case, obs that don't 
meet the selected QC level will be omitted.

There are three ways that the user can request and process the QC information:

  1) Use the default setting (shown above) which will disable QC filtering.
     Then you can examine the QC info before deciding whether or not to use 
     each observation.  This allows for the maximum amount of control over 
     what's available.  

  2) If you know ahead of time that the same level of QC is available for all 
     variables you'll be using, select that level.

  3) To require that all variables pass the highest level of QC that are 
     specified for them, select QC level 99.

User's of MADIS data who want the data filtered by QC results, but don't want to
interpret the QC information themselves, should select QC level 99.


3.5  Hydrostatic Correction Section
-----------------------------------

---------------------------------------------------------------------------------
	      Hydrostatic Correction                      FIXED LENGTH SECTION
              ----------------------
0             0 - yes
              1 - no
---------------------------------------------------------------------------------

Mandatory level heights and temperatures have a hydrostatic check applied to them 
that, given certain circumstances, can have sufficient confidence to recommend a 
corrected value be used instead of the original value, which has failed the 
check.  The actual data value, however, isn't changed in the MADIS database, and 
the user has control over whether or not the correction is made before the data 
are returned to the user.  Note that this choice also applies to variables that
are derived by MADIS (e.g., interpolated pressure and height, dew point 
temperature and relative humidity).  

The default setting (0), shown above, will apply any recommended hydrostatic
check corrections.


3.6  Time Selection Section
---------------------------

---------------------------------------------------------------------------------
	      Time Selection                              FIXED LENGTH SECTION
              --------------
1             0 - Julian format (YYJJJHHMM)
              1 - Month/Day format (YYYYMMDD_HHMM)
0             0 - Use the nominal time line below
              1 - Use the current time as the nominal time
20040824_1200 Nominal time (in selected format)
---------------------------------------------------------------------------------

All MADIS data are time-stamped in Universal Coordinated Time (also called GMT).
Two formats are supported, both for inputting the nominal time in the 
parameter file, and for outputting the time in the raobdump.txt output file.

"Julian format" is in the form of "YYJJJHHMM", where:

  YY  = 2-digit year (good from 1980 - 2179)
  JJJ = Julian date of the year (001-366)
  HH  = Hour (00-23)
  MM  = Minute (00-59)

"Month/Day" format uses "YYYYMMDD_HHMM", where:

  YYYY = 4-digit year (still only good from 1980 - 2179)
  MMDD = Month/Day 
  HHMM = Hour/Minute 

The nominal time shown above in the Month/Day format translates to 042371200
in the Julian format.

Nominal times can be specified at any minute, not just at the top of the hour 
(minute 00).

To run the program as a scheduled task, specify that the current time be
used as the nominal time and set an appropriate time window.


3.7  Station Selection Section
------------------------------

---------------------------------------------------------------------------------
	      Station Selection                           FIXED LENGTH SECTION
              -----------------
0             0 - Get all stations
              1 - Get only the station whose name is on the next line
KREV          Single station name
---------------------------------------------------------------------------------

The default shown here is to get data from all stations that meet the criteria
already specified above.  If desired, you can specify a single station to be
dumped.


3.8  Variables Section
----------------------

---------------------------------------------------------------------------------
              Variables (1-4 per line, until end of file) VARIABLE LENGTH SECTION
              --------- (see doc/raob_variable_list.txt)
P HT TD RH
P HT Q DPD

---------------------------------------------------------------------------------

This is the last section in the parameter file.  The code names for the variables
to be dumped are listed, 1 to 4 per line, until the end of file is reached.  
Variables specified together on a parameter file line will be output together in
the raobdump.txt file, so you can create a table showing the sounding for several
variables side-by-side.  (The section delimiter line shown here is simply for 
readability.  If you have this line or any other non-variable line in the real 
parameter file you'll get an error.)

Separate variable code names are used for the different sounding types, e.g., 
"U" will return the integrated sounding U wind components, and "UMAN" will return 
only the mandatory level U wind components.  For most applications, the user 
should use the set of variable code names that will retrieve the integrated 
sounding.

The list of code names is found in the first column of raob_variable_list.txt,
along with the units for each variable, the maximum QC level, and many other
details.

In the above example, note that we're dumping the four moisture variables
supported by MADIS (dewpoint temperature, relative humidity, specific humidity, 
and dew point depression).  For many variables, you can select multiple forms
and MADIS will do the calculations for you.  For full information on what
variables are available and how to interpret them, see raob_variable_list.txt.
