Core#
Todo
Add more modules.
Core#
Settings#
- class wetterdienst.settings.Settings(cache_disable=None, cache_dir=None, fsspec_client_kwargs=None, ts_humanize=None, ts_shape=None, ts_si_units=None, ts_skip_empty=None, ts_skip_threshold=None, ts_skip_criteria=None, ts_dropna=None, ts_interpolation_use_nearby_station_distance=None, ts_interpolation_station_distance=None, ignore_env=False)#
Wetterdienst class for general settings
- classmethod default()#
Ignore environmental variables and use all default arguments as defined above
- Return type:
Data models#
- class wetterdienst.util.geo.Coordinates(latitudes, longitudes)#
Class for storing and retrieving coordinates
- Parameters:
latitudes (
array
) – latitudes in degreelongitudes (
array
) – longitudes in degree
- get_coordinates()#
- Return type:
array
- Returns: coordinates in degree where the first column is the latitudes
and the second column the longitudes
- get_coordinates_in_radians()#
- Returns: coordinates in radians where the first column is the latitudes
and the second column the longitudes
- wetterdienst.util.geo.convert_dm_to_dd(dm)#
Convert degree minutes (floats) to decimal degree :type dm:
Series
:param dm: :rtype:Series
:return:
- wetterdienst.util.geo.convert_dms_string_to_dd(dms)#
Convert degree minutes seconds (string) to decimal degree e.g. 49 18 21 :type dms:
Series
:param dms: :rtype:Series
:return:
- wetterdienst.util.geo.derive_nearest_neighbours(latitudes, longitudes, coordinates, number_nearby=1)#
A function that uses a k-d tree algorithm to obtain the nearest neighbours to coordinate pairs
- Parameters:
latitudes (np.array) – latitude values of stations_result being compared to
coordinates (Coordinates) –
longitudes (np.array) – longitude values of stations_result being compared to
coordinates –
coordinates – the coordinates for which the nearest neighbour
searched (is) –
number_nearby (
int
) – Number of stations_result that should be nearby
- Return type:
tuple
[float
|ndarray
,ndarray
]- Returns:
Tuple of distances and ranks of nearest to most distant stations_result
Download#
- class wetterdienst.util.network.FileDirCache(use_listings_cache, listings_expiry_time, listings_cache_location=None)#
- Parameters:
use_listings_cache (bool) – If False, this cache never returns items, but always reports KeyError, and setting items has no effect
listings_expiry_time (int or float) – Time in seconds that a listing is considered valid. If None, listings do not expire.
listings_cache_location (str (optional)) – Directory path at which the listings cache file is stored. If None, an autogenerated path at the user folder is created.
- clear() None. Remove all items from D. #
- class wetterdienst.util.network.HTTPFileSystem(use_listings_cache=None, listings_expiry_time=None, listings_cache_location=None, *args, **kwargs)#
NB: if this is called async, you must await set_client
- Parameters:
block_size (int) – Blocks to read bytes; if 0, will default to raw requests file-like objects instead of HTTPFile instances
simple_links (bool) – If True, will consider both HTML <a> tags and anything that looks like a URL; if False, will consider only the former.
same_scheme (True) – When doing ls/glob, if this is True, only consider paths that have http/https matching the input URLs.
size_policy (this argument is deprecated) –
client_kwargs (dict) – Passed to aiohttp.ClientSession, see https://docs.aiohttp.org/en/stable/client_reference.html For example,
{'auth': aiohttp.BasicAuth('user', 'pass')}
get_client (Callable[..., aiohttp.ClientSession]) – A callable which takes keyword arguments and constructs an aiohttp.ClientSession. It’s state will be managed by the HTTPFileSystem class.
storage_options (key-value) – Any other parameters passed on to requests
cache_type (defaults used in open) –
cache_options (defaults used in open) –
- class wetterdienst.util.network.NetworkFilesystemManager#
Manage multiple FSSPEC instances keyed by cache expiration time.
- wetterdienst.util.network.download_file(url, settings, ttl=CacheExpiry.NO_CACHE)#
A function used to download a specified file from the server.
- Parameters:
url (
str
) – The url to the file on the dwd serversettings (
Settings
) – The settings object.ttl (
int
|CacheExpiry
) – How long the resource should be cached.
- Return type:
BytesIO
- Returns:
Bytes of the file.
- wetterdienst.util.network.list_remote_files_fsspec(url, settings, ttl=CacheExpiry.FIVE_MINUTES)#
A function used to create a listing of all files of a given path on the server.
The default ttl with
CacheExpiry.FILEINDEX
is “5 minutes”.- Parameters:
url (
str
) – The URL which should be searched for files.ttl (
CacheExpiry
) – The cache expiration time.
- Return type:
list
[str
]- Returns:
A list of strings representing the files from the path.
Enumerations#
- class wetterdienst.metadata.columns.Columns(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)#
Overhauled column names for metadata fields