kvant


Table of Contents


Latest changes

Only the visible changes are documented here, latest changes first.


revision 1.22  date: 1998/02/24
Renamed from fitart to kvant.
ASCII output file formats slightly changed:
  Second line in header: format info replaced by audit trail.
  Solar angles now BEFORE latitude/longitude (main output file).
  Version information from *.cl1 file is copied to output files.
  Actual window is written to output files.

revision 1.21  date: 1998/02/12
Performance optimisation

revision 1.19  date: 1997/12/31
Max. number of reference spectra increased from 5 to 7.
New fit mode "SINGLE": shift/squeeze for current (earthshine) spectrum only.
Default fit mode changed to LINEAR.
Syntax of keyword TRACE slightly changed: 1. degree of polynomial now
  optional, default value -1 (no individual polynomial).
  2. duplicate file names allowed if file columns differ.
Comment lines starting with two asterisks will be copied from the
  configuration file to the main output file(s).
New keyword VERBOSE. Output of covariance matrices and fit results
  on screen only if VERBOSE is set to .TRUE.

revision 1.18  date: 1997/12/05
Linear fit error calculation corrected for smoothing:
  number of spectral points m has to be divided by effective width of
  smoothing window.

revision 1.17  date: 1997/11/26
Smoothing option added: New keyword SMOOTH.
  Available filters: box (running average), triangle, 4th order symmetric
  Savitzky-Golay, lowpass
Smoothing can be switched OFF (but not ON!) for each trace gas individually:
  NOSMOOTH option for TRACE keyword. To be used with presmoothed references.

Introduction

KVANT is a remote sensing tool designed to retrieve atmospheric trace gas amounts from high-resolution spectra. It can be used for any kind of remote sensing measurements in the UV/visible part of the spectra, ground-based as well as satellite measurements. The main outputs of the program are trace gas slant column densities (SC) which can be converted into vertical column densities (VC) by applying an Air Mass Factor (AMF). The AFM is a wavelength-dependent quantity. It can be calculated for ground-based or satellite geometry by using an adequate Radiative Transfer Model (e.g. SCIATRAN).

KVANT uses the Differential Optical Absorption Spectroscopy (DOAS) method, which applies the Lambert-Beer Law as an approximated description of attenuation of solar radiation within the earth atmosphere. Taking the logarithm of the Lambert-Beer Law yields a linear relation between atmospheric optical depth and trace gas amounts under certain assumptions. Absorption cross-sections of the trace gases under consideration, which can be measured in the laboratory for different conditions, are fitted to the measured optical depth in terms of least-squares. A discrimination between fine-scale und broad-band spectral features is defined using a polynomial, which is simultaneously fitted to the measurement. Subtracting the polynomial from the spectrum gives the Differential spectrum which mainly contains information about the atmospheric trace gas amounts. The main assumptions are: relatively weak trace gas absorption and absorption cross-sections which are weakly dependent on height (temperature).

In other words, the depth of absorption structures in measurements of atmospheric optical properties enables to estimate trace gas amounts using the knowledge about their absorption cross-sections and a polynomial fit to derive differential spectra.

Using GOME or SCIAMACHY satellite measurements a wavelength miss-calibration between ground laboratory measurements, solar irradiance and earth radiance measurements have to be sometimes considered, depending on the quality of the data. These can be corrected by KVANT using a shift and squeeze correction scheme, applying a non-linear least-squares fitting in terms of wavelength.

Installation

Pre-requisites are:

  1. Fortran 90 compiler
  2. GNU make (download)
  3. Pre-compiler (cpp)
  4. NetCDF library (download)
  5. Pgplot library (download)

Unpack the KVANT archive. AskGet the archive from: here Change into directory ./f90/make.

