Observation time series in the CarboScope / STILT .ts text format STILT_ts/std

Observation time series in the CarboScope / STILT .ts text format STILT_ts/std#

Description#

Observation time series in the CarboScope / STILT .ts text format.

The format is used for the observation files of CarboScope (CSR) inversions and of STILT-based intercomparisons. One file holds one station and one species, for example hmJFJx.ch4.ts or htKITx.co2.ts. Each data line has, in this order by default:

fractional year, year, month, day, hour, minute, second, latitude, longitude, height/altitude, observed value, sigma, third value

The third value differs between versions (background, modelled value, …) and is not used. Several versions of the format exist:

  • comma-separated, with one header line of column names starting with # (e.g. #Time[fractionalyear],Year,...,Observed_mixing_ratio_co2,Sigma_co2,...);

  • whitespace-separated, without column names, possibly after comment lines starting with # or #> (e.g. CarboScope output files);

  • column names and their order differ between versions.

The parser therefore

  • finds the columns by name when a header with column names is present (case and punctuation do not matter, e.g. Observed mixing ratio and Observed_mixing_ratio_co2 are both the observed value);

  • uses the default order above only for files without column names, or the order given by columns in the yml;

  • checks that the date columns agree with the fractional-year column, which catches shifted or swapped columns, and checks the coordinate ranges, the number of fields per line, and refuses monthly-mean files (*.mm.ts, *.dmm.ts);

  • removes observations with a negative sigma by default: CarboScope writes sigma = -777 for observations it does not use (option negative_obserror).

The station code and the species are taken from the file name as in CarboScope (get_codename in stilt_main.f): hmJFJx.ch4.ts gives station JFJ (two-letter prefix removed, trailing lower-case letters removed) and species CH4. Both can be set in the yml instead.

Example:

providers:
  insitu:
    provider: STILT_ts
    format: std
    dir_obs: /path/to/obs/*.co2.ts
    default_unit: ppb

YAML arguments#

The following arguments are used to configure the plugin. pyCIF will return an exception at the initialization if mandatory arguments are not specified, or if any argument does not fit accepted values or type:

Optional arguments#

parameter : str, optional

Species of the observations (e.g. CO2, CH4). If not given, taken from the file name (second part, e.g. ‘ch4’ in hmJFJx.ch4.ts).

station : str, optional

Station code. If not given, taken from the file name as in CarboScope (hmJFJx.ch4.ts gives JFJ). Only useful when one file is read.

network : str, optional, default “ICOS”

Network name written to the observation data

default_unit : str, optional, default “ppb”

Unit of the observed values and of sigma (the files do not state it)

columns : list, optional

Column order for files without column names, as a list of roles: fracyear, year, month, day, hour, minute, second, lat, lon, alt, obs, obserror; any other name for columns to ignore. Default: fracyear, year, month, day, hour, minute, second, lat, lon, alt, obs, obserror, extra. Files with column names are read by name and ignore this option, unless force_columns is True.

force_columns : bool, optional, default False

Use ‘columns’ even if the file has column names

use_file_obserror : bool, optional, default True

Read the observation error from the sigma column. If False (or if the file has no sigma column), the observation error is set to default_obserror.

default_obserror : float, optional, default 0.0

Observation error used when it is not read from the file

time_rounding : “floor” or “nearest” or “none”, optional, default “floor”

How observation times with minutes or seconds are turned into hours

  • “floor”: hour of the time stamp (minutes and seconds are cut)

  • “nearest”: nearest hour, minutes 0-30 down and 31-59 up (as CarboScope record2model_date)

  • “none”: keep minutes and seconds

check_fracyear : bool, optional, default True

Check that the date columns agree with the fractional-year column (detects shifted or swapped columns)

fracyear_tolerance : float, optional, default 1.0

Largest accepted difference between the fractional-year column and the date columns, in hours

fill_value_threshold : float, optional

Observed values at or below this value are treated as missing and removed (with a message). None: keep all values.

negative_obserror : “drop” or “keep” or “error”, optional, default “drop”

What to do with negative sigma values. CarboScope writes sigma = -777 for observations it does not use (e.g. no footprint); used as an error, -777 would give them a weight of 1/777^2 instead of leaving them out.

  • “drop”: remove these observations (with a message)

  • “keep”: keep them with the negative error (as ICOS_Fabian_inv did)

  • “error”: stop with an error

YAML template#

Please find below a template for a YAML configuration:

 1obsparser:
 2  plugin:
 3    name: STILT_ts
 4    version: std
 5    type: obsparser
 6
 7  # Optional arguments
 8  parameter: XXXXX  # str
 9  station: XXXXX  # str
10  network: XXXXX  # str
11  default_unit: XXXXX  # str
12  columns: XXXXX  # list
13  force_columns: XXXXX  # bool
14  use_file_obserror: XXXXX  # bool
15  default_obserror: XXXXX  # float
16  time_rounding: XXXXX  # floor|nearest|none
17  check_fracyear: XXXXX  # bool
18  fracyear_tolerance: XXXXX  # float
19  fill_value_threshold: XXXXX  # float
20  negative_obserror: XXXXX  # drop|keep|error