Skip to main content

ECOSTRESS Collection 3 CMR Tools

ECOv003-CMR searches NASA's Common Metadata Repository (CMR) for ECOSTRESS Collection 3 granules, downloads granules, parses granule metadata, samples Cloud-Optimized GeoTIFF (COG) raster values at geographic points, and builds globally or regionally stratified point-sample datasets over /vsicurl/.

CI


Table of Contents

  1. Requirements and Installation
  2. NASA Earthdata Authentication
  3. Supported Collection 3 Products
  4. Command-Line Tools (ECOv003-search & ECOv003-download)
  5. Python API: Searching NASA CMR
  6. Python API: Downloading & Opening Granules
  7. Python API: Point Sampling & /vsicurl/ Batch Extraction
  8. Python API: Global & Regional Stratified Dataset Builder
  9. Python API: Granule ID, Filename & Tile Utilities
  10. Examples
  11. Development and Testing

Requirements and Installation

Python 3.11 or later is required. Install the package from PyPI:

pip install ECOv003-CMR

To install from source with development tools (pytest, build, twine, jupyter):

git clone https://github.com/ECOSTRESS-Collection-3/ECOv003-CMR.git
cd ECOv003-CMR
pip install -e ".[dev]"

NASA Earthdata Authentication

CMR metadata searches are public. Downloading granule files and sampling raster URLs require a NASA Earthdata Login account (urs.earthdata.nasa.gov) with LP DAAC applications authorized.

setup_earthdata_session() resolves credentials in the following priority order:

  1. Explicit arguments passed to setup_earthdata_session(username=..., password=...)
  2. Environment variables:
    export EARTHDATA_USERNAME="YOUR_USERNAME"
    export EARTHDATA_PASSWORD="YOUR_PASSWORD"
    
  3. ~/.netrc file (recommended for local development, CLI usage, and GDAL /vsicurl/ byte-range reads):
    machine urs.earthdata.nasa.gov
        login YOUR_USERNAME
        password YOUR_PASSWORD
    
    Restrict permissions so only your user account can read it:
    chmod 600 ~/.netrc
    

Configuring a Session & GDAL /vsicurl/ Environment in Python

from ECOv003_CMR import setup_earthdata_session, configure_gdal_earthdata_env

# Load credentials automatically from environment variables or ~/.netrc
session = setup_earthdata_session()

# Context manager exports Netscape URS cookies for /vsicurl/ and removes temp files on exit
with configure_gdal_earthdata_env(session=session):
    ...

All search, download, and point-sampling functions accept session=... and will automatically call setup_earthdata_session() if none is provided. Note that CMR search functions automatically avoid forwarding URS Basic Auth headers to public cmr.earthdata.nasa.gov search endpoints while still reusing the session for HTTP connection pooling.


Supported Collection 3 Products

Product Code Collection DOI CMR Concept ID Description Representative Variables
L1CT_RAD 10.5067/ECOSTRESS/ECO_L1CT_RAD.003 C4142244484-LPCLOUD Calibrated at-sensor radiance (tiled) radiance_1 – radiance_6
L2T_LSTE 10.5067/ECOSTRESS/ECO_L2T_LSTE.003 C3998139651-LPCLOUD Land surface temperature and emissivity LST, LST_err, QC, EmisWB, Emis1–Emis5, view_zenith, height
L2T_STARS 10.5067/ECOSTRESS/ECO_L2T_STARS.003 C3998139658-LPCLOUD Surface reflectance, vegetation, albedo & UQ priors NDVI, NDVI-UQ, albedo, albedo-UQ
L3T_ETAUX 10.5067/ECOSTRESS/ECO_L3T_ETAUX.003 C4057520953-LPCLOUD Tiled evapotranspiration auxiliary data Ta, RH, SM, Rg, Rn, cloud, water
L3T_JET 10.5067/ECOSTRESS/ECO_L3T_JET.003 C4057232489-LPCLOUD Jet Propulsion Laboratory ET & ensemble partitioning PTJPLSMinst, ETdaily, ETuncertainty, PTJPLSMcanopy, STICJPLdaily, BESSJPLdaily, PMJPLdaily
L4T_ESI 10.5067/ECOSTRESS/ECO_L4T_ESI.003 C4057232495-LPCLOUD Evaporative Stress Index ESI
L4T_WUE 10.5067/ECOSTRESS/ECO_L4T_WUE.003 C4057232498-LPCLOUD Water Use Efficiency WUE

