meteostat 1.6.7__py3-none-any.whl → 1.7.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- meteostat/__init__.py +12 -1
- meteostat/core/cache.py +0 -2
- meteostat/core/loader.py +26 -28
- meteostat/core/warn.py +1 -1
- meteostat/interface/base.py +10 -7
- meteostat/interface/daily.py +44 -31
- meteostat/interface/hourly.py +44 -43
- meteostat/interface/meteodata.py +54 -69
- meteostat/interface/monthly.py +24 -19
- meteostat/interface/normals.py +61 -21
- meteostat/interface/point.py +1 -4
- meteostat/interface/stations.py +9 -8
- meteostat/interface/timeseries.py +98 -66
- meteostat/series/aggregate.py +0 -1
- meteostat/series/interpolate.py +12 -2
- meteostat/series/normalize.py +7 -8
- meteostat/units.py +3 -3
- meteostat/utilities/aggregations.py +2 -2
- meteostat/utilities/endpoint.py +1 -1
- meteostat/utilities/helpers.py +38 -0
- meteostat/utilities/mutations.py +11 -1
- {meteostat-1.6.7.dist-info → meteostat-1.7.0.dist-info}/METADATA +4 -4
- meteostat-1.7.0.dist-info/RECORD +39 -0
- {meteostat-1.6.7.dist-info → meteostat-1.7.0.dist-info}/WHEEL +1 -1
- meteostat-1.6.7.dist-info/RECORD +0 -39
- {meteostat-1.6.7.dist-info → meteostat-1.7.0.dist-info}/LICENSE +0 -0
- {meteostat-1.6.7.dist-info → meteostat-1.7.0.dist-info}/top_level.txt +0 -0
meteostat/units.py
CHANGED
|
@@ -6,7 +6,7 @@ Convert a Pandas Series to any meteorological data unit
|
|
|
6
6
|
The code is licensed under the MIT license.
|
|
7
7
|
"""
|
|
8
8
|
|
|
9
|
-
from numpy import
|
|
9
|
+
from numpy import nan, isnan
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
def fahrenheit(value):
|
|
@@ -62,7 +62,7 @@ def direction(value):
|
|
|
62
62
|
Convert degrees to wind direction
|
|
63
63
|
"""
|
|
64
64
|
|
|
65
|
-
wdir =
|
|
65
|
+
wdir = nan
|
|
66
66
|
|
|
67
67
|
if (337 <= value <= 360) or value <= 23:
|
|
68
68
|
wdir = "N"
|
|
@@ -90,7 +90,7 @@ def condition(value):
|
|
|
90
90
|
"""
|
|
91
91
|
|
|
92
92
|
if isnan(value) or value < 1 or value > 27:
|
|
93
|
-
return
|
|
93
|
+
return nan
|
|
94
94
|
|
|
95
95
|
return [
|
|
96
96
|
"Clear",
|
|
@@ -19,7 +19,7 @@ def weighted_average(step: pd.DataFrame) -> pd.DataFrame:
|
|
|
19
19
|
|
|
20
20
|
data = np.ma.masked_array(step, np.isnan(step))
|
|
21
21
|
data = np.ma.average(data, axis=0, weights=data[:, -2])
|
|
22
|
-
data = data.filled(np.
|
|
22
|
+
data = data.filled(np.nan)
|
|
23
23
|
|
|
24
24
|
return pd.DataFrame(data=[data], columns=step.columns)
|
|
25
25
|
|
|
@@ -30,7 +30,7 @@ def degree_mean(data: pd.Series) -> float:
|
|
|
30
30
|
"""
|
|
31
31
|
|
|
32
32
|
if data.isnull().all():
|
|
33
|
-
return np.
|
|
33
|
+
return np.nan
|
|
34
34
|
|
|
35
35
|
rads = np.deg2rad(data)
|
|
36
36
|
sums = np.arctan2(np.sum(np.sin(rads)), np.sum(np.cos(rads)))
|
meteostat/utilities/endpoint.py
CHANGED
|
@@ -25,7 +25,7 @@ def generate_endpoint_path(
|
|
|
25
25
|
# Base path
|
|
26
26
|
path = f"{granularity.value}/"
|
|
27
27
|
|
|
28
|
-
if granularity
|
|
28
|
+
if granularity in (Granularity.HOURLY, Granularity.DAILY) and year:
|
|
29
29
|
path += f"{year}/"
|
|
30
30
|
|
|
31
31
|
appendix = ".map" if map_file else ""
|
meteostat/utilities/helpers.py
CHANGED
|
@@ -8,6 +8,7 @@ under the terms of the Creative Commons Attribution-NonCommercial
|
|
|
8
8
|
The code is licensed under the MIT license.
|
|
9
9
|
"""
|
|
10
10
|
|
|
11
|
+
from typing import Optional
|
|
11
12
|
import numpy as np
|
|
12
13
|
|
|
13
14
|
|
|
@@ -30,3 +31,40 @@ def get_distance(lat1, lon1, lat2, lon2) -> float:
|
|
|
30
31
|
arch_sin = 2 * np.arcsin(np.sqrt(arch))
|
|
31
32
|
|
|
32
33
|
return radius * arch_sin
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _get_flag_from_single_source(
|
|
37
|
+
source: str, source_mappings: dict, model_flag: str
|
|
38
|
+
) -> str:
|
|
39
|
+
"""
|
|
40
|
+
Get flag from single source
|
|
41
|
+
"""
|
|
42
|
+
if source in source_mappings:
|
|
43
|
+
return source_mappings[source]
|
|
44
|
+
return model_flag
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def get_flag_from_source_factory(source_mappings: dict, model_flag: str) -> str:
|
|
48
|
+
"""
|
|
49
|
+
Get flag from source
|
|
50
|
+
"""
|
|
51
|
+
|
|
52
|
+
def _get_flag_from_source(source: Optional[str]) -> str:
|
|
53
|
+
sources = source.split(" ")
|
|
54
|
+
|
|
55
|
+
flags = [
|
|
56
|
+
_get_flag_from_single_source(src, source_mappings, model_flag)
|
|
57
|
+
for src in sources
|
|
58
|
+
]
|
|
59
|
+
|
|
60
|
+
return "".join(flags)
|
|
61
|
+
|
|
62
|
+
return _get_flag_from_source
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def with_suffix(items, suffix):
|
|
66
|
+
"""
|
|
67
|
+
Takes a list of strings and a suffix, returns a new list containing
|
|
68
|
+
the same items with the suffix added.
|
|
69
|
+
"""
|
|
70
|
+
return [item + suffix for item in items]
|
meteostat/utilities/mutations.py
CHANGED
|
@@ -52,8 +52,18 @@ def adjust_temp(df: pd.DataFrame, alt: int):
|
|
|
52
52
|
# Adjust values for all temperature-like data
|
|
53
53
|
for col_name in temp_like:
|
|
54
54
|
if col_name in df.columns:
|
|
55
|
-
df.loc[df[col_name] != np.
|
|
55
|
+
df.loc[df[col_name] != np.nan, col_name] = df[col_name] + (
|
|
56
56
|
temp_diff * ((df["elevation"] - alt) / 100)
|
|
57
57
|
)
|
|
58
58
|
|
|
59
59
|
return df
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def calculate_dwpt(df: pd.DataFrame, col: str) -> pd.DataFrame:
|
|
63
|
+
"""
|
|
64
|
+
Calculate dew point temperature
|
|
65
|
+
"""
|
|
66
|
+
df[col] = df["temp"] - ((100 - df["rhum"]) / 5)
|
|
67
|
+
df[f"{col}_flag"] = df[["temp_flag", "rhum_flag"]].max(axis=1, skipna=True)
|
|
68
|
+
|
|
69
|
+
return df
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: meteostat
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.7.0
|
|
4
4
|
Summary: Access and analyze historical weather and climate data with Python.
|
|
5
5
|
Home-page: https://github.com/meteostat/meteostat-python
|
|
6
6
|
Author: Meteostat
|
|
@@ -14,10 +14,10 @@ Classifier: Topic :: Database
|
|
|
14
14
|
Classifier: Topic :: Scientific/Engineering :: Atmospheric Science
|
|
15
15
|
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
16
16
|
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
17
|
-
Requires-Python: >=3.
|
|
17
|
+
Requires-Python: >=3.8.0
|
|
18
18
|
Description-Content-Type: text/markdown
|
|
19
19
|
License-File: LICENSE
|
|
20
|
-
Requires-Dist: pandas
|
|
20
|
+
Requires-Dist: pandas>=2
|
|
21
21
|
Requires-Dist: pytz
|
|
22
22
|
Requires-Dist: numpy
|
|
23
23
|
|
|
@@ -25,7 +25,7 @@ Requires-Dist: numpy
|
|
|
25
25
|
|
|
26
26
|
The Meteostat Python library provides a simple API for accessing open weather and climate data. The historical observations and statistics are collected by [Meteostat](https://meteostat.net) from different public interfaces, most of which are governmental.
|
|
27
27
|
|
|
28
|
-
Among the data sources are national weather services like the National Oceanic and Atmospheric Administration (NOAA) and Germany's national
|
|
28
|
+
Among the data sources are national weather services like the National Oceanic and Atmospheric Administration (NOAA) and Germany's national weather service (DWD).
|
|
29
29
|
|
|
30
30
|
Are you looking for a **hosted solution**? Try our [JSON API](https://rapidapi.com/meteostat/api/meteostat/).
|
|
31
31
|
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
meteostat/__init__.py,sha256=wkvGKIkMyOgM1HqWBY9nQAlsqh3JCuM82Ojz7DUkX8g,989
|
|
2
|
+
meteostat/units.py,sha256=G0vh2tYsp0ESGUpg3ZAE0U-b9Ih_oMtPNDZ71Bbq3iE,2566
|
|
3
|
+
meteostat/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
meteostat/core/cache.py,sha256=MEC6Hcf2rwg3__zv_Y1nSk16mfdTsrLH9CTraMX7NYw,1764
|
|
5
|
+
meteostat/core/loader.py,sha256=bAItihzJrabglu37NN697WX_csltOviC9u7twAtV8rY,2842
|
|
6
|
+
meteostat/core/warn.py,sha256=K9fBDoY2TIC2HjmCJl0k1Dq-dWA1hNq16OTLoG2F_rI,647
|
|
7
|
+
meteostat/enumerations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
+
meteostat/enumerations/granularity.py,sha256=lmhlHDUPvCwb05fDxYNG4GEuYCgy-u-AiZhpXJOj3uY,457
|
|
9
|
+
meteostat/interface/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
+
meteostat/interface/base.py,sha256=8ksGkdgyRDw2AA5ZwuES9XuBjseBPoNBBQiNspVp2JA,968
|
|
11
|
+
meteostat/interface/daily.py,sha256=Rx-_U_t2iX-4wtBdieihioeo99mKEplrZaM23YRkwnM,2949
|
|
12
|
+
meteostat/interface/hourly.py,sha256=nP4hIjxYbcZk0ua6m6fclAXfuhrxzB3jHPyiz3dLNs4,3965
|
|
13
|
+
meteostat/interface/interpolate.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
|
+
meteostat/interface/meteodata.py,sha256=fAIwW7rdAAX6WDl9pUq8p-xOR-GoNtsYdNlTJI0Xl0E,6511
|
|
15
|
+
meteostat/interface/monthly.py,sha256=LbeXgodQcVX0h987bv2lEJvewIcQkgt5Co_dyJ14F_A,2577
|
|
16
|
+
meteostat/interface/normals.py,sha256=d6H5IDWdAfIYZpuWNsqsiL4Kgc6PDLe4zkTUgaYjD8g,7006
|
|
17
|
+
meteostat/interface/point.py,sha256=lnKyvaclcsOXaErpPpaH0_3T1j2X7kgCKlIhk4s-EGQ,3801
|
|
18
|
+
meteostat/interface/stations.py,sha256=hC2DmtE24u--lb3jbkFVMkFDKCR-LP5h8uXSOIb4_hg,6683
|
|
19
|
+
meteostat/interface/timeseries.py,sha256=tE1ShXADPNnhirL5puZb2KyDq18cWU1HX8XU6J8qp4U,7909
|
|
20
|
+
meteostat/series/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
21
|
+
meteostat/series/aggregate.py,sha256=dhYx1c2OzOgEcdUNCrmT4zdYY1UuT4PhkWYRirmx7v0,1200
|
|
22
|
+
meteostat/series/convert.py,sha256=BjVmyDQ_G5ccgOD4vk_2hnX6ShDt6vHEzrWXRnjsUKQ,631
|
|
23
|
+
meteostat/series/count.py,sha256=kV0Oztmy1K0E3Z1h8Na9twxUhujRepRMtGzM_CNInJc,358
|
|
24
|
+
meteostat/series/coverage.py,sha256=76PlEoVPM_-4Oys-6THggV-7gESbPM6Cx0m1n0-1YcM,534
|
|
25
|
+
meteostat/series/fetch.py,sha256=MIrkhhtAucThO06Bcc92c6rrc3v5G31VBI0TkQd0oZ0,620
|
|
26
|
+
meteostat/series/interpolate.py,sha256=tM41T_Hgc4Q2tAlommB5aRLvA3QVjX82WXXLVImSAJ4,1193
|
|
27
|
+
meteostat/series/normalize.py,sha256=-eOa21NbV5vMSy3MSIiKhDbni5KCa2UV_CNf3A_JWTk,2151
|
|
28
|
+
meteostat/series/stations.py,sha256=pHDQR1t7Z7jN5Vaj8wdNnSsZI8s6SiH5bNeTbys3TjA,447
|
|
29
|
+
meteostat/utilities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
30
|
+
meteostat/utilities/aggregations.py,sha256=-t4ZBNM8cnwnuiR7Bzt7OlUQxNJMZkqS3E4AIMrJg3M,915
|
|
31
|
+
meteostat/utilities/endpoint.py,sha256=ndHSMGi5LhB1yrjA3f6pDbe-0glnnDAX7IInp0Gscik,806
|
|
32
|
+
meteostat/utilities/helpers.py,sha256=wt11OXHzIDw3DY98XGIfcrh1bPCC9dClVnNdGtqvz4U,1691
|
|
33
|
+
meteostat/utilities/mutations.py,sha256=qT9lJ1IsiEp5CKMN8IiJBdzHGPE80mJv0VBH-z6fkbg,1750
|
|
34
|
+
meteostat/utilities/validations.py,sha256=MlKY1gkeqmovFr4lR_iM6Bk7yuGdSgy0NGceiqYI7Vs,646
|
|
35
|
+
meteostat-1.7.0.dist-info/LICENSE,sha256=kqpl7FVzWOCe11BZqJBZ1aRQi-aK87j3ljtG7P3VxLc,1066
|
|
36
|
+
meteostat-1.7.0.dist-info/METADATA,sha256=XlhFJUEt7mmsltKiKzZzL7Z07Pl74jS5LRZOsnOqovs,4633
|
|
37
|
+
meteostat-1.7.0.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
|
38
|
+
meteostat-1.7.0.dist-info/top_level.txt,sha256=s8LP1xi5iF2zhVv5ULkHwW-tPeMrljxnA8VqZibQqro,10
|
|
39
|
+
meteostat-1.7.0.dist-info/RECORD,,
|
meteostat-1.6.7.dist-info/RECORD
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
meteostat/__init__.py,sha256=DcEfvgC5Z7nPkfjVJ9zsVzOL9z_-ASKP8mWS4VUYMZ8,858
|
|
2
|
-
meteostat/units.py,sha256=3rePrCjMt39oHcFU01ADdMadC80Txd_jqP7PF6QWnnw,2566
|
|
3
|
-
meteostat/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
-
meteostat/core/cache.py,sha256=ZCBijVA-Zk2FSizLTnkV5hzcL8ecGhOpKURQsWpY0Es,1766
|
|
5
|
-
meteostat/core/loader.py,sha256=VVIzfYDhvD4JvNpUkEuB_IvQ6-fWddokLP4Qp1DEveQ,2496
|
|
6
|
-
meteostat/core/warn.py,sha256=SsHSEPhEOGYpJwfVrbxbDt8xP7UfZV7e87o9bcUEnac,653
|
|
7
|
-
meteostat/enumerations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
-
meteostat/enumerations/granularity.py,sha256=lmhlHDUPvCwb05fDxYNG4GEuYCgy-u-AiZhpXJOj3uY,457
|
|
9
|
-
meteostat/interface/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
-
meteostat/interface/base.py,sha256=95RLlbwtrx4dseLclFOPBu9dxFNoWIx1wT9oi9LqVdo,883
|
|
11
|
-
meteostat/interface/daily.py,sha256=EbPVKBANAH10fkg76dAIDWeebA9zcBmWKRbIp-WE8aw,2459
|
|
12
|
-
meteostat/interface/hourly.py,sha256=EpPOdld6FJ_OkHd6opiBiO70cPs_mP8oST_Q3Zl36Vo,3761
|
|
13
|
-
meteostat/interface/interpolate.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
|
-
meteostat/interface/meteodata.py,sha256=Ec0MTgfAB6E5cohvrcDZoFwelTj3V4nc0MlQPjSo4uY,7066
|
|
15
|
-
meteostat/interface/monthly.py,sha256=1P6IdnJ_sooc_-4pfkOPCeMjupd-8UMH4xB1KfMW0RE,2416
|
|
16
|
-
meteostat/interface/normals.py,sha256=jYRM-iCi4W0dNFGJgWRSJQmvkqilVHUMQRiM-GHTu44,5518
|
|
17
|
-
meteostat/interface/point.py,sha256=N755kWXIeLpaNvG4H7Khv0YmDKA86rviybe2C1UK_QA,3804
|
|
18
|
-
meteostat/interface/stations.py,sha256=xwrtaLFvXWNwDfTGLLIbu4EjCkE54wS4TZZS8K8RdTU,6626
|
|
19
|
-
meteostat/interface/timeseries.py,sha256=JeJ3Lc2cMAE4H8gbCSlktWKjV9wY0J4X0Q9n0vd4ONU,6381
|
|
20
|
-
meteostat/series/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
21
|
-
meteostat/series/aggregate.py,sha256=xyDwTjFxuX7NRNcaCc31VnYChZ2xP7DnyHDYsvn8nCI,1201
|
|
22
|
-
meteostat/series/convert.py,sha256=BjVmyDQ_G5ccgOD4vk_2hnX6ShDt6vHEzrWXRnjsUKQ,631
|
|
23
|
-
meteostat/series/count.py,sha256=kV0Oztmy1K0E3Z1h8Na9twxUhujRepRMtGzM_CNInJc,358
|
|
24
|
-
meteostat/series/coverage.py,sha256=76PlEoVPM_-4Oys-6THggV-7gESbPM6Cx0m1n0-1YcM,534
|
|
25
|
-
meteostat/series/fetch.py,sha256=MIrkhhtAucThO06Bcc92c6rrc3v5G31VBI0TkQd0oZ0,620
|
|
26
|
-
meteostat/series/interpolate.py,sha256=EhoOmmAAiv8FcBIZ83hLr1Vu0iJd8BfhYGS4p1b5FOo,925
|
|
27
|
-
meteostat/series/normalize.py,sha256=ZfTsKclXxB6FpWBNmTQLB5Zq5riLgT8BT8pMFI6biI0,2155
|
|
28
|
-
meteostat/series/stations.py,sha256=pHDQR1t7Z7jN5Vaj8wdNnSsZI8s6SiH5bNeTbys3TjA,447
|
|
29
|
-
meteostat/utilities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
30
|
-
meteostat/utilities/aggregations.py,sha256=yoDPX41FmWKLf0YBAxy4N1boR-bb8hCmkI6Wd4TGZQk,915
|
|
31
|
-
meteostat/utilities/endpoint.py,sha256=tH2he-lGEBLRDkoLzktQ37aV3QTcmUM69oeHGUUJo0w,785
|
|
32
|
-
meteostat/utilities/helpers.py,sha256=PFMYQIhXv29Boe_uZpelOZKzK4SzKgWXJbnzacfZreU,787
|
|
33
|
-
meteostat/utilities/mutations.py,sha256=_w0RmGkE6HHQBQFPfCIYazpTXD_1x3uJoy0Y1dYllm4,1485
|
|
34
|
-
meteostat/utilities/validations.py,sha256=MlKY1gkeqmovFr4lR_iM6Bk7yuGdSgy0NGceiqYI7Vs,646
|
|
35
|
-
meteostat-1.6.7.dist-info/LICENSE,sha256=kqpl7FVzWOCe11BZqJBZ1aRQi-aK87j3ljtG7P3VxLc,1066
|
|
36
|
-
meteostat-1.6.7.dist-info/METADATA,sha256=LQ43Nsml6tj7hXWiLKN9WdoipBgagcpIjOjifIqVyPo,4643
|
|
37
|
-
meteostat-1.6.7.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
|
|
38
|
-
meteostat-1.6.7.dist-info/top_level.txt,sha256=s8LP1xi5iF2zhVv5ULkHwW-tPeMrljxnA8VqZibQqro,10
|
|
39
|
-
meteostat-1.6.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|