or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

cloud-masking.mdcollection-operations.mdcompositing.mdexport-download.mdimage-processing.mdindex.mdinitialization.md
tile.json

tessl/pypi-geedim

Export and cloud mask Google Earth Engine imagery with automated composite creation and filtering capabilities.

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/geedim@2.0.x

To install, run

npx @tessl/cli install tessl/pypi-geedim@2.0.0

index.mddocs/

Geedim

A comprehensive Python toolkit for exporting and cloud masking Google Earth Engine (GEE) imagery. Geedim enables users to export GEE Image and ImageCollection data to multiple formats including GeoTIFF files, NumPy arrays, Xarray Datasets, and Google Cloud platforms. The library specializes in cloud masking for Landsat 4-9 collection 2 images and Sentinel-2 TOA and surface reflectance images, extending the GEE API through pandas-style accessors.

Package Information

  • Package Name: geedim
  • Language: Python
  • Installation: pip install geedim
  • Documentation: https://geedim.readthedocs.io/

Core Imports

import geedim

Working with Earth Engine classes via accessors:

import ee
import geedim

# Initialize Earth Engine
geedim.Initialize()

# Access via .gd accessor
image = ee.Image('LANDSAT/LC08/C02/T1_L2/LC08_173083_20160101')
collection = ee.ImageCollection('LANDSAT/LC08/C02/T1_L2')

Legacy imports (deprecated):

from geedim import MaskedImage, MaskedCollection

Enums and utilities:

from geedim import (
    CloudMaskMethod,
    CloudScoreBand,
    CompositeMethod,
    ExportType,
    ResamplingMethod,
    Initialize
)

# Additional enums available from geedim.enums module
from geedim.enums import SpectralDistanceMetric, SplitType, Driver

Basic Usage

import ee
import geedim

# Initialize Earth Engine with high-volume endpoint
geedim.Initialize()

# Load a Landsat image with cloud masking
image = ee.Image('LANDSAT/LC08/C02/T1_L2/LC08_173083_20160101')
masked_image = image.gd.addMaskBands().maskClouds()

# Export to GeoTIFF
region = ee.Geometry.Point(-122.4194, 37.7749).buffer(10000)
masked_image.gd.export(
    filename='landsat_export',
    type=geedim.ExportType.drive,
    folder='my_exports',
    region=region,
    scale=30
)

# Create a composite from collection
collection = ee.ImageCollection('LANDSAT/LC08/C02/T1_L2') \
    .filterDate('2020-01-01', '2020-12-31') \
    .filterBounds(region)

composite = collection.gd.composite(
    method=geedim.CompositeMethod.median,
    region=region,
    scale=30
)

# Download to NumPy array
array = composite.gd.download(filename=None, region=region, scale=30)

Architecture

Geedim extends Google Earth Engine through pandas-style accessors registered on ee.Image and ee.ImageCollection classes:

  • Image Accessor (.gd): Provides cloud masking, export, and download capabilities for individual images
  • Collection Accessor (.gd): Enables filtering, compositing, and batch operations on image collections
  • Masking System: Automatic cloud and shadow detection for Landsat and Sentinel-2 imagery
  • Export Engine: Multi-format export supporting GeoTIFF, cloud storage, and in-memory formats
  • Async Downloads: Parallel downloading with progress tracking and retry logic

The accessor pattern allows seamless integration with existing Earth Engine workflows while adding powerful cloud masking and export capabilities.

Capabilities

Earth Engine Initialization

Initialize Earth Engine with high-volume endpoint and credential management, including support for service account authentication via environment variables.

def Initialize(
    opt_url: str = 'https://earthengine-highvolume.googleapis.com',
    **kwargs
) -> None: ...

Initialization

Image Processing

Process individual Earth Engine images with cloud masking, export, and download capabilities. Supports automatic cloud and shadow detection for Landsat 4-9 and Sentinel-2 imagery.

# Accessed via ee.Image.gd
class ImageAccessor:
    def addMaskBands(self, **kwargs) -> ee.Image: ...
    def maskClouds(self) -> ee.Image: ...
    def export(self, filename: str, type: ExportType = ExportType.drive, **kwargs) -> ee.batch.Task: ...
    def download(self, filename: str | None = None, **kwargs): ...

Image Processing

Collection Operations

Advanced operations on Earth Engine image collections including filtering, compositing, and batch processing with cloud masking support.

# Accessed via ee.ImageCollection.gd
class ImageCollectionAccessor:
    def filter(self, start_date: str = None, end_date: str = None, **kwargs) -> ee.ImageCollection: ...
    def composite(self, method: CompositeMethod = None, **kwargs) -> ee.Image: ...
    def export(self, filename: str, **kwargs) -> list[ee.batch.Task]: ...
    def download(self, filename: str | None = None, **kwargs): ...

Collection Operations

Cloud Masking

Specialized cloud and shadow masking for Landsat and Sentinel-2 imagery with configurable algorithms and thresholds.

class CloudMaskMethod(Enum):
    cloud_prob = 'cloud-prob'  # Deprecated
    qa = 'qa'  # Deprecated  
    cloud_score = 'cloud-score'

class CloudScoreBand(Enum):
    cs = 'cs'
    cs_cdf = 'cs_cdf'

Cloud Masking

Export and Download

Export images and collections to various formats including GeoTIFF, Google Drive, Cloud Storage, and in-memory arrays with configurable parameters.

class ExportType(Enum):
    drive = 'drive'
    asset = 'asset'
    cloud = 'cloud'

class ResamplingMethod(Enum):
    near = 'near'
    bilinear = 'bilinear'
    bicubic = 'bicubic'
    average = 'average'

Export and Download

Compositing

Create temporal composites from image collections using various algorithms including median, medoid, q-mosaic, and statistical methods.

class CompositeMethod(Enum):
    q_mosaic = 'q-mosaic'
    mosaic = 'mosaic'
    medoid = 'medoid'
    median = 'median'
    mode = 'mode'
    mean = 'mean'

class SpectralDistanceMetric(Enum):
    sam = 'sam'  # Spectral angle mapper
    sid = 'sid'  # Spectral information divergence
    sed = 'sed'  # Squared euclidean distance
    emd = 'emd'  # Earth movers distance

class SplitType(Enum):
    bands = 'bands'  # Split collection by band
    images = 'images'  # Split collection by image

class Driver(Enum):
    gtiff = 'gtiff'  # GeoTIFF
    cog = 'cog'  # Cloud Optimised GeoTIFF

Compositing

Types

# Core version identifier
__version__: str

# Legacy classes (deprecated in 2.0.0)
class MaskedImage:
    def __init__(self, ee_image: ee.Image, mask: bool = False, **kwargs): ...
    @staticmethod
    def from_id(image_id: str, **kwargs) -> MaskedImage: ...

class MaskedCollection:
    def __init__(self, ee_collection: ee.ImageCollection, add_props: list[str] | None = None): ...
    @classmethod
    def from_name(cls, name: str, **kwargs) -> MaskedCollection: ...