-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
717 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
--- | ||
title: meteostat.Monthly | API | Python Library | ||
--- | ||
|
||
# meteostat.Monthly | ||
|
||
Query monthly weather data for one or multiple weather stations or a single geographical point. | ||
|
||
## Parameters | ||
|
||
The `loc` parameter is required. You can pass a [meteostat.Point](/python/api/point), a `DataFrame` returned by the [meteostat.Stations.fetch](/python/api/stations/fetch) method or provide one (String) or multiple Meteostat weather station identifiers (Tuple or List). | ||
|
||
| **Parameter** | **Description** | **Type** | **Default** | | ||
|:--------------|:---------------------------------|:-------------------------------------------------------------|:------------| | ||
| loc | Weather station(s) or Point | DataFrame, [Point](/python/api/point), String, Tuple or List | undefined | | ||
| start | Start date of the desired period | Datetime | None | | ||
| end | End date of the desired period | Datetime | None | | ||
| model | Include model data | Boolean | True | | ||
|
||
## Attributes | ||
|
||
Attributes allow the configuration of general settings and behaviour. | ||
|
||
| **Parameter** | **Description** | **Type** | **Default** | | ||
|:--------------|:---------------------------------------------------|:---------|:-------------------| | ||
| cache_dir | The path of the cache directory | String | ~/.meteostat/cache | | ||
| cache_subdir | The subdirectory of the cache | String | monthly | | ||
| max_age | Maximum age of a cached file in seconds | Integer | 86400 | | ||
| max_threads | Maximum number of threads used for data processing | Integer | 1 | | ||
|
||
You can disable caching completely by setting `max_age` to `0`. | ||
|
||
When changing attributes, make sure to do so before creating a class instance: | ||
|
||
```python{3} | ||
from meteostat import Monthly | ||
Monthly.cache_dir = '/my/path/goes/here' | ||
data = Monthly('10637') | ||
``` | ||
|
||
## Methods | ||
|
||
* [meteostat.Monthly.normalize](normalize) | ||
* [meteostat.Monthly.aggregate](aggregate) | ||
* [meteostat.Monthly.interpolate](interpolate) | ||
* [meteostat.Monthly.convert](convert) | ||
* [meteostat.Monthly.coverage](coverage) | ||
* [meteostat.Monthly.fetch](fetch) | ||
* [meteostat.Monthly.count](count) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
--- | ||
title: meteostat.Monthly.aggregate | API | Python Library | ||
--- | ||
|
||
# meteostat.Monthly.aggregate | ||
|
||
Aggregation is an important tool in data analysis. Meteostat allows both time-wise and spatial aggregation. | ||
|
||
## Parameters | ||
|
||
The `freq` parameter specifies the time series frequency. For full specification of available frequencies, please see [here](https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#offset-aliases). If you want to aggregate across all weather stations, just set the `spatial` parameter to `true`. | ||
|
||
| **Parameter** | **Description** | **Type** | **Default** | | ||
|:--------------|:-------------------------------------------|:---------|:------------| | ||
| freq | Group by the specified frequency | String | '1M' | | ||
| spatial | Calculate averages across weather stations | Boolean | False | | ||
|
||
## Returns | ||
|
||
`Monthly` class instance | ||
|
||
### Aggregate Functions | ||
|
||
Meteostat uses the following aggregate functions: | ||
|
||
* `tavg` => `mean` | ||
* `tmin` => `min` | ||
* `tmax` => `max` | ||
* `prcp` => `sum` | ||
* `snow` => `mean` | ||
* `wdir` => `mean` | ||
* `wspd` => `mean` | ||
* `wpgt` => `max` | ||
* `pres` => `mean` | ||
* `tsun` => `sum` | ||
|
||
## Example | ||
|
||
Get annual data for Frankfurt Airport from 2000 to 2018. | ||
|
||
```python{9} | ||
from datetime import datetime | ||
from meteostat import Monthly | ||
start = datetime(2000, 1, 1) | ||
end = datetime(2018, 12, 31) | ||
data = Monthly('10637', start, end) | ||
data = data.normalize() | ||
data = data.aggregate('1Y') | ||
data = data.fetch() | ||
print(data) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
title: meteostat.Monthly.clear_cache | API | Python Library | ||
--- | ||
|
||
# meteostat.Monthly.clear_cache | ||
|
||
This method cleans up the local `Monthly` cache by removing files which are older than `meteostat.Monthly.max_age`. The method is automatically called when initializing a new instance of the class. | ||
|
||
**Important:** This method does only affect files cached in the context of the `Monthly` class. | ||
|
||
## Parameters | ||
|
||
If you want to overwrite the default maximum age, just pass any number of seconds using the `max_age` parameter. | ||
|
||
| **Parameter** | **Description** | **Type** | **Default** | | ||
|:--------------|:---------------------------------|:---------|:--------------------------| | ||
| max_age | Maximum age of a file in seconds | Integer | meteostat.Monthly.max_age | | ||
|
||
## Returns | ||
|
||
`None` | ||
|
||
## Example | ||
|
||
Remove stale files from the local `Monthly` cache. | ||
|
||
```python{3} | ||
from meteostat import Monthly | ||
Monthly.clear_cache() | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
title: meteostat.Monthly.convert | API | Python Library | ||
--- | ||
|
||
# meteostat.Monthly.convert | ||
|
||
Convert specific attributes to a different unit. | ||
|
||
## Parameters | ||
|
||
The `units` parameter takes a dictionary which specifies column-unit pairs. | ||
|
||
| **Parameter** | **Description** | **Type** | **Default** | | ||
|:--------------|:---------------------------------------------------|:-----------|:------------| | ||
| units | Dictionary which maps attributes to a certain unit | Dictionary | undefined | | ||
|
||
## Returns | ||
|
||
`Monthly` class instance | ||
|
||
## Example | ||
|
||
Get monthly weather data for Atlanta International Airport and convert to imperial units. | ||
|
||
```python{4} | ||
from meteostat import Monthly, units | ||
data = Monthly('72219') | ||
data = data.convert(units.imperial) | ||
data = data.fetch() | ||
print(data) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
title: meteostat.Monthly.count | API | Python Library | ||
--- | ||
|
||
# meteostat.Monthly.count | ||
|
||
The `count()` method returns the total number of records in the query result as an integer. | ||
|
||
## Parameters | ||
|
||
This method does not take any parameters. | ||
|
||
## Returns | ||
|
||
Integer | ||
|
||
## Example | ||
|
||
Get the total number of records ever recorded at Atlanta International Airport. | ||
|
||
```python{4} | ||
from meteostat import Monthly | ||
data = Monthly('72219') | ||
count = data.count() | ||
print(count) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
title: meteostat.Monthly.coverage | API | Python Library | ||
--- | ||
|
||
# meteostat.Monthly.coverage | ||
|
||
The `coverage` method provides information about the completeness of data. It can be used to determine the coverage of records or individual parameters. | ||
|
||
## Parameters | ||
|
||
You can specify an optional `parameter` to look for. This can be any [response parameter](/python/monthly.html#data-structure) of the `Monthly` class (e.g. `tmax` for the maximum temperature). | ||
|
||
| **Parameter** | **Description** | **Type** | **Default** | | ||
|:--------------|:-----------------------------------------------------|:---------|:------------| | ||
| parameter | Check coverage of a certain meteorological parameter | String | None | | ||
|
||
## Returns | ||
|
||
Integer between 0 (no records) and 1 (all records) | ||
|
||
## Example | ||
|
||
Check completeness of records for Sydney Airport in 2019. | ||
|
||
```python{8} | ||
from datetime import datetime | ||
from meteostat import Monthly | ||
start = datetime(2019, 1, 1) | ||
end = datetime(2019, 12, 31) | ||
data = Monthly('94767', start, end) | ||
coverage = data.coverage() | ||
print(coverage) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
title: meteostat.Monthly.fetch | API | Python Library | ||
--- | ||
|
||
# meteostat.Monthly.fetch | ||
|
||
You can access the resulting `DataFrame` of your query using the `fetch()` method. | ||
|
||
## Parameters | ||
|
||
This method does not take any parameters. | ||
|
||
## Returns | ||
|
||
Pandas `DataFrame` | ||
|
||
## Example | ||
|
||
Get all data ever recorded at Atlanta International Airport. | ||
|
||
```python{4} | ||
from meteostat import Monthly | ||
data = Monthly('72219') | ||
data = data.fetch() | ||
print(data) | ||
``` |
Oops, something went wrong.