Migration Note: Collection 3 replaces the separate Collection 2 L3T_MET, L3T_SM, and L3T_SEB products with L3T_ETAUX. Discontinued Collection 2 product codes raise a ValueError.


Command-Line Tools

Installing ECOv003-CMR registers two CLI commands: ECOv003-search and ECOv003-download.

# Print matching unique granule IDs to stdout
ECOv003-search \
  --product L2T_LSTE L2T_STARS L3T_JET \
  --tile 52NHN 53NMH \
  --start-date 2026-06-01 \
  --end-date 2026-06-07

# Filter by orbit/scene/cloud cover and export full file listing to CSV
ECOv003-search \
  --product L2T_LSTE \
  --tile 52NHN \
  --start-date 2026-06-01 \
  --orbit 44814 \
  --scene 1 \
  --max-cloud-cover 20 \
  --output ecostress-files.csv

ECOv003-download

ECOv003-download \
  --product L2T_LSTE L2T_STARS L3T_ETAUX \
  --tile 11SLT 11SPS \
  --start-date 2026-06-01 \
  --end-date 2026-06-07 \
  --parent-directory ~/data/ECOSTRESS_v003

Python API: Searching NASA CMR

from datetime import date
from ECOv003_CMR import ECOSTRESS_CMR_search, setup_earthdata_session

session = setup_earthdata_session(require_auth=False)
results = ECOSTRESS_CMR_search(
    product=["L2T_LSTE", "L3T_ETAUX", "L3T_JET"],
    tile=["52NHN", "53NMH"],
    start_date=date(2026, 6, 1),
    end_date=date(2026, 6, 7),
    max_cloud_cover=20.0,
    session=session,
)

Python API: Downloading & Opening Granules

from datetime import date
from ECOv003_CMR import download_ECOSTRESS, download_ECOSTRESS_granule, setup_earthdata_session

session = setup_earthdata_session()
granule = download_ECOSTRESS_granule(
    product="L2T_LSTE",
    tile="52NHN",
    acquisition_date=date(2026, 6, 1),
    orbit=44814,
    scene=1,
    parent_directory="./data",
    session=session,
)

Python API: Point Sampling & /vsicurl/ Batch Extraction

sample_points_from_granule(), sample_points_over_date_range(), and sample_points_from_geodataframe() group points by granule, join instantaneous products by (orbit, scene, tile, timestamp) and daily L2T_STARS priors by (tile, YYYYMMDD), and extract pixels over authenticated /vsicurl/ HTTP byte-range requests (with automatic jittered-backoff MemoryFile fallback).

from datetime import date
import geopandas as gpd
from shapely.geometry import Point
from ECOv003_CMR import sample_points_over_date_range, summarize_point_samples

sites = gpd.GeoDataFrame(
    {
        "site_id": ["downtown", "airport"],
        "geometry": [Point(-118.2437, 34.0522), Point(-118.4085, 33.9416)],
    },
    crs="EPSG:4326",
)

samples = sample_points_over_date_range(
    geometry=sites,
    start_date=date(2026, 6, 1),
    end_date=date(2026, 6, 7),
    layers=["ST_C", "emissivity", "NDVI", "albedo", "Ta_C", "RH", "SM", "PTJPLSMinst"],
    max_workers=10,
    drop_na=True,
)
print(summarize_point_samples(samples))

summarize_point_samples() also accepts a list of Parquet file paths (summarize_point_samples(parquet_paths)) to compute layer completeness in $O(1)$ RAM via pyarrow.parquet row-group statistics.


Python API: Global & Regional Stratified Dataset Builder

