Skip to content

Commit 9b654ef

Browse files
authored
Meteostat 1.4.1 (#52)
* Meteostat 1.4.1 * Update FUNDING.yml
1 parent 05717fe commit 9b654ef

File tree

10 files changed

+11
-64
lines changed

10 files changed

+11
-64
lines changed

.github/FUNDING.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
custom: ["https://paypal.me/meteostat"]
1+
github: clampr
2+
patreon: meteostat
3+
custom: ["https://www.paypal.com/donate?hosted_button_id=MQ67WRDC8EW38"]

examples/daily/compare_aggregate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
# Get weather stations by Meteostat ID
1616
stations = Stations()
17-
stations = stations.id('meteostat', ('D1424', '10729', '10803', '10513'))
1817
stations = stations.fetch()
18+
stations = stations[stations.index.isin(('D1424', '10729', '10803', '10513'))]
1919

2020
# Get names of weather stations
2121
names = stations['name'].to_list()

examples/stations/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ This directory contains examples which illustrate the usage of Meteostat's `Stat
44

55
## Examples
66

7-
* [Station By ID](id.py): Get meta information for a weather station using its identifier
87
* [Nearby Stations](nearby.py): Get nearby weather stations based on a geo location
98
* [Stations By Country & Region](region.py): Get weather stations located in a certain country (& state)
109
* [Stations By Geographic Boundaries](bounds.py): Get weather stations within rectangular boundaries

examples/stations/id.py

Lines changed: 0 additions & 18 deletions
This file was deleted.

examples/stations/nearby.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# Get weather station
1414
stations = Stations()
1515
stations = stations.nearby(50, 8)
16-
stations = stations.inventory('hourly', True)
16+
stations = stations.inventory('hourly')
1717
station = stations.fetch(1).to_dict('records')[0]
1818

1919
# Print name

meteostat/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"""
1313

1414
__appname__ = 'meteostat'
15-
__version__ = '1.4.0'
15+
__version__ = '1.4.1'
1616

1717
from .interface.stations import Stations
1818
from .interface.point import Point

meteostat/interface/normals.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ def __init__(
240240
self._resolve_point(loc.method, stations, loc.alt, loc.adapt_temp)
241241

242242
# Aggregate if period is auto
243-
if self._period == 'auto':
243+
if self._period == 'auto' and self._data.index.size > 0:
244244
self._data = self._data.groupby(
245245
level=['station', 'month']).agg('last')
246246

meteostat/interface/stations.py

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -114,30 +114,6 @@ def __init__(self) -> None:
114114
if self.max_age > 0:
115115
self.clear_cache()
116116

117-
def id(
118-
self,
119-
organization: str,
120-
code: str
121-
) -> 'Stations':
122-
"""
123-
Get weather station by identifier
124-
"""
125-
126-
# Create temporal instance
127-
temp = copy(self)
128-
129-
if isinstance(code, str):
130-
code = [code]
131-
132-
if organization == 'meteostat':
133-
temp._data = temp._data[temp._data.index.isin(code)]
134-
else:
135-
temp._data = temp._data[temp._data[organization].isin(
136-
code)]
137-
138-
# Return self
139-
return temp
140-
141117
def nearby(
142118
self,
143119
lat: float,
@@ -225,7 +201,7 @@ def bounds(
225201
def inventory(
226202
self,
227203
freq: str,
228-
required: Union[bool, datetime, tuple] = True
204+
required: Union[datetime, tuple, bool] = True
229205
) -> 'Stations':
230206
"""
231207
Filter weather stations by inventory data
@@ -239,6 +215,7 @@ def inventory(
239215
temp._data = temp._data[
240216
(pd.isna(temp._data[freq + '_start']) == False)
241217
]
218+
242219
elif isinstance(required, tuple):
243220
# Make sure data exists across period
244221
temp._data = temp._data[
@@ -250,6 +227,7 @@ def inventory(
250227
>= required[1]
251228
)
252229
]
230+
253231
else:
254232
# Make sure data exists on a certain day
255233
temp._data = temp._data[

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# Setup
1616
setup(
1717
name='meteostat',
18-
version='1.4.0',
18+
version='1.4.1',
1919
author='Meteostat',
2020
author_email='[email protected]',
2121
description='Access and analyze historical weather and climate data with Python.',

tests/test_stations.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,6 @@ def test_nearby(self):
3030
f'Closest weather stations returns country code {station["country"]}, should be DE'
3131
)
3232

33-
def test_id(self):
34-
"""
35-
Test: Stations by identifier
36-
"""
37-
38-
# Select weather station 'Toronto Pearson Airport'
39-
station = Stations().id('wmo', '71624').fetch(1).to_dict('records')[0]
40-
41-
# Check if ICAO ID matches CYYZ
42-
self.assertEqual(
43-
station['icao'],
44-
'CYYZ',
45-
f'Weather station returns ICAO ID {station["icao"]}, should be CYYZ')
46-
4733
def test_region(self):
4834
"""
4935
Test: Stations by country/region code

0 commit comments

Comments
 (0)