I'm trying to get all the date range available for an specific weather station. But i'm getting an error when I don't parse the 'start' and 'end' date parameters. Can anyone help me?
# Import Meteostat library and dependencies
from datetime import datetime
import matplotlib.pyplot as plt
from meteostat import Point, Daily, Stations
# Set coordinates of MS
lat = -20.316524
lon = -53.680500
# Set time period
start = datetime(2021, 1, 1)
end = datetime(2022, 6, 1)
# Closest station
stations = Stations()
stations = stations.nearby(lat, lon)
stations = stations.inventory('daily', True)
station = stations.fetch(1)
station
# Get daily data for 2018 at the selected weather station
#data = Daily(station) <------- THIS LINE GIVES ME AN ERROR
data = Daily(station , start, end)
data = data.fetch()
I've got the answer. The code is below.
# Set coordinates to the desired location
lat = -20.316524
lon = -53.680500
# Set time period
start = datetime(1900, 1, 1)
end = datetime(2099, 6, 1)
# 10 nearst stations
stations = Stations()
stations = stations.nearby(lat, lon)
station = stations.fetch(10)
station