openmeteopy package
Subpackages
Submodules
openmeteopy.client module
A module for downloading meteorological data from the Open-Meteo APIs (https://open-meteo.com/en/). Name: Wail Chalabi e-mail: wailchalabi1996@gmail.com Version: 1.0.0
- 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.
- 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.
openmeteopy.exceptions module
- exception openmeteopy.exceptions.ApiCallError(response)[source]
Bases:
ExceptionResponse Api exception
raises an error if the api responds with one
- exception openmeteopy.exceptions.FileOptionError[source]
Bases:
ExceptionFileOption exception
raises an error if the file number option is wrong
- exception openmeteopy.exceptions.FilepathNotFilled[source]
Bases:
ExceptionFilepath exception
raises an error if the filepath is not filled but the file option is