fluxnet_shuttle.plugins
Data hub-specific plugins for FLUXNET Shuttle Library
- module::
fluxnet_shuttle.plugins
- moduleauthor:
Valerie Hendrix <vchendrix@lbl.gov>
- platform:
Unix, Windows
- created:
2025-10-09
This module contains data hub-specific plugins for accessing different FLUXNET data sources.
Classes
|
AmeriFlux data hub plugin implementation. |
|
ICOS Carbon Portal data hub plugin implementation. |
|
TERN data hub plugin implementation. |
- class fluxnet_shuttle.plugins.AmeriFluxPlugin(config=None)[source]
Bases:
DataHubPluginAmeriFlux data hub plugin implementation.
- Parameters:
config (Dict[str, Any] | None)
- property display_name: str
Data hub name.
- Returns:
Display name for the data hub (e.g., ‘AmeriFlux’, ‘ICOS’)
- Return type:
str
- async download_file(site_id, download_link, **kwargs)[source]
Download a file from AmeriFlux with optional user tracking.
This method extends the base download_file implementation to add AmeriFlux-specific user tracking logic: - Extracts user_info[‘ameriflux’] from kwargs if available - If user information is provided (user_name or user_email), logs the download request - Delegates to parent class for the actual download operation
- Parameters:
site_id (
str) – Site identifierdownload_link (
str) – URL to download the data from**kwargs (
Any) –Additional parameters including: - filename: The filename being downloaded - user_info: Dictionary with plugin-specific user tracking data
Example: {“ameriflux”: {“user_name”: “…”, “user_email”: “…”, …}}
- Yields:
bytes – Byte chunks from the downloaded content
- Return type:
AsyncGenerator[bytes,None]
- get_sites(**filters)[source]
Get AmeriFlux sites with FLUXNET data.
- Parameters:
**filters (
Any) – Optional filters (not used in this implementation)- Yields:
FluxnetDatasetMetadata – Site metadata objects
- Return type:
AsyncGenerator[FluxnetDatasetMetadata,None]
- property name: str
Data hub name identifier.
- Returns:
Lowercase data hub identifier (e.g., ‘ameriflux’, ‘icos’)
- Return type:
str
- class fluxnet_shuttle.plugins.ICOSPlugin(config=None)[source]
Bases:
DataHubPluginICOS Carbon Portal data hub plugin implementation.
- Parameters:
config (Dict[str, Any] | None)
- property display_name: str
Data hub name.
- Returns:
Display name for the data hub (e.g., ‘AmeriFlux’, ‘ICOS’)
- Return type:
str
- get_sites()[source]
Fetch ICOS sites with FLUXNET data from the ICOS Carbon Portal SPARQL endpoint.
Yields site metadata objects using the FluxnetDatasetMetadata model. All available sites are returned; filtering is not currently supported.
This method is an async generator. The
async_to_sync_generator()decorator allows usage in both asynchronous and synchronous contexts.- Return type:
AsyncGenerator[FluxnetDatasetMetadata,None]
- Configuration:
api_url (str): Optional. Override the default ICOS API URL. timeout (int): Optional. Request timeout in seconds.
- Yields:
FluxnetDatasetMetadata – Site metadata objects.
- Return type:
AsyncGenerator[FluxnetDatasetMetadata, None]
- property name: str
Data hub name identifier.
- Returns:
Lowercase data hub identifier (e.g., ‘ameriflux’, ‘icos’)
- Return type:
str
- class fluxnet_shuttle.plugins.TERNPlugin(config=None)[source]
Bases:
DataHubPluginTERN data hub plugin implementation.
- Parameters:
config (Dict[str, Any] | None)
- property display_name: str
Data hub name.
- Returns:
Display name for the data hub (e.g., ‘AmeriFlux’, ‘ICOS’)
- Return type:
str
- get_sites(**filters)[source]
Get TERN sites with FLUXNET data.
This method: 1. Fetches BIF file containing BADM Site General Information 2. Fetches FLUXNET product metadata file 3. Combines the data to yield FluxnetDatasetMetadata objects
- Parameters:
**filters (
Any) – Optional filters (not used in this implementation)- Yields:
FluxnetDatasetMetadata – Site metadata objects
- Return type:
AsyncGenerator[FluxnetDatasetMetadata,None]
- property name: str
Data hub name identifier.
- Returns:
Lowercase data hub identifier (e.g., ‘ameriflux’, ‘icos’)
- Return type:
str