eolearn.io.meteoblue

Module with tasks that provide data from Meteoblue services

To use tasks from this module you have to use Python >= 3.7 and install METEOBLUE package extension:

pip install eo-learn-io[METEOBLUE]
class eolearn.io.meteoblue.BaseMeteoblueTask(*args, **kwargs)[source]

Bases: eolearn.core.eotask.EOTask

A base task implementing the logic that is common for all Meteoblue tasks

Parameters
  • feature ((FeatureType, str)) – A feature in which Meteoblue data will be stored

  • apikey (str) – Meteoblue API key

  • query (dict) – Meteoblue dataset API query definition

  • units (dict) – Meteoblue dataset API units definition

  • time_difference (datetime.timedelta) – The size of a time interval around each timestamp for which data will be collected. It is used only in a combination with time_interval parameter from execute method.

  • cache_folder (str) – Path to cache_folder. If set to None (default) requests will not be cached.

  • cache_max_age (int) – Maximum age in seconds to use a cached result. Default 1 week.

execute(eopatch=None, *, bbox=None, time_interval=None)[source]

Execute method that adds new Meteoblue data into an EOPatch

Parameters
  • eopatch (EOPatch or None) – An EOPatch in which data will be added. If not provided a new EOPatch will be created.

  • bbox (BBox or None) – A bounding box of a request. Should be provided if eopatch parameter is not provided.

  • time_interval ((dt.datetime, dt.datetime) or (str, str) or None) – An interval for which data should be downloaded. If not provided then timestamps from provided eopatch will be used.

class eolearn.io.meteoblue.MeteoblueVectorTask(*args, **kwargs)[source]

Bases: eolearn.io.meteoblue.BaseMeteoblueTask

Obtains weather data from Meteoblue services as a vector feature

The data is obtained as a VECTOR feature in a geopandas.GeoDataFrame where columns include latitude, longitude, timestamp and a columns for each weather variable. All data is downloaded from the Meteoblue dataset API.

A Meteoblue API key is required to retrieve data.

Parameters
  • feature ((FeatureType, str)) – A feature in which Meteoblue data will be stored

  • apikey (str) – Meteoblue API key

  • query (dict) – Meteoblue dataset API query definition

  • units (dict) – Meteoblue dataset API units definition

  • time_difference (datetime.timedelta) – The size of a time interval around each timestamp for which data will be collected. It is used only in a combination with time_interval parameter from execute method.

  • cache_folder (str) – Path to cache_folder. If set to None (default) requests will not be cached.

  • cache_max_age (int) – Maximum age in seconds to use a cached result. Default 1 week.

class eolearn.io.meteoblue.MeteoblueRasterTask(*args, **kwargs)[source]

Bases: eolearn.io.meteoblue.BaseMeteoblueTask

Obtains weather data from Meteoblue services as a raster feature

It returns a 4D numpy array with dimensions (time, height, width, weather variables) which should be stored as a DATA feature. Data is resampled to WGS84 plate carrée to a specified resolution using the Meteoblue dataset API.

A Meteoblue API key is required to retrieve data.

Parameters
  • feature ((FeatureType, str)) – A feature in which Meteoblue data will be stored

  • apikey (str) – Meteoblue API key

  • query (dict) – Meteoblue dataset API query definition

  • units (dict) – Meteoblue dataset API units definition

  • time_difference (datetime.timedelta) – The size of a time interval around each timestamp for which data will be collected. It is used only in a combination with time_interval parameter from execute method.

  • cache_folder (str) – Path to cache_folder. If set to None (default) requests will not be cached.

  • cache_max_age (int) – Maximum age in seconds to use a cached result. Default 1 week.

eolearn.io.meteoblue.meteoblue_to_dataframe(result) pandas.core.frame.DataFrame[source]

Transform a Meteoblue dataset API result to a dataframe

Parameters

result (Dataset_pb2.DatasetApiProtobuf) – A response of Meteoblue API

Returns

A dataframe with columns TIMESTAMP, Longitude, Latitude and aggregation columns

eolearn.io.meteoblue.meteoblue_to_numpy(result) numpy.ndarray[source]

Transform a Meteoblue dataset API result to a dataframe

Parameters

result (Dataset_pb2.DatasetApiProtobuf) – A response of Meteoblue API

Returns

A 4D numpy array with shape (time, height, width, weather variables)