satellitetools.gee ================== .. py:module:: satellitetools.gee .. autoapi-nested-parse:: Module to retrieve Sentinel-2 data from Google Earth Engine (GEE). @author: Olli Nevalainen, Finnish Meteorological Institute) Attributes ---------- .. autoapisummary:: satellitetools.gee.logger satellitetools.gee.GEE_NO_DATA satellitetools.gee.GEE_DATASET satellitetools.gee.GEE_SCL_BAND Classes ------- .. autoapisummary:: satellitetools.gee.GEESentinel2DataCollection satellitetools.gee.MultiGEESentinel2DataCollection Functions --------- .. autoapisummary:: satellitetools.gee.gee_lists_to_2D_array satellitetools.gee.get_copernicus_dem_elevation satellitetools.gee.ee_get_s2_quality_info satellitetools.gee.ee_get_s2_data Module Contents --------------- .. py:data:: logger .. py:data:: GEE_NO_DATA :value: -99999 .. py:data:: GEE_DATASET :value: 'COPERNICUS/S2_SR_HARMONIZED' .. py:data:: GEE_SCL_BAND .. py:class:: GEESentinel2DataCollection(aoi: satellitetools.common.classes.AOI, req_params: satellitetools.common.sentinel2.Sentinel2RequestParams) Bases: :py:obj:`satellitetools.common.sentinel2.Sentinel2DataCollection` Class to retrieve Sentinel-2 data from Google Earth Engine (GEE). .. attribute:: aoi Area of interest. :type: AOI .. attribute:: req_params Request parameters. :type: Sentinel2RequestParams Initialize GEESentinel2DataCollection object. :param aoi: Area of interest. :type aoi: AOI :param req_params: Request parameters. :type req_params: Sentinel2RequestParams .. py:method:: create_s2_items(feature: Dict) Create Sentinel-2 items from GEE feature. :param feature: Feature dictionary from GEE. :type feature: dict .. py:method:: create_s2_items_from_quality_information() Create Sentinel-2 items from quality information. .. py:method:: set_s2_item_data(feature: Dict) Set Sentinel-2 item data from GEE feature. :param feature: Feature dictionary from GEE. :type feature: dict .. py:method:: get_s2_item_with_productid(productid: str) -> Union[satellitetools.common.sentinel2.Sentinel2Item, None] Get Sentinel-2 item with productid. :param productid: Sentinel-2 product ID. :type productid: str :returns: **s2_item** -- Sentinel-2 item. :rtype: Union[Sentinel2Item, None] .. py:method:: drop_s2_item_with_productid(productid: str) Drop Sentinel-2 item with productid. :param productid: Sentinel-2 product ID. :type productid: str .. py:method:: get_ee_geometry(shapely_geometry: shapely.Geometry) -> ee.Geometry Get Earth Engine geometry from Shapely geometry. :param shapely_geometry: Shapely geometry. :type shapely_geometry: shapely.Geometry :returns: **ee_geometry** -- Earth Engine geometry. :rtype: ee.Geometry .. py:method:: ee_feature_from_s2_items() -> ee.Feature Create GEE feature from Sentinel-2 items. :returns: **feature** -- GEE feature. :rtype: ee.Feature .. py:method:: ee_feature_from_aoi() -> ee.Feature Create GEE feature from AOI. :returns: **feature** -- GEE feature. :rtype: ee.Feature .. py:method:: get_quality_info() Get quality information from GEE. .. py:method:: get_s2_data() Get S2 data (level L2A, bottom of atmosphere data) from GEE. .. py:method:: search_s2_items() .. py:class:: MultiGEESentinel2DataCollection(aois: List[satellitetools.common.classes.AOI], req_params: satellitetools.common.sentinel2.Sentinel2RequestParams) Class to retrieve Sentinel-2 data from Google Earth Engine (GEE) for multiple AOIs. .. attribute:: aois List of AOIs. :type: List[AOI] .. attribute:: req_params Request parameters. :type: Sentinel2RequestParams Initialize MultiGEESentinel2DataCollection object. :param aois: List of AOIs. :type aois: List[AOI] :param req_params: Request parameters. :type req_params: Sentinel2RequestParams .. py:attribute:: data_collections .. py:attribute:: req_params .. py:method:: ee_search_s2_products() .. py:method:: ee_get_s2_quality_info() Get S2 quality information from GEE. .. py:method:: ee_get_s2_data() Get S2 data (level L2A, bottom of atmosphere data) from GEE. Warning! All bands are resampled to resolution specified by req_params.target_gsd. .. py:function:: gee_lists_to_2D_array(x_coords: Union[numpy.ndarray, list], y_coords: Union[numpy.ndarray, list], data: Union[numpy.ndarray, list], no_data: float) -> Tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray] Convert 1D lists of coordinates and corresponding values to 2D array. :param x_coords: X coordinates. :type x_coords: Union[np.ndarray, list] :param y_coords: Y coordinates. :type y_coords: Union[np.ndarray, list] :param data: Data values. :type data: Union[np.ndarray, list] :param no_data: No data value. :type no_data: float :returns: * **x_vals** (*np.ndarray*) -- X values. * **y_vals** (*np.ndarray*) -- Y values. * **arr** (*np.ndarray*) -- 2D array of data values. .. py:function:: get_copernicus_dem_elevation(lat: float, lon: float) Get elevation from Copernicus DEM. :param lat: Latitude. :type lat: float :param lon: Longitude. :type lon: float :returns: **elevation** -- Elevation. :rtype: float .. py:function:: ee_get_s2_quality_info(aois: Union[str, List[satellitetools.common.classes.AOI]], req_params: satellitetools.common.sentinel2.Sentinel2RequestParams) -> Dict[str, pandas.DataFrame] Get S2 quality information from GEE. :param aois: Area of interest. :type aois: Union[str, List[AOI]] :param req_params: Request parameters. :type req_params: Sentinel2RequestParams :returns: **quality_dict** -- Quality information. :rtype: Dict[str, pd.DataFrame] .. py:function:: ee_get_s2_data(aois: Union[str, List[satellitetools.common.classes.AOI]], req_params: satellitetools.common.sentinel2.Sentinel2RequestParams, quality_dict: Dict[str, pandas.DataFrame], qi_threshold: float = 0, qi_filter: List[satellitetools.common.sentinel2.SCLClass] = S2_FILTER1) -> Dict[str, pandas.DataFrame] Get S2 data (level L2A, bottom of atmosphere data) from GEE. :param aois: Area of interest. :type aois: Union[str, List[AOI]] :param req_params: Request parameters. :type req_params: Sentinel2RequestParams :param quality_dict: Quality information. :type quality_dict: Dict[str, pd.DataFrame] :param qi_threshold: Quality index threshold, by default 0. :type qi_threshold: float, optional :param qi_filter: Quality index filter, by default S2_FILTER1. :type qi_filter: List[SCLClass], optional :returns: **data_dict** -- Data. :rtype: Dict[str, pd.DataFrame]