Data Loader#

class eocrops.utils.data_loader.EOPatchDataset(root_dir, features_data, suffix='', resampling=None, range_doy=(1, 365), bands_name='BANDS-S2-L2A', function=<function nanmedian>)[source]#

Bases: object

root_dir (str) : root path where EOPatch are saved features_data (list of tuples) : features to aggregate in the dataset suffix (str) : suffix of the EOPatch file names to read only a subset of EOPatch (e.g. ‘_S2’). This is very useful if you have several data sources in the same root_dir. resampling (dict) : resampling period to make EOPatch at the same time scale and timely comparables (e.g. 8-days period) range_doy (tuple) : suset of the time series w.r.t a range of day of the year (e.g. between the 1st day and the 365th day) function (np.functon) : function to aggegate pixels not masked into a single time series

Methods

get_eopatch_tfds([algorithm, ...])

Parameters:

get_vector_tfds(vector_data, features_list, ...)

Read the vector file into a numpy array.

get_eopatch_tfds(algorithm='linear', doubly_logistic=False, asym_gaussian=False, return_params=False, meta_file=None, path_column=None, planting_date_column=None, harvest_date_column=None, window_planting=0, window_harvest=0)[source]#
Parameters:
algorithm (str)type of algorithm to interpolate missing pixels
doubly_logistic (bool)reconstruct time series using doubly logistic fitting
asym_gaussian (bool)reconstruct time series using asymmetric gaussian
return_params (bool)return parameters estimated from doubly or assymetric functions to get growth metrics
meta_file (pd.DataFrame)DataFrame with meta info regarding planting and dates. Useful for thresholding before preprocessing.
path_column (str)column from meta_file which give the EOPatch path for a given observation.
planting_date_column (str)column from meta_file where planting date column (DOY) is referred
harvest_date_column (str)column from meta_file where harvest date column (DOY) is referred
window_planting (int)window before planting date to fit asymmetric ou doubly before N days
window_harvest (int)window after planting date to fit asymmetric ou doubly after N days
Returns Returns (np.arrray)3D np.array (N, t, d) ~ EOPatch aggregated and resampled into the same np.array
——-
get_vector_tfds(vector_data, features_list, column_path)[source]#

Read the vector file into a numpy array. Each observation will match the eopatch_tfds and will be converted into a np.array :param vector_data (pd.DataFrame): :type vector_data (pd.DataFrame): dataframe with meta info regarding each EOPatch saved :param features_list (list): :type features_list (list): list of features to read :param column_path (str): :type column_path (str): column name with the corresponding path of each EOPatch :param Returns (np.array): :type Returns (np.array): np.array from the inputs file :param ——-: