eobox.raster.cube¶
-
class
eobox.raster.cube.EOCubeAbstract(df_layers, chunksize=32, wdir=None)[source]¶ Bases:
object-
property
chunksize¶
-
property
df_layers¶
-
get_df_ilocs(band, date)[source]¶ Get positions of rows matching specific band(s) and date(s).
The method supports three typical queries:
one band and one date (both given as strings)
one band and of several dates (band given as strings, date as list of strings)
several band and of one date (date given as strings, band as list of strings)
-
property
n_chunks¶
-
property
wdir¶
-
property
-
class
eobox.raster.cube.EOCubeChunk(ji, df_layers, chunksize=32, wdir=None)[source]¶ Bases:
eobox.raster.cube.EOCubeAbstract-
property
chunksize¶
-
convert_data_to_ndarray()[source]¶ Converts the data from dataframe to ndarray format. Assumption: df-columns are ndarray-layers (3rd dim.)
-
property
data¶
-
property
ji¶
-
plot_raster(idx_layer, robust=False, vmin=None, vmax=None, spatial_bounds=False, figsize=None, ax=None)[source]¶
-
plot_raster_rgb(idx_layers, robust=False, vmin=None, vmax=None, spatial_bounds=False, figsize=None, ax=None)[source]¶
-
static
robust_data_range(arr, robust=False, vmin=None, vmax=None)[source]¶ Get a robust data range, i.e. 2nd and 98th percentile for vmin, vmax parameters.
-
property
spatial_bounds¶
-
property
-
class
eobox.raster.cube.EOCubeSceneCollection(df_layers, chunksize, variables, qa, qa_valid, wdir=None)[source]¶ Bases:
eobox.raster.cube.EOCubeSceneCollectionAbstract,eobox.raster.cube.EOCubeHandling scene collections, i.e. a set of scenes each with the same layers.
The class enables to perform chunkwise processing over a set of scenes having the same variables / bands. Therefore the
df_layersdataframe requires information to be stored in the following columns:sceneid (unique identifier of the scene),
date (the aquisition date of the scene as datetime type),
band (the layers / bands that exist for all scenes),
uname (unique identifier for all layers, i.e. scene + variable/qu-layer),
path (the path where the raster for that layer is located).
- Parameters
df_layers (dataframe) – A dataframe, see description above.
chunksize (int) – Size of the spatial window used as processing unit.
variables (list of str) – Those values in
df_layers['band']that are treated as variables.qa (str) – The value in
df_layers['band']which is treated as quality assessment layer.qa_valid (list of int) – The values in the qualitiy assessment layer that identify pixels to be considered as valid in the variable rasters., by default None
wdir (str, optional) – Working directory
- Raises
ValueError – [description]
-
create_statistical_metrics(percentiles, iqr, diffs, dst_pattern, dtypes, compress='lzw', nodata=None, num_workers=1)[source]¶
-
class
eobox.raster.cube.EOCubeSceneCollectionAbstract(df_layers, chunksize, variables, qa, qa_valid, wdir=None)[source]¶ Bases:
eobox.raster.cube.EOCubeAbstractHandling scene collections, i.e. a set of scenes each with the same layers.
The class enables to perform chunkwise processing over a set of scenes having the same variables / bands. Therefore the
df_layersdataframe requires information to be stored in the following columns:sceneid (unique identifier of the scene),
date (the aquisition date of the scene as datetime type),
band (the layers / bands that exist for all scenes),
uname (unique identifier for all layers, i.e. scene + variable/qu-layer),
path (the path where the raster for that layer is located).
- Parameters
df_layers (dataframe) – A dataframe, see description above.
chunksize (int) – Size of the spatial window used as processing unit.
variables (list of str) – Those values in
df_layers['band']that are treated as variables.qa (str) – The value in
df_layers['band']which is treated as quality assessment layer.qa_valid (list of int) – The values in the qualitiy assessment layer that identify pixels to be considered as valid in the variable rasters., by default None
wdir (str, optional) – Working directory
- Raises
ValueError – [description]
-
property
qa¶
-
property
qa_valid¶
-
property
variables¶
-
class
eobox.raster.cube.EOCubeSceneCollectionChunk(ji, df_layers, chunksize, variables, qa, qa_valid, wdir=None)[source]¶ Bases:
eobox.raster.cube.EOCubeSceneCollectionAbstract,eobox.raster.cube.EOCubeChunkHandling scene collections, i.e. a set of scenes each with the same layers.
The class enables to perform chunkwise processing over a set of scenes having the same variables / bands. Therefore the
df_layersdataframe requires information to be stored in the following columns:sceneid (unique identifier of the scene),
date (the aquisition date of the scene as datetime type),
band (the layers / bands that exist for all scenes),
uname (unique identifier for all layers, i.e. scene + variable/qu-layer),
path (the path where the raster for that layer is located).
- Parameters
df_layers (dataframe) – A dataframe, see description above.
chunksize (int) – Size of the spatial window used as processing unit.
variables (list of str) – Those values in
df_layers['band']that are treated as variables.qa (str) – The value in
df_layers['band']which is treated as quality assessment layer.qa_valid (list of int) – The values in the qualitiy assessment layer that identify pixels to be considered as valid in the variable rasters., by default None
wdir (str, optional) – Working directory
- Raises
ValueError – [description]
-
eobox.raster.cube.create_names_statistical_metrics(dst_pattern, percentiles=None, iqr=True, diffs=True, variables=None)[source]¶
-
eobox.raster.cube.create_names_virtual_time_series(dst_pattern, idx_virtual, variables=None)[source]¶
-
eobox.raster.cube.create_statistical_metrics(df_var, percentiles=None, iqr=True, diffs=True, colname_pattern=None, num_workers=1, rename2p=False, verbosity=0)[source]¶ Calculate statistial metrics from a dataframe with pd.DateTimeIndex and a instance (e.g. pixels) dimension.
- Parameters
- Returns
[description]
- Return type
[type]
-
eobox.raster.cube.create_virtual_time_series(df_var, idx_virtual, colname_pattern=None, num_workers=1, verbosity=0)[source]¶ Create a virtual time series from a dataframe with pd.DateTimeIndex and a instance (e.g. pixels) dimension.
- Parameters
df_var ([type]) – [description]
idx_virtual ([type]) – [description]
colname_pattern (str) – Pattern for the column name, e.g. ‘ls2010_vts2w_{date}_ndvi’, where the data will be inserted from idx_virtual.
num_workers (int, optional) – [description], by default 1
verbosity (int, optional) – [description], by default 0
- Returns
[description]
- Return type
[type]
-
eobox.raster.cube.scoll_df_to_var_dfs(scoll_df, df_layers, qa=None, qa_valid=None, verbose=True)[source]¶ Convert a dataframe with variable and qa columns into a dictionary with masked variable dataframes.
- Parameters
scoll_df ([pd.DataFrame]) – dataframe as returned by EOCubeSceneCollectionChunk(…).read_data().convert_data_to_dataframe()
df_layers ([pd.DataFrame]) – See EOCubeSceneCollectionAbstract.
qa ([str]) – See EOCubeSceneCollectionAbstract.
qa_valid ([list]) – See EOCubeSceneCollectionAbstract.
verbose ([bool]) –
…