Settings#
Overview#
Wetterdienst holds core settings in its Settings class. Settings have four layers from which to be sourced:
Settings arguments e.g. Settings(ts_shape=”long”)
environment variables e.g.
WD_TS_SHAPE="wide"local .env file in the same folder (same as above)
default arguments set by
wetterdienst
The arguments are overruled in the above order meaning:
Settings argument overrules environmental variable
environment variable overrules .env file
.env file overrules default argument
The following settings are available:
General
name |
description |
default |
|---|---|---|
cache_disable |
switch of caching |
False |
cache_dir |
set the directory where the cache is stored |
platform specific / “wetterdienst” |
fsspec_client_kwargs |
pass arguments to fsspec, especially for querying data behind a proxy |
{} |
use_certifi |
use certifi certificate bundle instead of system certificates |
False |
Timeseries
name |
description |
default |
|---|---|---|
ts_humanize |
rename parameters to more meaningful names |
True |
ts_shape |
reshape the returned data to a long/tidy format, one of “long”, “wide”, if two datasets are requested, parameter names are prefixed with the dataset name |
“long” |
ts_convert_units |
convert values to target units |
True |
ts_unit_targets |
dictionary of overwrite target units e.g. |
{} |
ts_skip_empty |
skip empty stations, requires setting |
True |
ts_skip_threshold |
use with |
0.95 |
ts_skip_criteria |
statistical criteria on which the percentage of actual values is calculated with options “min”, “mean”, “max”, where “min” means the percentage of the lowest available parameter is taken, while “mean” takes the average percentage of all parameters and “max” does so for the parameter with the most percentage, requires setting |
“min” |
ts_complete |
create a complete timeseries with filled null values, will be ignored if |
False |
ts_drop_nulls |
drop all empty entries thus reducing the workload, requires setting |
True |
ts_geo_station_distance |
maximum distance to the farthest station which is used for interpolation, if the distance is exceeded, the station is skipped |
40.0 |
ts_geo_use_nearby_station_distance |
distance to the nearest station which decides whether the data is used directly from this station or if data is being interpolated |
1 |
ts_geo_min_gain_of_value_pairs |
minimum gain of value pairs which decides whether to stop looking for further stations |
1.2 |
ts_geo_num_additional_stations |
number of additional stations to take into account besides gain of value pairs |
3 |
For more on units see the chapter Units.
Python#
You can import and show Settings like
1from wetterdienst import Settings
2
3settings = Settings()
4settings
{"cache_disable": false, "cache_dir": "/home/docs/.cache/wetterdienst", "fsspec_client_kwargs": {"headers": {"User-Agent": "wetterdienst/0.127.0 (Linux)"}, "timeout": 30}, "auth": {"metno_frost": null}, "use_certifi": false, "ts_humanize": true, "ts_shape": "long", "ts_convert_units": true, "ts_unit_targets": {}, "ts_skip_empty": false, "ts_skip_threshold": 0.95, "ts_skip_criteria": "min", "ts_complete": false, "ts_drop_nulls": true, "ts_geo_station_distance": {"precipitation_height": 20.0, "precipitation_height_day": 20.0, "precipitation_height_night": 20.0, "precipitation_height_liquid": 20.0, "precipitation_height_droplet": 20.0, "precipitation_height_rocker": 20.0, "precipitation_height_last_1h": 20.0, "precipitation_height_last_3h": 20.0, "precipitation_height_last_6h": 20.0, "precipitation_height_last_9h": 20.0, "precipitation_height_last_12h": 20.0, "precipitation_height_last_15h": 20.0, "precipitation_height_last_18h": 20.0, "precipitation_height_last_21h": 20.0, "precipitation_height_last_24h": 20.0, "precipitation_height_multiday": 20.0, "precipitation_height_significant_weather_last_1h": 20.0, "precipitation_height_significant_weather_last_3h": 20.0, "precipitation_height_significant_weather_last_6h": 20.0, "precipitation_height_significant_weather_last_12h": 20.0, "precipitation_height_significant_weather_last_24h": 20.0, "precipitation_height_liquid_significant_weather_last_1h": 20.0, "precipitation_height_max": 20.0, "precipitation_height_liquid_max": 20.0, "precipitation_duration": 20.0, "snow_depth_new": 20.0, "snow_depth_new_multiday": 20.0, "snow_depth_new_max": 20.0, "water_equivalent_snow_depth_new": 20.0, "water_equivalent_snow_depth_new_last_1h": 20.0, "water_equivalent_snow_depth_new_last_3h": 20.0}, "ts_geo_use_nearby_station_distance": 1.0, "ts_geo_min_gain_of_value_pairs": 0.1, "ts_geo_num_additional_stations": 3}
or modify them for your very own request like
1from wetterdienst import Settings
2
3settings = Settings(ts_shape="wide")
4settings
{"cache_disable": false, "cache_dir": "/home/docs/.cache/wetterdienst", "fsspec_client_kwargs": {"headers": {"User-Agent": "wetterdienst/0.127.0 (Linux)"}, "timeout": 30}, "auth": {"metno_frost": null}, "use_certifi": false, "ts_humanize": true, "ts_shape": "wide", "ts_convert_units": true, "ts_unit_targets": {}, "ts_skip_empty": false, "ts_skip_threshold": 0.95, "ts_skip_criteria": "min", "ts_complete": false, "ts_drop_nulls": false, "ts_geo_station_distance": {"precipitation_height": 20.0, "precipitation_height_day": 20.0, "precipitation_height_night": 20.0, "precipitation_height_liquid": 20.0, "precipitation_height_droplet": 20.0, "precipitation_height_rocker": 20.0, "precipitation_height_last_1h": 20.0, "precipitation_height_last_3h": 20.0, "precipitation_height_last_6h": 20.0, "precipitation_height_last_9h": 20.0, "precipitation_height_last_12h": 20.0, "precipitation_height_last_15h": 20.0, "precipitation_height_last_18h": 20.0, "precipitation_height_last_21h": 20.0, "precipitation_height_last_24h": 20.0, "precipitation_height_multiday": 20.0, "precipitation_height_significant_weather_last_1h": 20.0, "precipitation_height_significant_weather_last_3h": 20.0, "precipitation_height_significant_weather_last_6h": 20.0, "precipitation_height_significant_weather_last_12h": 20.0, "precipitation_height_significant_weather_last_24h": 20.0, "precipitation_height_liquid_significant_weather_last_1h": 20.0, "precipitation_height_max": 20.0, "precipitation_height_liquid_max": 20.0, "precipitation_duration": 20.0, "snow_depth_new": 20.0, "snow_depth_new_multiday": 20.0, "snow_depth_new_max": 20.0, "water_equivalent_snow_depth_new": 20.0, "water_equivalent_snow_depth_new_last_1h": 20.0, "water_equivalent_snow_depth_new_last_3h": 20.0}, "ts_geo_use_nearby_station_distance": 1.0, "ts_geo_min_gain_of_value_pairs": 0.1, "ts_geo_num_additional_stations": 3}
If your system is running behind a proxy e.g., like
here
you may want to use the trust_env setting like
1from wetterdienst import Settings
2
3settings = Settings(fsspec_client_kwargs={"trust_env": True})
4settings
{"cache_disable": false, "cache_dir": "/home/docs/.cache/wetterdienst", "fsspec_client_kwargs": {"trust_env": true}, "auth": {"metno_frost": null}, "use_certifi": false, "ts_humanize": true, "ts_shape": "long", "ts_convert_units": true, "ts_unit_targets": {}, "ts_skip_empty": false, "ts_skip_threshold": 0.95, "ts_skip_criteria": "min", "ts_complete": false, "ts_drop_nulls": true, "ts_geo_station_distance": {"precipitation_height": 20.0, "precipitation_height_day": 20.0, "precipitation_height_night": 20.0, "precipitation_height_liquid": 20.0, "precipitation_height_droplet": 20.0, "precipitation_height_rocker": 20.0, "precipitation_height_last_1h": 20.0, "precipitation_height_last_3h": 20.0, "precipitation_height_last_6h": 20.0, "precipitation_height_last_9h": 20.0, "precipitation_height_last_12h": 20.0, "precipitation_height_last_15h": 20.0, "precipitation_height_last_18h": 20.0, "precipitation_height_last_21h": 20.0, "precipitation_height_last_24h": 20.0, "precipitation_height_multiday": 20.0, "precipitation_height_significant_weather_last_1h": 20.0, "precipitation_height_significant_weather_last_3h": 20.0, "precipitation_height_significant_weather_last_6h": 20.0, "precipitation_height_significant_weather_last_12h": 20.0, "precipitation_height_significant_weather_last_24h": 20.0, "precipitation_height_liquid_significant_weather_last_1h": 20.0, "precipitation_height_max": 20.0, "precipitation_height_liquid_max": 20.0, "precipitation_duration": 20.0, "snow_depth_new": 20.0, "snow_depth_new_multiday": 20.0, "snow_depth_new_max": 20.0, "water_equivalent_snow_depth_new": 20.0, "water_equivalent_snow_depth_new_last_1h": 20.0, "water_equivalent_snow_depth_new_last_3h": 20.0}, "ts_geo_use_nearby_station_distance": 1.0, "ts_geo_min_gain_of_value_pairs": 0.1, "ts_geo_num_additional_stations": 3}
to allow requesting through a proxy.
If you’re experiencing SSL certificate verification issues, especially in corporate environments or when system certificates are outdated, you can enable the certifi certificate bundle:
1from wetterdienst import Settings
2
3settings = Settings(use_certifi=True)
4settings
{"cache_disable": false, "cache_dir": "/home/docs/.cache/wetterdienst", "fsspec_client_kwargs": {"headers": {"User-Agent": "wetterdienst/0.127.0 (Linux)"}, "timeout": 30}, "auth": {"metno_frost": null}, "use_certifi": true, "ts_humanize": true, "ts_shape": "long", "ts_convert_units": true, "ts_unit_targets": {}, "ts_skip_empty": false, "ts_skip_threshold": 0.95, "ts_skip_criteria": "min", "ts_complete": false, "ts_drop_nulls": true, "ts_geo_station_distance": {"precipitation_height": 20.0, "precipitation_height_day": 20.0, "precipitation_height_night": 20.0, "precipitation_height_liquid": 20.0, "precipitation_height_droplet": 20.0, "precipitation_height_rocker": 20.0, "precipitation_height_last_1h": 20.0, "precipitation_height_last_3h": 20.0, "precipitation_height_last_6h": 20.0, "precipitation_height_last_9h": 20.0, "precipitation_height_last_12h": 20.0, "precipitation_height_last_15h": 20.0, "precipitation_height_last_18h": 20.0, "precipitation_height_last_21h": 20.0, "precipitation_height_last_24h": 20.0, "precipitation_height_multiday": 20.0, "precipitation_height_significant_weather_last_1h": 20.0, "precipitation_height_significant_weather_last_3h": 20.0, "precipitation_height_significant_weather_last_6h": 20.0, "precipitation_height_significant_weather_last_12h": 20.0, "precipitation_height_significant_weather_last_24h": 20.0, "precipitation_height_liquid_significant_weather_last_1h": 20.0, "precipitation_height_max": 20.0, "precipitation_height_liquid_max": 20.0, "precipitation_duration": 20.0, "snow_depth_new": 20.0, "snow_depth_new_multiday": 20.0, "snow_depth_new_max": 20.0, "water_equivalent_snow_depth_new": 20.0, "water_equivalent_snow_depth_new_last_1h": 20.0, "water_equivalent_snow_depth_new_last_3h": 20.0}, "ts_geo_use_nearby_station_distance": 1.0, "ts_geo_min_gain_of_value_pairs": 0.1, "ts_geo_num_additional_stations": 3}
This uses the certifi package which provides Mozilla’s carefully curated collection of Root Certificates for validating the trustworthiness of SSL certificates while verifying the identity of TLS hosts.