eolearn.visualization.eopatch_visualization

This module implements visualizations for EOPatch

class eolearn.visualization.eopatch_visualization.EOPatchVisualization(eopatch, feature, rgb=None, rgb_factor=3.5, vdims=None, timestamp_column='TIMESTAMP', geometry_column='geometry', pixel=False, mask=None)[source]

Bases: object

Plot class for making visulizations.

Parameters
  • eopatch (EOPatch) – eopatch

  • feature ((FeatureType, str)) – feature of eopatch

  • rgb ([int, int, int]) – bands for creating RGB image

  • rgb_factor (float) – multiplication factor for constructing rgb image

  • vdims (str) – value dimensions for plotting geopandas.GeoDataFrame

  • timestamp_column (str) – geopandas.GeoDataFrame columns with timestamps

  • geometry_column (geometry) – geopandas.GeoDataFrame columns with geometry

  • pixel (bool) – wheather plot data for each pixel (line), for FeatureType.DATA and FeatureType.MASK

  • mask (str) – name of the FeatureType.MASK to apply to data

plot()[source]

Plots eopatch

Returns

plot

Return type

holovies/bokeh

plot_data(feature_name)[source]

Plots the FeatureType.DATA of eopatch.

Parameters

feature_name (str) – name of the eopatch feature

Returns

visualization

Return type

holoview/geoviews/bokeh

static plot_rgb_one(eopatch_da, timestamp)[source]

Returns visualization for one timestamp for FeatureType.DATA :param eopatch_da: eopatch converted to xarray DataArray :type eopatch_da: xarray DataArray :param timestamp: timestamp to make plot for :type timestamp: datetime :return: visualization :rtype: holoviews/geoviews/bokeh

plot_raster(feature_type, feature_name)[source]

Makes visualization for raster data (except for FeatureType.DATA)

Parameters
  • feature_type (FeatureType) – type of eopatch feature

  • feature_name (str) – name of eopatch feature

Returns

visualization

Return type

holoviews/geoviews/bokeh

plot_vector(feature_name)[source]

Visualizaton for vector (FeatureType.VECTOR) data

Parameters

feature_name (str) – name of eopatch feature

Returns

visualization

Return type

holoviews/geoviews/bokeh

fill_vector(feature_type, feature_name)[source]

Adds timestamps from eopatch to GeoDataFrame.

Parameters
  • feature_type (FeatureType) – type of eopatch feature

  • feature_name (str) – name of eopatch feature

Returns

GeoDataFrame with added data

Return type

geopandas.GeoDataFrame

create_dummy_dataframe(geodataframe, blank_timestamps, dummy_geometry, fill_str='', fill_numeric=1)[source]

Creates geopadnas GeoDataFrame to fill with dummy data (for visualization)

Parameters
  • geodataframe (geopandas.GeoDataFrame) – dataframe to append rows to

  • blank_timestamps (list of timestamps) – timestamps for constructing dataframe

  • dummy_geometry (shapely.geometry.Polygon) – geometry to plot when there is no data

  • fill_str (str) – insert when there is no value in str column

  • fill_numeric (float) – insert when

Returns

dataframe with dummy data

Return type

geopandas.GeoDataFrame

create_dummy_polygon(addition_factor)[source]

Creates geometry/polygon to plot if there is no data (at timestamp)

Parameters

addition_factor (float) – size of the ‘blank polygon’

Returns

polygon

Return type

shapely.geometry.Polygon

plot_scalar_label(feature_type, feature_name)[source]

Line plot for FeatureType.SCALAR, FeatureType.LABEL

Parameters
  • feature_type (FeatureType) – type of eopatch feature

  • feature_name (str) – name of eopatch feature

Returns

visualization

Return type

holoviews/geoviews/bokeh

plot_shapes_one(data_gpd, timestamp, crs)[source]

Plots shapes for one timestamp from geopandas GeoDataFrame

Parameters
  • data_gpd (geopandas.GeoDataFrame) – data to plot

  • timestamp (datetime) – timestamp to plot data for

  • crs (sentinelhub.crs) – in which crs is the data to plot

Returns

visualization

Return type

geoviews

plot_vector_timeless(feature_name)[source]

Plot FeatureType.VECTOR_TIMELESS data

Parameters

feature_name (str) – name of the eopatch featrue

Returns

visalization

Return type

geoviews

eopatch_da_to_rgb(eopatch_da, feature_name, crs)[source]

Creates new xarray DataArray (from old one) to plot rgb image with hv.Holomap

Parameters
  • eopatch_da (DataArray) – eopatch DataArray

  • feature_name (str) – name of the feature to plot

  • crs (sentinelhub.constants.crs) – in which crs are the data

Returns

eopatch DataArray with proper coordinates, dimensions, crs

Return type

xarray.DataArray

plot_pixel(feature_type, feature_name)[source]

Plots one pixel through time :return: visualization :rtype: holoviews

mask_data(data_da)[source]

Creates a copy of array and insert 0 where data is masked. :param data_da: dataarray :type data_da: xarray.DataArray :return: dataaray :rtype: xarray.DataArray