canopy.sources

canopy.sources.registry

This module is a registry for Source objects. Source objects are subclasses of the abstract Source class. They provide an interface to handle data from different sources (model output, observations…)

canopy.sources.registry.get_source(path: str, source_id: str, **kwargs) Source[source]

Construct a source object from the data in ‘path’ for source ‘source_id’.

Parameters:
  • path (str) – The path of the data source (simulation output)

  • source_id (str) – String identifier of the source the decorated Source object is associated with

canopy.sources.registry.register_source(source_id: str) Callable[source]

Register decorated source subclass for source ‘source_id’.

Parameters:

source_id (str) – String identifier of the source the decorated Source object is associated with

canopy.sources.source_abc

class canopy.sources.source_abc.Source(path: str, source_data: dict)[source]

Bases: ABC

Source abstract base class

drop_field(field_id: str) None[source]

Drop or ‘unload’ a field

Parameters:

field_id (str) – The field’s key in the _fields dictionary

property fields: MappingProxyType

Stores the source’s fields (if not loaded, the field is None).

Type:

dict

get_field(field_id: str) Field | None[source]

Get a reference to a field

Parameters:

field_id (str) – The field’s key in the _fields dictionary

property is_loaded: dict[str, bool]

Stores the source’s fields (if not loaded, the field is None).

Type:

dict

abstractmethod load_field(field_id: str) Field[source]

Load a field from the source. To be implemented by the subclasses.

Parameters:

field_id (str) – The string identifier of the field to load.

property path: str

Stores the path of the source (e.g. the model output folder).

Type:

str

property source: str

The name of the source.

Type:

str

property source_data: MappingProxyType

the dict with the registered source data.

Type:

dict

canopy.sources.source_fluxnet2015

canopy.sources.source_lpjguess