pycif.plugins.obsparsers.verify — API reference#

Configuration reference: verify plugin

pycif.plugins.obsparsers.verify.headers.get_header(obs_file, maxlen)[source]#

Extract the header from a VERIFY format observation file

Parameters:
  • obs_file (str) – path to input file

  • maxlen (int) – abort after this amount of lines when reading header. Default 300

Returns:

List with all Lines of the Header

Return type:

List[str]

pycif.plugins.obsparsers.verify.headers.parse_header(header, spec, list_extract, default_unit='ppm', default_tz='utc')[source]#

Extract information from the header

Parameters:
  • header (list[str]) – extracted header

  • spec (str) – species to extract

  • list_extract (list[str]) – list of parameters to return ‘flag’ to extract flag ‘error’ to extract observation error any other parameter appearing in the columns

  • default_unit (str) – default unit generally used to report this species

  • default_tz (str) – default time zone for this file

Returns:

a 4-element tuple containing
  • names (list[str]): list of columns names to extract

  • columns (list[int]): list of column index to extract

  • date_ids (list[int]): list of column ids for date information

  • extra (dict): extra information contained in the header and not

    in the body of the file, e.g., altitude, coordinates, unit, etc.

pycif.plugins.obsparsers.verify.utils.remap_head(s)[source]#

Adapts names to extract values in VERIFY header

pycif.plugins.obsparsers.verify.utils.find_header(id_extract, header)[source]#

Finds the value of a constant parameter (e.g., latitude, altitude, etc.) in the header of a file

pycif.plugins.obsparsers.verify.utils.rescale(obs_file, header)[source]#

Finds out on what scale the measurement was reported and returns the corresponding scaling factor.

Notes

If the scale is not in the list of recognized scales, then returns a NaN to kill the data

pycif.plugins.obsparsers.verify.utils.parse_file(obs_file)[source]#

Parses VERIFY file name and extract corresponding information.

pycif.plugins.obsparsers.verify.utils.convert_unit(df, params, unit='ppb', default_unit='ppb')[source]#

Converts between ppb, ppm, ppt. Default is conversion to ppm

pycif.plugins.obsparsers.verify.utils.shiftdate(dates, tz)[source]#

Shifts dates according to a time zone as define in WDCCGG files

pycif.plugins.obsparsers.verify.utils.remap_extract(s)[source]#

Adapts names to extract columns in the context of WDCGG

pycif.plugins.obsparsers.verify.utils.average(df, mountain_site=[])[source]#

Average and keep only afternoon values. For some mountain sites, average and keep only night values.