Type
gmake f90
to convert the modules ../modules/*.F90 into valid Fortran code (specific for your system) and to generate dependency files.

Type
gmake program=kvant
to generate an executable of kvant. Type lv1_conv or lv2_conv instead of kvant in order to generate the according executables if needed.

After installation you will find the executable under ./bin. You may copy the executable to another directory, e.g. /usr/local/bin.

The NetCDF and Pgplot libraries are implemented as dynamic libraries (to be linked during runtime). Make sure that your LD_LIBRARY_PATH system variable contains the location of the needed libraries, e.g. /usr/local/lib.

Further installation instructions: see Makefile (./f90/make/Makefile).

Getting started

  1. Best chances of untainted application is announced for Sun workstations (Solaris). The package is dedicated to work on other systems as well (see section Installation).
  2. If you want to evaluate GOME level 1 data, convert the orbits you need into the NetCDF compact level 1 (`*.cl1') format, using the conversion program lv1_conv. Take care to extract at least the fitting window plus some safety margin (5 nm) on both sides.
  3. Create or modify the configuration file kvant.cfg in your current directory. All settings controlling program execution are made there. See section The configuration file.
  4. Call kvant from where it is installed, for example:
    /user/local/bin/kvant
    
    You may find it convenient to define an alias for this or to add the path to your search path for executables.

Input / output files

`cfg-filename'
Configuration file (control file), required input. All settings controlling program execution are made in this file. By default, configuration parameters are read from the file `kvant.cfg' in the current directory (the one from which kvant has been started). However, you can specify another name for the configuration file on the command line. For a detailed description: section `Configuration files' in GOME related software: Introduction, and section The configuration file.
`tof-filename'
List of GOME data files connecting filenames (in the first column) and orbit numbers (in the second column). See section `Table of orbits and filenames (TOF)' in GOME related software: Introduction. Usually required input. Exception: Only one file, of which its name (not orbit number!) is explicitly given, is to be processed.
`bkg-path/bkg-filename.bkg-extension'
File containing the background spectrum I0, e.g. a solar spectrum. Required input. The formats currently supported are xy-ASCII and compact level 1 (`*.cl1'). If the file is in compact level 1 format and contains more than one spectrum, spectra are averaged into one background spectrum. Selection criteria can be specified.
`cur-path/cur-filename.cur-extension'
File(s) containing the current spectrum I, e.g. earthshine spectra. Usually required input. The formats currently supported are xy-ASCII and compact level 1 (`*.cl1'). If the file is in compact level 1 format and contains more than one spectrum, spectra are processed in sequence. Selection criteria can be specified. Spectra can be averaged "on the fly". The optical density ln(I0/I) is the target function for the fit. If no current spectrum I is given, I0 is the target function for the fit.
`trace-path/trace-filename'
File(s) containing the references (base functions) for the fit, e.g., trace gas or Ring spectra. These files must be in xy-ASCII format. Required input. Currently, up to seven references can be fitted simultaneously(1).
`mainout-path/cur-filename.fit-identifier'
Main output file(s), optional output. The fitted parameters (trace gas columns, shifts and squeezes) are written into this file. Note that the basename of the current file is used as the basename of the main output file. This means, there is one main output file per current input file (orbit).
`extout-path/cur-filename.fit-identifierX'
Extended output file(s), optional output. Target functions (optical densities) fitted base functions and fit residuals are written into this file. The basename of the current file is also used as the basename of the extended output file. An X (for extended) is appended to the name to avoid naming conflicts with the main output file.
`kvant.err'
Error log file, auxiliary output. Contains all errors, warnings, and messages issued during program execution.

The configuration file

Details on the naming, the general configuration file syntax, and keywords used by several programs are described in section `Configuration files' in GOME related software: Introduction, which should be consulted first.

All lines defining configuration parameters are copied from the configuration file into the main output file header(s). This allows you to repeat a fit using the same settings even when the original configuration file has been lost (provided its syntax has not changed in the meantime...). Simply extract the relevant lines from the header and remove the leading asterisks.

Normally, comment lines are not copied from the configuration file into the main output file. If you want a comment line to be copied, precede it with two asterisks (**) instead of one.

Detailed keyword description

The following keywords are available:

ID  BACKGROUND  CURRENT  TRACE  MAINOUT  EXTOUT  MODE  WINDOW  DEGPOLY
TOF  VERBOSE

With some of these keywords, sub-keywords are used. Sub-keywords are

PATH  FILE  EXTENSION  ALL  ORBIT  TIME  AVERAGE  SHSQ_LIMITS
GROUNDPIXEL  SUBSET  SOLAR_ZENITH  LATITUDE  LONGITUDE  DISTANCE

Background spectrum

At present, the name of the file containing the background spectrum must be explicitly given. Some time in the future there may be automatic determination of a suitable background spectrum, e.g. the nearest available solar spectrum.

BACKGROUND PATH bkg-path[+][+]
bkg-path is the path to the file(s) containing background spectra. The optional trailing plusses control expansion by the usual GOME data subdirectories. See section `Other Keywords' in GOME related software: Introduction, keyword PATH. If you use both `BACKGROUND PATH' and `BACKGROUND FILE', bkg-filename must not contain a path.
BACKGROUND EXTENSION bkg-extension
bkg-extension is the extension of the file(s) containing background spectra. If you use both `BACKGROUND EXTENSION' and `BACKGROUND FILE', bkg-filename must not contain an extension.
BACKGROUND FILE bkg-filename
The background spectrum will be read from file bkg-filename. You must specify this line: there is no default value for bkg-filename. You may specify a complete filename here and omit `BACKGROUND PATH' and `BACKGROUND EXTENSION'. Otherwise, if bkg-filename contains no path and bkg-path is given, it will be prepended to bkg-filename. If bkg-filename contains no extension and bkg-extension is given, it will be appended to bkg-filename. If the background file contains several spectra, they are averaged into one background spectrum. You can select earthshine spectra to be averaged using the following set of keywords.
BACKGROUND GROUNDPIXEL ...
BACKGROUND SUBSET ...
BACKGROUND SOLAR_ZENITH ...
BACKGROUND LATITUDE ...
BACKGROUND LONGITUDE ...
BACKGROUND DISTANCE ...
Select groundpixels within the background file, which will be averaged to give the background spectrum. See section `Keywords for selecting groundpixels' in GOME related software: Introduction.

Current spectrum

CURRENT PATH cur-path[+][+]
cur-path is the path to the file(s) containing the current spectra. The optional trailing plusses control expansion by the usual GOME data subdirectories. See section `Other Keywords' in GOME related software: Introduction. If you use both `CURRENT PATH' and `CURRENT FILE', cur-filename must not contain a path.
CURRENT EXTENSION cur-extension
cur-extension is the extension of the file(s) containing the current spectra. If you use both `CURRENT EXTENSION' and `CURRENT FILE', cur-filename must not contain an extension.
CURRENT {FILE | ALL | TIME | ORBIT} ...
These are four ways to select the current spectrum/spectra, of which exactly one has to be selected. Use the sub-keyword FILE if you want to evaluate a single file. Use one of the other sub-keywords (see section `Keywords for selecting orbits' in GOME related software: Introduction), if you want to evaluate several files (orbits). In this case, their basenames (up to 8 characters) are read from the table of orbits and filenames (TOF). cur-path and cur-extension are then added to the basename.
CURRENT FILE cur-filename
The current spectrum will be read from file cur-filename. You may specify a complete filename here and omit `CURRENT PATH' and `CURRENT EXTENSION'. Otherwise, if cur-filename contains no path and cur-path is given, it will be prepended to cur-filename. If cur-filename contains no extension and cur-extension is given, it will be appended to cur-filename. Since cur-filename is explicitly specified, a table of orbits and filenames (TOF) will not be read at all.
CURRENT SHSQ_LIMITS min-sh max-sh [min-sq max-sq]
Set the shift and squeeze limits (in nm) for the current spectrum. Shift and squeeze limits are zero (!) by default (no shift and squeeze). In the case of a completely linear fit, fixed shifts and squeezes in the middle of the specified ranges are used (see MODE LINEAR below). It is possible to keep shift and/or squeeze for the current spectrum at a fixed value (exclude them from the nonlinear fit) the same way as the trace gas references: by setting minimum and maximum to the same value. This feature, however, will only be needed for sensitivity studies.
CURRENT AVERAGE avg
The current spectrum is an average over avg groundpixels, if possible. By default, avg is 1 (no averaging). Averages do not extend over orbits. If less than avg groundpixels are remaining at the end of an orbit, only these are averaged.
CURRENT GROUNDPIXEL ...
CURRENT SUBSET ...
CURRENT SOLAR_ZENITH ...
CURRENT LATITUDE ...
CURRENT LONGITUDE ...
CURRENT DISTANCE ...
Select groundpixels within the current file. See section `Keywords for selecting groundpixels' in GOME related software: Introduction. Only groundpixels fulfilling all conditions are evaluated.

Reference spectra

TRACE PATH trace-path
trace-path is the path to the file(s) containing the trace gas reference spectra. By default, this is the empty string. trace-path is added to relative names only, not to absolute names. By specifying trace-path you can avoid having to repeat the same path constituent for all references.
TRACE id trace-filename [[column-number] degpoly [min-sh max-sh [min-sq max-sq]]] [NOSMOOTH]
This line contains the definitions for exactly one reference spectrum, e.g., a trace gas absorption cross section or a Ring spectrum. It can be used up to seven times. The order of trace gases on output will be the same as in the configuration file. id, a string of up to 8 characters, is a unique identifier for the reference. Usually you will take the reference name (O3, NO2, OClO, Ring, etc.) as identifier. In some cases, e.g., when fitting several temperatures or base functions simultaneously, you may need be more precise, like O3-221K, O3-273K, Ring-A, Ring-B, etc. id is used only for making screen and file output better readable, because it's shorter than the filename. trace-filename is the name of the file containing the reference spectrum in xy-ASCII format. If trace-path has been specified and trace-filename is a relative path, i.e., it does not start with a slash, trace-path will be prepended to trace-filename. column-number is the column in trace-filename, from which the reference spectrum is to be read. Its default value is 2, i.e., the reference is read from the second column. Note that the wavelength is always read from the first column. degpoly is the degree of the polynomial, which is subtracted from the reference spectrum to make it "differential". This happens before the fit. The number of polynomial coefficients is degpoly +1. By default, degpoly is -1, i.e., no individual polynomials at all are subtracted. This is recommended, as subtracting polynomials from each reference is both redundant and time-consuming. Therefore this feature will be completely removed from kvant soon. min-sh and max-sh are the shift limits for the reference, given in nm. They specify the range, within which the nonlinear fit is allowed to vary the shift parameter for this reference. If you want to shift this reference by a fixed value and keep there, set both min-sh and max-sh to this value. In this case (min-sh = max-sh), the shift value is excluded from the nonlinear fit. min-sq and max-sq are the squeeze limits for the reference, given in nm. They specify the range, within which the nonlinear fit is allowed to vary the squeeze parameter for this reference. If you want to squeeze this reference by a fixed value (and keep there), set both min-sq and max-sq to this value. In this case (min-sq = max-sq), the squeeze value is excluded from the nonlinear fit. Shift and squeeze limits are zero (!) by default (no shift and squeeze). For the fit modes LINEAR and SINGLE (see below), fixed shifts and squeezes in the middle of the specified ranges are used. For the fit mode COUPLED, shifts and squeezes given with the TRACE keyword are ignored. Specifying NOSMOOTH switches off the smoothing (if any) for this trace gas reference. This is intended to be used for references smoothed in advance. Take care that any pre-smoothing and smoothing within kvant are performed exactly the same way (with respect to filter type and width).

File output

ID fit-identifier
fit-identifier is a string identifying the set of fit parameters given in the current file. Its default value is `000'. It is used as an extension for the output file names, so try to keep it short (although up to 80 characters are allowed). It is recommended, but not necessary, to use fit-identifier also as an extension for the configuration file name.
MAINOUT {ASC | BIN | NONE}
Attention: The sub-keyword BIN is currently not available, because binary output is under reconstruction. Sorry for the inconvenience! Select ASCII (ASC) or binary (BIN) output format for the main output file, or do not write main output file at all (NONE). The default value is ASC.
MAINOUT PATH mainout-path[+][+]
mainout-path is the directory into which the main output files will be written.
EXTOUT {ASC | BIN | NONE}
Attention: This keyword is currently not available, because binary output is under reconstruction. Sorry for the inconvenience! Select ASCII (ASC) or binary (BIN) output format for the extended output file, or do not write extended output file at all (NONE). The default value is NONE.
EXTOUT PATH extout-path[+][+]
extout-path is the directory into which the extended output files will be written.

Preparation of spectra and fit

SMOOTH width [filter]
Choose the settings for spectral smoothing. All spectra except the trace gase references marked with NOSMOOTH will be smoothed over width points in a way determined by filter. width has to be an odd integer not smaller than 3 for all filters except the lowpass. For the lowpass filter, width has to be a positive number (not necessarily integer). filter is one of BOX | TRI | SAV | LOW, selecting boxcar (running average), triangular, Savitzky-Golay and lowpass smoothing, respectively. The default is TRI. The first three filters are applied on the spectra in the wavelength domain. The lowpass filter is applied in the wavenumber domain: The spectrum is Fourier transformed, a Welch filter is applied on the wavenumbers, and the wavenumbers are Fourier transformed back to wavelengths.
MODE {LINEAR | SINGLE | INDIVIDUAL | COUPLED min-sh max-sh [min-sq max-sq]}
Controls the fit mode, i.e., whether and how the nonlinear parameters shift and squeeze are fitted. The default mode is LINEAR(2). The recommended mode is SINGLE. Note that execution time increases with the number of nonlinear parameters. MODE LINEAR selects the linear fit mode. Shift and squeeze values are not fitted. Instead, they are kept fixed at the mean values of their limits, (min-sh+max-sh)/2, and (min-sq+max-sq)/2, respectively. This refers both to the current spectrum (limits given with the CURRENT SHSQ_LIMITS keyword) and to each reference (limits given with the TRACE keyword). MODE SINGLE selects a restricted nonlinear fit mode. The current (earth radiance) spectrum is shifted and squeezed within the limits given with the CURRENT SHSQ_LIMITS keyword. Shifts and squeezes of the reference spectra are kept fixed at the mean values of their limits, as described for the linear fit mode. MODE COUPLED min-sh max-sh [min-sq max-sq] selects a restricted nonlinear fit mode. A common shift value and a common squeeze value are fitted for all references, i.e., they are shifted and squeezed together. The given limits are those for the common shift and squeeze values. Their default value is zero. Any shift and squeeze limits for the references given with the TRACE keyword are ignored. Note that shift and squeeze for the current spectrum are still determined separately: they are not coupled to those of the references, and their limits have to be specified with the CURRENT SHSQ_LIMITS keyword. This mode is not very useful. It is retained mainly for historical reasons. MODE INDIVIDUAL selects the general nonlinear fit mode. Shift and squeeze parameters for each reference and for the current spectrum are fitted independently. Shift and squeeze limits for the references are given with the TRACE keyword for each reference separately. Shift and squeeze limits for the current spectrum are given with the CURRENT SHSQ_LIMITS keyword. Use this mode with great care and only if you know what you are doing. All kinds of artifacts are waiting for you. kvant automatically switches from INDIVIDUAL to SINGLE mode in case all reference spectra are held fixed (e.g., by omitting their shift and squeeze limits). If in addition the current spectrum is held fixed, kvant automatically switches to the LINEAR mode.
WINDOW start-wavelength end-wavelength
start-wavelength and end-wavelength are the (approximate) margins of the fit window (in nm). The fit window must be specified. The actual fit window depends on the wavelength grid of the background spectrum. It is determined as the largest subset of this grid which lies completely within the specified window. Thus, the actual fit window is always slightly smaller than the specified window. It will be written to screen and to the output files.
DEGPOLY overall-degpoly
overall-degpoly is the degree of the "overall" polynomial, which is fitted together with the references in the linear fit. It must not be smaller than the highest "individual" polynomial degree degpoly, given with the TRACE keyword. Its default value is 2 (quadratic). The number of polynomial coefficients is overall-degpoly + 1.

Example configuration file

An example of a valid configuration file is given below. Note that it is intended as an illustration rather than containing useful settings!

** Configuration file for kvant.f90, OClO, Antarctica
ID oclo-04
* TOF index

BACKGROUND PATH /home/eisinger/gome++
BACKGROUND FILE 50915115
BACKGROUND EXTENSION cl1
BACKGROUND SOLAR_ZENITH 69 71
BACKGROUND LATITUDE 0 90

CURRENT PATH /home/eisinger/gome++
CURRENT TIME 50915
CURRENT EXTENSION  cl1
CURRENT LATITUDE -90 -60
CURRENT SHSQ_LIMITS  -0.15 0.15 -0.15 0.15

TRACE PATH  /home/eisinger/spectra
TRACE OClO  new/iup/oclo_217.vac
TRACE NO2   gome_fm/no2_241.vac
TRACE O4    ref/o4.vac
* TRACE Ring  ref/ring_2v.asc 1 -0.1 0.1 -0.1 0.1 NOSMOOTH

MAINOUT PATH /home/eisinger/gome/results+
MAINOUT ASC
EXTOUT  PATH /home/eisinger/tmp
EXTOUT  NONE

SMOOTH 3 LOW
MODE SINGLE
WINDOW   355 385
DEGPOLY  3

VERBOSE T

A note on shift and squeeze

In the configuration file, shift and squeeze have to be given in nanometers. The shifted and squeezed wavelength x' is calculated from the original wavelength x as

  x' = x + sh + 2 sq (x - c) / w

where c is the window center wavelength and w the window width.

The interpretation of a shift by sh is straightforward. A squeeze by sq refers to the upper margin of the fitting window. This means, the squeeze introduces an additional "shift" of sq at the upper margin, -sq at the lower margin and zero in the window center. "No squeeze" means sq = 0.


Footnotes

(1)

If you need to fit more than seven references, increase the constant NTRACESMAX in Fortran source file `kvant.f90' and rebuild the executable file.

(2)

This follows from the zero default values for shift and squeeze.


This document was generated on 24 Febuary 1998 using the texi2html translator version 1.51.