build_stratified_dataset() scales stratified point-sample dataset generation to global multi-million-sample campaigns (~9.8s per granule across 16 science/UQ layers; ~45 minutes amortized for 1,000,000 samples across 4,000 global granules on 16 workers) with:

  • Regional Bounding-Box & Temporal-Chunked CMR Discovery: Automatically clusters tile sets larger than regional_batch_threshold=25 into $30^\circ \times 30^\circ$ WGS84 regional boxes and 92-day temporal chunks.
  • Persistent Candidate Catalog Caching (catalog_path, refresh_catalog): Stores SHA-256 cache-keyed candidate_granules.parquet catalogs for instant offline restarts.
  • Bounded HTTP Stream Concurrency (max_concurrent_streams, layer_workers): Caps simultaneous /vsicurl/ connections via a shared threading.Semaphore.
  • Synchronous Batch Cookie Re-Warming (batch_size): Refreshes Netscape URS cookies across synchronous granule batches and cleans up temporary cookie files on exit.
  • Adaptive Per-Granule Quota Refills: Re-draws unvisited clear-sky pixels when multi-product NaN dropouts reduce accepted samples below quota_k.
from datetime import date
import logging
from ECOv003_CMR import build_stratified_dataset, UQ_LAYERS, setup_earthdata_session

logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s] %(message)s")
session = setup_earthdata_session()

summary = build_stratified_dataset(
    output_dir="./stratified_dataset_output",
    start_date=date(2026, 6, 1),
    end_date=date(2026, 6, 30),
    tiles=["11SLT", "11SPS", "52NHN"],  # Omit (tiles=None) to run across all global land tiles
    target_total_samples=1000,
    min_granules_floor=1,
    dispersion_strategy="stratified_grid",
    max_workers=4,
    layer_workers=8,
    max_concurrent_streams=32,
    batch_size=250,
    refresh_catalog=False,
    layers=UQ_LAYERS,
    export_csv=True,
    session=session,
)

print(summary["coverage_summary"])

Python API: Granule ID, Filename & Tile Utilities

from ECOv003_CMR import find_sentinel2_tile

# Returns single containing land MGRS tile (or None over open ocean)
print(find_sentinel2_tile(-118.2437, 34.0522))  # '11SLT'

# Return all overlapping land MGRS tiles along UTM zone boundaries
print(find_sentinel2_tile(-118.2437, 34.0522, return_all=True))

# Include ocean-only MGRS tiles if needed
print(find_sentinel2_tile(-140.0, 0.0, land_only=False))  # '07MFV'

Development and Testing

pytest -v
pytest -m integration -v
make test-sampler
make build

Metadata

Release files for ECOv003-CMR 1.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ECOv003-CMR 1.3.0
File Size Uploaded Provenance Actions
ecov003_cmr-1.3.0.tar.gz 2.6 MB Without provenance Details for ecov003_cmr-1.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ECOv003-CMR 1.3.0
File Interpreter ABI Platform Actions
ecov003_cmr-1.3.0-py3-none-any.whl Python 3 none any Details for ecov003_cmr-1.3.0-py3-none-any.whl

Total release size: 2.7 MB

Release files / ecov003_cmr-1.3.0.tar.gz

Download URL ecov003_cmr-1.3.0.tar.gz
Size 2.6 MB
Tags Source
SHA-256 checksum
How to use checksums
ef3399171310fb8c4c49109a7835f9f5a9b8e1d82888464acb20c35bf9950bf4
BLAKE2b-256 checksum
How to use checksums
8c1aaacc88e59f9f6cb899cceb41f879d95321e8224de8e1af195561cb851a10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / ecov003_cmr-1.3.0-py3-none-any.whl

Download URL ecov003_cmr-1.3.0-py3-none-any.whl
Size 50.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7a87482f5180a9cf81542774e4ef2e36f26833bb18b2e0f1f5e282e851778beb
BLAKE2b-256 checksum
How to use checksums
65a2ba805ea35dffa685aacae94d67cba9a1af58eb17595fe558f916e767b0be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Security for ECOv003-CMR 1.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page