class eocrops.climatools.format_data.WeatherPostprocess(shapefile, id_column, timestamp_column, start_season=None)[source]#

Bases: object

Resample time series (e.g. satellite image time series and daily weather data) over accumulated GDU periods (thermal time).

Parameters:
shapefilegpd.GeoDataFrame

DataFrame generated by meteoblue API in eocrops.inputs.meteoblue

id_columnstr

Column from the weather data file which refers to the identifier of the observation.

resample_rangetuple

Range of dates and daily temporal resolution of the dataset extracted. By default, extractions are made daily from the 1st January to the 31st of December

id_columnstr

Column from the weather data file which refers to the identifier of the observation.

start_seasonstr, optional

Name of the column with the corresponding day of the year in which we discard data before. It is mostly useful for fields in which we have an idea of the beginning of the season

Methods

execute(df_weather[, stat, return_pivot])

Execute the workflow to get the dataframe aggregated into periods from Meteoblue data

format_static_variable(df_weather[, ...])

Format static features from a given output of Meteoblue

format_static_variable(df_weather, return_pivot=False)[source]#

Format static features from a given output of Meteoblue

Parameters:
df_weather (pd.DataFrame)Meteoblue dataframe with stat as daily descriptive statistics
return_pivot (bool): The dataframe is formated into a pivot table. Weather data are in columns and each row = 1 unique location
Returns:
pd.DataFrame with weather data ready for machine learning pipeline
execute(df_weather, stat=None, return_pivot=False)[source]#

Execute the workflow to get the dataframe aggregated into periods from Meteoblue data

Parameters:
df_weatherpd.DataFrame

Meteoblue dataframe with stat as daily descriptive statistics

statstr

Statistics to compute if we have periods instead of daily data (e.g. ‘mean’ if you downloaded mean temperature data)

return_pivotbool

The dataframe is formated into a pivot table. Weather data are in columns and each row = 1 unique location

Returns:
pd.DataFrame with mean, min, max, sum aggregated into periods defined w.r.t the resample_range