# Monthly Data
Aggregated monthly data is very useful when analyzing weather and climate over a longer period of time. It may include model data to fill gaps in the observations.
# Example
You can use the Monthly
class to retrieve historical data and prepare the records for further processing. For more complex analysis and visulization tasks you can utilize Pandas.
# Import Meteostat library and dependencies
from datetime import datetime
import matplotlib.pyplot as plt
from meteostat import Stations, Monthly
# Set time period
start = datetime(2000, 1, 1)
end = datetime(2018, 12, 31)
# Get Monthly data
data = Monthly('10637', start, end)
data = data.fetch()
# Plot line chart including average, minimum and maximum temperature
data.plot(y=['tavg', 'tmin', 'tmax'])
plt.show()
# API
Parent Class: meteostat.TimeSeries
- meteostat.Monthly
- meteostat.TimeSeries.normalize
- meteostat.TimeSeries.aggregate
- meteostat.TimeSeries.interpolate
- meteostat.TimeSeries.convert
- meteostat.TimeSeries.coverage
- meteostat.TimeSeries.fetch
- meteostat.TimeSeries.count
- meteostat.TimeSeries.stations
- meteostat.TimeSeries.clear_cache
# Data Structure
Each month is represented by a Pandas DataFrame
row which provides the weather data recorded during that month. These are the different columns:
Column | Description | Type |
---|---|---|
station | The Meteostat ID of the weather station (only if query refers to multiple stations) | String |
time | The month, represented as a date | Datetime64 |
tavg | The average air temperature in °C | Float64 |
tmin | The minimum air temperature in °C | Float64 |
tmax | The maximum air temperature in °C | Float64 |
prcp | The monthly precipitation total in mm | Float64 |
wspd | The average wind speed in km/h | Float64 |
pres | The average sea-level air pressure in hPa | Float64 |
tsun | The monthly sunshine total in minutes (m) | Float64 |