canopy.readers

canopy.readers.fluxnet2015

canopy.readers.fluxnet2015.fluxnet2015(path: str | Path, freq: str, subset: str = 'SUBSET', cols: list[str] | None = None, sites: list[str] | None = None)[source]

Read a file from a .zip archive from FLUXNET2015 as downloaded from www.fluxnet.org

Parameters:
  • path (str | Path) – The path of a fluxnet.org .zip file or the path of a directory containing fluxnet.org .zip files. In the latter case, see ‘sites’ argument below.

  • freq (str) –

    The frequency to retrieve as described in fluxnet.org:

    HH: half-hourly HR: hourly DD: daily WW: weekly MM: monthly YY: yearly

  • subset (str) – The subset to retrieve. One of ‘FULLSET’ or ‘SUBSET’ (the default).

  • cols (list[str] or None) – Colums to read (case insensitive). If None, the default, all columns are read.

  • sites (list[str] or None) – A list of fluxnet site codes as in https://fluxnet.org/sites/site-list-and-pages/ If None, all valid fluxnet sites in the path are read.

canopy.readers.lpjguess

Reader functions for standard LPJ-GUESS output

This module provides reader functions for the standard, text-based output of LPJ-GUESS.

Registered file formats:
  • lpjg_annual: e.g. anpp.out[.gz], aaet.out[.gz] …

  • lpjg_monthly: e.g. mnpp.out[.gz], maet.out[.gz] …

canopy.readers.lpjguess.lpjg_annual(path: str, use_layers: str | list[str] | None = None, preprocess: RedSpec | None = None, grid_type: str = 'lonlat', grid_params: dict[str, ~typing.Any] | None=None, data_dtype: type = <class 'numpy.float32'>)[source]

Read an annual output file from the standard LPJ-GUESS output.

canopy.readers.lpjguess.lpjg_monthly(path: str, preprocess: RedSpec | None = None, grid_type: str = 'lonlat', grid_params: dict[str, ~typing.Any] | None=None, layer_name: str = 'Data', data_dtype: type = <class 'numpy.float32'>)[source]

Read a monthly output file from the standard LPJ-GUESS output.

canopy.readers.registry

Registry functionalily for file readers

This file provides a registry of file reader functions. The registry is a dictonary whose keys (type str) are file format identifiers (e.g., ‘lpjg_annual’…) and the values are the file reader functions, which read a file of the specified format and return a DataFrame conforming to the Field specification (see Field docs).

canopy.readers.registry.get_format_description(format: str) str[source]

Get a file format longer description.

Parameters:

format (str) – A string identifier for the requested file reader function (e.g., ‘lpjg_annual’, ‘lpjg_monthly’…)

Return type:

The file format description stored in the registry.

canopy.readers.registry.get_reader(format: str) Callable[[str], DataFrame][source]

Get a reference to the file reader function identified by the passed parameter ‘format’.

Parameters:

format (str) – A string identifier for the requested file reader function (e.g., ‘lpjg_annual’, ‘lpjg_monthly’…)

Return type:

A reference to the requested file reader.

canopy.readers.registry.register_reader(file_reader: Callable[[str], DataFrame]) Callable[[str], DataFrame][source]

Add the decorated function to the file reader registry.

canopy.readers.registry.register_reader_desc(format_description: str)[source]

Add the decorated function to the file reader registry.