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: object

OpenMeteo 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.

save_json(filepath: str)[source]

This function directly save the content of response from open-meteo APIs into a JSON file

Args:
filepath (str):

filepath where the .json file will be saved.

openmeteopy.exceptions module

exception openmeteopy.exceptions.ApiCallError(response)[source]

Bases: Exception

Response Api exception

raises an error if the api responds with one

exception openmeteopy.exceptions.FileOptionError[source]

Bases: Exception

FileOption exception

raises an error if the file number option is wrong

exception openmeteopy.exceptions.FilepathNotFilled[source]

Bases: Exception

Filepath exception

raises an error if the filepath is not filled but the file option is

exception openmeteopy.exceptions.MethodnotAllowed[source]

Bases: Exception

Filepath exception

raises an error if the method is not allowed (parameter doesn’t exist in the original api)

class openmeteopy.exceptions.TypedList(iterable=(), /)[source]

Bases: list

Typelist class

helps to check if a parameter is already in the payload list then appends the new parameter

append(item)[source]

Append object to the end of the list.

append_all(item)[source]