Welcome to openmeteopy’s documentation!
openmeteopy is a python library to easily access open meteo APIs and obtain python objects.
Setup and Configuration
Here I will add all the setup and config sources
Documentation
Open-Meteo Client
- class openmeteopy.client.OpenMeteo(options: Option, hourly=None, daily=None, fifteen_minutes=None, api_key=None)[source]
Bases:
objectOpenMeteo class is the client to manage http to Open-Meteo public APIs requests.
- __init__(options: Option, hourly=None, daily=None, fifteen_minutes=None, api_key=None)[source]
- Args:
- options:
This paramete is a Option object that specify the provider, geocoordinates and time period to fetch data.
- hourly:
This parameter is a Hourly object that specify the meteorological variables required with hourly frequency.
- daily:
This parameter is a Daily object that specify the meteorological variables required with daily frequency.
- fifteen_minutes:
This parameter is a FifteenMinutes object that specify the meteorological variables required with fifteen minutes frequency.
- api_key:
This parameter specify a private API key for commercial use.
- get_dict() dict[source]
Get the response from Open-Meteo API as a python dictionary.
- Returns:
- dict:
A “cleaned” version of the server response returned as a python dictionary. It only includes hourly, daily or minutely_15 attributes.
- get_json_str() str[source]
Get the response from Open-Meteo API as a string in JSON format.
- Returns:
- str:
a string containing the cleaned response from the Open-Meteo APIs in JSON format.
- get_numpy() ndarray[source]
Get the response from Open-Meteo API as a numpy array.
- Returns:
- np.ndarray:
a numpy array with shape (N, M), where N is the number of hourly/daily/fifteen_minutes samples and M is the number of meteorological variables required
- get_pandas() DataFrame[source]
Get the response from Open-Meteo API as a pandas DataFrame format.
- Returns:
- DataFrame:
pandas dataframe with time as index and each of the columns is one of the attribute required.
- save_csv(filepath: str)[source]
This function directly save the content of response from open-meteo APIs into a csv file
- Args:
- filepath (str):
filepath where the .csv file will be saved.
- Returns:
- DataFrame:
pandas dataframe with time as index and each of the columns is one of the attribute requested.
- save_excel(filepath: str)[source]
This function directly save the content of response from open-meteo APIs into a excel file
- Args:
- filepath (str):
filepath where the .excel file will be saved.
- Returns:
- DataFrame:
pandas dataframe with time as index and each of the columns is one of the attribute requested.