Simple experiment to compare ENVO similarity to google embedding cosine similarity
- Python 3.10+
uvpackage manager- Google Cloud account with billing enabled
# Clone the repository
git clone <repository-url>
cd env-embeddings
# Install dependencies
uv syncThis project uses Google Earth Engine to retrieve 64-dimensional satellite embeddings. Follow these steps for initial setup:
- Go to Google Cloud Console
- Click "NEW PROJECT"
- Name:
Environment Embeddings Project - Project ID:
env-embeddings-2025(or similar) - Click "CREATE"
# Set your project as active
gcloud config set project env-embeddings-2025
# Enable required APIs
gcloud services enable earthengine.googleapis.com cloudresourcemanager.googleapis.com serviceusage.googleapis.com --project=env-embeddings-2025- Visit: https://console.cloud.google.com/earth-engine?project=env-embeddings-2025
- Choose "noncommercial" use
- Complete the registration workflow
- Wait for approval (usually a few minutes)
# Authenticate with Google Cloud
gcloud auth application-default login
# Grant necessary permissions to your team (replace with actual emails)
gcloud projects add-iam-policy-binding env-embeddings-2025 --member="user:YOUR_EMAIL@lbl.gov" --role="roles/editor"
gcloud projects add-iam-policy-binding env-embeddings-2025 --member="user:YOUR_EMAIL@lbl.gov" --role="roles/serviceusage.serviceUsageConsumer"uv run env-embeddings init-ee --project env-embeddings-2025# Get embedding for specific coordinates and year
uv run env-embeddings embedding --lat 39.0372 --lon -121.8036 --year 2024
# With project parameter (if not initialized)
uv run env-embeddings embedding --lat 39.0372 --lon -121.8036 --year 2024 --project env-embeddings-2025This returns a 64-dimensional vector representing environmental/satellite features from Google's Earth Engine satellite data.
# Add Google Earth Engine embeddings to your TSV file
# (Files in data/ directory can be referenced by filename only)
uv run env-embeddings add-embeddings date_and_latlon_samples_extended.tsv
# Process just a subset for testing
uv run env-embeddings add-embeddings date_and_latlon_samples_extended.tsv --max-rows 100
# Specify custom output location
uv run env-embeddings add-embeddings data/my_samples.tsv --output data/my_results.tsv
# Use different fallback year when original year has no satellite data
uv run env-embeddings add-embeddings date_and_latlon_samples_extended.tsv --fallback-year 2021This command:
- Reads your TSV file with sample coordinates and dates
- Parses coordinates from
lat_loncolumn (e.g., "50.936 N 6.952 E") - Parses years from
datecolumn (handles "2008-08-20", "2016", etc.) - Retrieves 64-dimensional satellite embeddings from Google Earth Engine
- Adds a new
google_earth_embeddingscolumn to your data - Uses fallback year (default 2020) when original year has no satellite coverage
# View all commands
uv run env-embeddings --help
# Get help for specific commands
uv run env-embeddings init-ee --help
uv run env-embeddings embedding --helphttps://contextualizerai.github.io/env-embeddings
# Run all tests
uv run pytest
# Run specific test file
uv run pytest tests/test_earth_engine.py
# Run tests with verbose output
uv run pytest -venv-embeddings/
├── src/env_embeddings/
│ ├── cli.py # CLI interface with Typer
│ ├── earth_engine.py # Earth Engine integration
│ ├── sample_processor.py # Sample data processing utilities
│ └── __init__.py
├── tests/
│ ├── test_earth_engine.py # Earth Engine functionality tests
│ └── test_simple.py # Basic tests
├── data/ # Data files directory
│ └── date_and_latlon_samples_extended.tsv # Sample dataset
├── docs/ # MkDocs documentation
└── pyproject.toml # Project configuration
Key dependencies:
typer- CLI frameworkearthengine-api- Google Earth Engine Python APIlinkml-runtime- Data modelingpytest- Testing framework
- docs/ - mkdocs-managed documentation
- project/ - project files (these files are auto-generated, do not edit)
- src/ - source files (edit these)
- tests/ - Python tests
- data/ - Example data
There are several pre-defined command-recipes available.
They are written for the command runner just. To list all pre-defined commands, run just or just --list.
MacOS users can do a one-time installation of just with uv tool install rust-just
See also: https://github.com/casey/just
This project uses the template monarch-project-copier