> Every page of the ganymede website is listed in https://eugo.io/docs/ganymede/llms.txt.

# Google Earth Engine

> Google Earth Engine: A petabyte scale platform for Earth Observation. A Python demo notebook from ganymede.

Web page: https://eugo.io/docs/ganymede/demo_notebooks/geospatial/google/earth_engine/
Notebook: https://eugo.io/docs/ganymede/demo_notebooks/geospatial/google/earth_engine/earth_engine.ipynb (source: https://github.com/eugo-inc/ganymede/blob/main/demo_notebooks/geospatial/google/earth_engine.ipynb)

Description:
- A petabyte scale platform for Earth Observation.

Resources:
- https://developers.google.com/earth-engine/guides/service_account#use-a-service-account-with-a-private-key
- https://developers.google.com/earth-engine/guides/access#a-role-in-a-cloud-project
- https://console.cloud.google.com/marketplace/product/google/earthengine.googleapis.com
- https://console.cloud.google.com/apis/api/earthengine.googleapis.com/metrics
- https://code.earthengine.google.com/client-auth
- https://developers.google.com/earth-engine/guides/auth
- https://github.com/google/earthengine-api/blob/master/python/ee/_helpers.py#L25
- https://github.com/google/earthengine-api/tree/master/python/examples
- https://github.com/topics/google-earth-engine
- https://github.com/google/earthengine-community
- https://github.com/opengeos/Awesome-GEE
- https://developers.google.com/earth-engine/guides/best_practices
- https://code.earthengine.google.com/register

Work with the Google Earth Engine (GEE) platform from Python.

Steps to get started:
1. Use an existing or create a new google cloud project
2. Enable access to GEE in your project or Sign up: https://code.earthengine.google.com/register
3. Authenticate (For more information on authentication and step by step instructions, see `authentication.ipynb`)

## Environment variables

This notebook reads these environment variables. Set them before you start Jupyter:

- `GOOGLE_CLOUD_PROJECT`: the Google Cloud project id that has Earth Engine access.

## Example 1

Use MODIS data to select land cover per the criteria

```python
import os

import ee

# Uses your saved Earth Engine credentials (`earthengine authenticate`), or else
# Application Default Credentials such as GOOGLE_APPLICATION_CREDENTIALS (see authentication.ipynb)
ee.Initialize(project=os.environ["GOOGLE_CLOUD_PROJECT"])

elev = ee.Image('CGIAR/SRTM90_V4')
cover = ee.Image('MODIS/051/MCD12Q1/2001_01_01').select('Land_Cover_Type_1')
blank = ee.Image(0)

# Where (1 <= cover <= 4) and (elev > 1000), set the output to 1.
output = blank.where(
    cover.lte(4).And(cover.gte(1)).And(elev.gt(1000)),
    1)

# Output contains 0s and 1s.  Mask it with itself to get rid of the 0s.
result = output.mask(output)
```
