disdrodb package#
Subpackages#
- disdrodb.api package
- disdrodb.data_transfer package
- disdrodb.issue package
- disdrodb.l0 package
- Subpackages
- Submodules
- disdrodb.l0.check_configs module
- disdrodb.l0.check_standards module
- disdrodb.l0.io module
- disdrodb.l0.l0_processing module
- disdrodb.l0.l0_reader module
- disdrodb.l0.l0a_processing module
- disdrodb.l0.l0b_nc_processing module
- disdrodb.l0.l0b_processing module
- disdrodb.l0.routines module
- disdrodb.l0.standards module
- disdrodb.l0.template_tools module
- Module contents
- disdrodb.metadata package
- disdrodb.tests package
- disdrodb.utils package
Submodules#
disdrodb.configs module#
Created on Thu Nov 2 15:39:01 2023.
@author: ghiggi
- disdrodb.configs.define_disdrodb_configs(base_dir: Optional[str] = None, zenodo_token: Optional[str] = None, zenodo_sandbox_token: Optional[str] = None)[source]#
Defines the DISDRODB configuration file with the given credentials and base directory.
- Parameters
base_dir (str) – The base directory where DISDRODB Metadata Archive is located.
zenodo__token (str) – Zenodo Access Token. It is required to upload stations data to Zenodo.
zenodo_sandbox_token (str) – Zenodo Sandbox Access Token. It is required to upload stations data to Zenodo Sandbox.
Notes
This function write or update the DISDRODB config YAML file. The DISDRODB config YAML file is located in the user’s home directory at
~/.config_disdrodb.yml
. The configuration file is used to run the various DISDRODB operations.
- disdrodb.configs.read_disdrodb_configs() dict[str, str] [source]#
Reads the DISDRODB configuration file and returns a dictionary with the configuration settings.
- Returns
A dictionary containing the configuration settings for the DISDRODB.
- Return type
dict
- Raises
ValueError – If the configuration file has not been defined yet. Use
disdrodb.define_configs()
to specify the configuration file path and settings.
Notes
This function reads the YAML configuration file located at
~/.config_disdrodb.yml
.
disdrodb.docs module#
Open the documentation for the relevant sensor.
Module contents#
- disdrodb.available_campaigns(product, data_sources=None, return_tuple=True, base_dir=None)[source]#
Return campaigns for which stations data are available.
- disdrodb.available_data_sources(product, base_dir=None)[source]#
Return data sources for which stations data are available.
- disdrodb.available_sensor_names(product: str = 'L0A') sorted [source]#
Get available names of sensors.
- Returns
sensor_names (list) – Sorted list of the available sensors
product (str) – DISDRODB product. By default, it returns the sensors available for DISDRODB L0A products.
- disdrodb.available_stations(product, data_sources=None, campaign_names=None, station_names=None, return_tuple=True, base_dir=None)[source]#
Return stations for which data are available on disk.
- disdrodb.check_archive_metadata_compliance(base_dir: Optional[str] = None, raise_error=False)[source]#
Check the archive metadata compliance.
- Parameters
base_dir (str (optional)) – Base directory of DISDRODB. Format:
<...>/DISDRODB
. IfNone
(the default), thebase_dir
path specified in the DISDRODB active configuration will be used.raise_error (bool (optional)) – Whether to raise an error and interrupt the archive check if a metadata is not compliant. The default is
False
.
- Returns
If the check succeeds, the result is
True
, otherwiseFalse
.- Return type
bool
- disdrodb.check_archive_metadata_geolocation(base_dir: Optional[str] = None)[source]#
Check the metadata files have missing or wrong geolocation..
- Parameters
base_dir (str (optional)) – Base directory of DISDRODB. Format:
<...>/DISDRODB
. IfNone
(the default), thebase_dir
path specified in the DISDRODB active configuration will be used.- Returns
If the check succeeds, the result is
True
, otherwiseFalse
.- Return type
bool
- disdrodb.define_configs(base_dir: Optional[str] = None, zenodo_token: Optional[str] = None, zenodo_sandbox_token: Optional[str] = None)#
Defines the DISDRODB configuration file with the given credentials and base directory.
- Parameters
base_dir (str) – The base directory where DISDRODB Metadata Archive is located.
zenodo__token (str) – Zenodo Access Token. It is required to upload stations data to Zenodo.
zenodo_sandbox_token (str) – Zenodo Sandbox Access Token. It is required to upload stations data to Zenodo Sandbox.
Notes
This function write or update the DISDRODB config YAML file. The DISDRODB config YAML file is located in the user’s home directory at
~/.config_disdrodb.yml
. The configuration file is used to run the various DISDRODB operations.
- disdrodb.download_archive(data_sources: Optional[Union[str, list[str]]] = None, campaign_names: Optional[Union[str, list[str]]] = None, station_names: Optional[Union[str, list[str]]] = None, force: bool = False, base_dir: Optional[str] = None)[source]#
Download DISDRODB stations with the
disdrodb_data_url
in the metadata.- Parameters
data_sources (str or list of str, optional) – Data source name (eg : EPFL). If not provided (
None
), all data sources will be downloaded. The default isdata_source=None
.campaign_names (str or list of str, optional) – Campaign name (eg : EPFL_ROOF_2012). If not provided (
None
), all campaigns will be downloaded. The default iscampaign_name=None
.station_names (str or list of str, optional) – Station name. If not provided (
None
), all stations will be downloaded. The default isstation_name=None
.force (bool, optional) – If
True
, overwrite the already existing raw data file. The default isFalse
.base_dir (str (optional)) – Base directory of DISDRODB. Format:
<...>/DISDRODB
. IfNone
(the default), the disdrodb config variablebase_dir
is used.
- disdrodb.download_station(data_source: str, campaign_name: str, station_name: str, force: bool = False, base_dir: Optional[str] = None) None [source]#
Download data of a single DISDRODB station from the DISDRODB remote repository.
- Parameters
data_source (str) – The name of the institution (for campaigns spanning multiple countries) or the name of the country (for campaigns or sensor networks within a single country). Must be provided in UPPER CASE.
campaign_name (str) – The name of the campaign. Must be provided in UPPER CASE.
station_name (str) – The name of the station.
base_dir (str (optional)) – The base directory of DISDRODB, expected in the format
<...>/DISDRODB
. If not specified, the path specified in the DISDRODB active configuration will be used.force (bool, optional) – If
True
, overwrite the already existing raw data file. The default isFalse
.base_dir – Base directory of DISDRODB. Format:
<...>/DISDRODB
. IfNone
(the default), the disdrodb config variablebase_dir
is used.
- disdrodb.open_sensor_documentation(sensor_name)[source]#
Open the sensor documentation PDF in the browser.
- disdrodb.read_station_metadata(data_source, campaign_name, station_name, base_dir=None, product='RAW')[source]#
Open the station metadata YAML file into a dictionary.
- Parameters
data_source (str) – The name of the institution (for campaigns spanning multiple countries) or the name of the country (for campaigns or sensor networks within a single country). Must be provided in UPPER CASE.
campaign_name (str) – The name of the campaign. Must be provided in UPPER CASE.
station_name (str) – The name of the station.
base_dir (str, optional) – The base directory of DISDRODB, expected in the format
<...>/DISDRODB
. If not specified, the path specified in the DISDRODB active configuration will be used.product (str, optional) – The DISDRODB product in which to search for the metadata file. The default is
"RAW"
.
- Returns
metadata – The station metadata dictionary
- Return type
dictionary