Readers

tsp.readers.read_classic(filepath: str, init_file: str | None = None) TSP

Read output from CLASSIC land surface model

Depth values, if provided, represent the midpoint of the model cells.

Parameters:
  • filepath (str) – Path to an output file

  • init_file (str) – Path to a classic init file. If provided, depth values will be calculated. Otherwise an IndexedTSP is returned

Returns:

An IndexedTSP. Use set_depths() to provide depth information if init_file is not provided.

Return type:

TSP

tsp.readers.read_csv(filepath: str, datecol: str | int, datefmt: str = '%Y-%m-%d %H:%M:%S', depth_pattern: str | dict = '^(-?[0-9\\.]+)$', na_values: list = [], **kwargs) TSP

Read an arbitrary CSV file

Date and time must be in a single column, and the csv must be in the ‘wide’ data format (each depth is a separate column)

Parameters:
  • filepath (str) – Path to csv file

  • datecol (Union[str, int]) – Either the numeric index (starting at 0) of date column (if int) or name of date column or regular expression (if str)

  • datefmt (str, optional) – The format of the datetime values. Use python strftime format codes, by default "%Y-%m-%d %H:%M:%S"

  • depth_pattern (str or dict) – If string: A regular expression that matches the column names with depths. The regular expression must have a single capture group that extracts just the numeric part of the column header, by default r”^(-?[0-9.]+)$”. If column names were in the form "+/-1.0_m" (i.e. included ‘m’ to denote units), you could use the regular expression r"^(-?[0-9\.]+)_m$" If a dictionary is passed, the keys must be the column names and the values are the depths. This is useful if the column names are not numeric.

  • na_values (list, optional) – Additional strings to recognize as NA. Passed to pandas.read_csv, by default []

Returns:

A TSP

Return type:

TSP

tsp.readers.read_geoprecision(filepath: str) IndexedTSP

Read a Geoprecision datalogger export (text file)

Reads GP5W- and FG2-style files from geoprecision.

Parameters:

filepath (str) – Path to file.

Returns:

An IndexedTSP

Return type:

IndexedTSP

tsp.readers.read_geotop(file: str) TSP

Read a GEOtop soil temperature output file

Parameters:

file (str) – Path to file.

Returns:

A TSP

Return type:

TSP

tsp.readers.read_gtnp(filename: str, metadata_filepath=None, autodetect_metadata=True) TSP

Read test file from GTN-P database export

Parameters:
  • filename (str) – Path to file.

  • metadata_file (str, optional) – Path to GTN-P metadata file (), by default None

Returns:

A TSP

Return type:

TSP

tsp.readers.read_hoboware(filepath: str, hoboware_config: HOBOProperties | None = None) IndexedTSP

Read Onset HoboWare datalogger exports

Parameters:
  • filepath (str) – Path to a file

  • hoboware_config (HOBOProperties, optional) – A HOBOProperties object with information about how the file is configured. If not provided, the configuration will be automatically detected if possible, by default None

Returns:

An IndexedTSP. Use the set_depths method to provide depth information

Return type:

IndexedTSP

tsp.readers.read_logr(filepath: str) IndexedTSP | TSP

Read a LogR datalogger export (text file)

Reads LogR ULogC16-32 files.

Parameters:

filepath (str) – Path to file.

Returns:

An IndexedTSP or TSP, depending on whether the depth labels are sensible

Return type:

IndexedTSP, TSP

tsp.readers.read_netcdf(file: str, standard_name='temperature_in_ground') TSP

Read a CF-compliant netCDF file

Parameters:
  • file (str) – Path to netCDF file.

  • standard_name (str, optional) – The standard name of the data variable, by default ‘temperature_in_ground’. ‘soil_temperature’ is also common.

  • location (The file must represent data from a single)

  • present. (A single data variable (with 'temperature_in_ground' or '' 'standard name' either ) must be)

  • present.

  • present.

tsp.readers.read_ntgs(filename: str) TSP

Read a file from the NTGS permafrost database

Parameters:

filename (str) – Path to file.

Returns:

A TSP

Return type:

TSP

tsp.readers.read_rbr(file_path: str) IndexedTSP
Parameters:

filepath

tsp.readers.read_permos(filepath: str) TSP

Read file from PERMOS database export

Parameters:

filename (str) – Path to file.

Returns:

  • TSP – A TSP

  • Used for data obtained from PERMOS (permos.ch/data-portal/permafrost-temperature-and-active-layer)