Google Earth Engine Overview

Google Earth Engine (GEE) Back-end

This section covers the usage of the Google Earth Engine (GEE) back-end for Gaussian Process Regression (GPR) using PyEOGPR.

class pyeogpr.EarthEngine[source]

Bases: object


projectIDstring

Your GEE projectID. Usually starts with “ee-…”. You can find it next to your profile picture, top right corner on: https://code.earthengine.google.com

sensorstring

Satellite sensor to use. You can search for it on: https://developers.google.com/earth-engine/datasets/catalog Insert the string, as you would find it on the GEE catalog site: for example: “COPERNICUS/S3/OLCI” or “LANDSAT/LC08/C02/T1_L2”

biovarstring

Biophysical variable to process.

Currently “built-in” variables available for each sensor:

Satellite Level

Available Products

SENTINEL2_L1C

Cab, Cm, Cw, FVC, LAI, laiCab, laiCm, laiCw

SENTINEL2_L2A

Cab, Cm, Cw, FVC, LAI, laiCab, laiCm, laiCw, CNC_Cab, CNC_Cprot, mangrove_LAI, mangrove_Cm, mangrove_Cw, mangrove_Cab

SENTINEL3_OLCI_L1B

FAPAR, FVC, LAI, LCC

If you have your own model trained with ARTMO (https://artmotoolbox.com), you need to insert the directory of the model, for example: r”C:/User/Models/My_custom_model.py” These models need to be in “.py” format, in order to achieve it, please consult: ARTMO to GEE and ARTMO

bounding_boxlist, ee.assetpath

Your region of interest. Insert bbox as list. Can be selected from https://geojson.io/ (e.g.: [-4.55, 42.73,-4.48, 42.77]). Alternatively, you can insert shapefiles, that are already uploaded to your GEE assets. Just copy the ee.assetpath which stores your SHP shapefile that you already uploaded to GEE.

temporal_extentlist

Your temporal extent to be processed. (e.g.: [“2021-01-01”, “2021-12-31”])

spatial_resolutionint

Spatial resolution of the exported data. Value in meters.

cloudmaskBoolean

If set to “True”, cloud masking will be done for Sentinel 2 and 3 sensors. Defaults to False.

Methods

construct_datacube([composite])

composite : Defaults to None

process_map([assetpath])

assetpath: str

addVariables

calculate_GREEN

getInputDates

maploop

quality_mask_olci

quality_mask_sentinel2

sequence_GREEN

construct_datacube(composite=None)[source]
compositeDefaults to None

The algorithm creates temporal composites, according to the number of days you assign. The temporal composites need to be 1 day smaller than the defined temporal_extent.

process_map(assetpath=None)[source]
assetpath: str

You need to define, which GEE asset (ImageCollection) you would want the maps to be exported to. To create your asset, go to top left corner on: https://code.earthengine.google.com/ You will find three tabs: Scripts, Docs and Assets. Go to Assets and create a new ImageCollection. When you created your ImageCollection, copy its ID as a string and assign it to assetpath. If left blank, the script will automatically generate you a default asset.

quality_mask_olci(image)[source]
quality_mask_sentinel2(image)[source]

Step-by-Step tutorial

  1. Go to Google Earth Engine and register your account.

  2. Open the GEE Code Editor . We will connect the pyeogpr client to GEE now.

  3. On the top right corner you should see the projectID of your account starting with “ee-…” This, you should copy in the projectID parameter (see Example below).

  4. Top left corner go to “Assets” tab. Go to red “New” button, and create an ImageCollection. When created, copy its ImageCollection ID, and use it as your assetpath for mapping. (See process_map function in the Example below).

  5. Now you are ready to go, Open up the command line, type “pip install pyeogpr”. This will install the package.

  6. Run pyeogpr as per your needs, you can test with the Example script.

  7. Check the status of the process on: Task manager

Example Usage

from pyeogpr import EarthEngine

bounding_box = [
    17.83670163256923,
    46.55399091975397,
    18.368529333383833,
    46.935776495476205
  ]

dc = EarthEngine(projectID  = "ee-dkvcsdvd",
                 sensor ="SENTINEL3_L1B",
                 biovar = "FVC",
                 bounding_box = bounding_box,
                 temporal_extent =  ["2021-07-01", "2021-07-08"],
                 spatial_resolution  = 300,
                 cloudmask =True)

dc.construct_datacube(composite = 4)

dc.process_map(assetpath = "projects/ee-dkvcsdvd/assets/MyImageCollection")