Skip to content

feat(nasa-earthdata): add HLS RGB composite tool#91

Merged
giswqs merged 1 commit into
mainfrom
feat/earthdata-rgb-composite
May 10, 2026
Merged

feat(nasa-earthdata): add HLS RGB composite tool#91
giswqs merged 1 commit into
mainfrom
feat/earthdata-rgb-composite

Conversation

@giswqs

@giswqs giswqs commented May 10, 2026

Copy link
Copy Markdown
Member

Summary

  • Add create_earthdata_rgb_composite that streams three Earthdata COG bands through a GDAL VRT, producing a georeferenced QGIS layer with preserved CRS and geotransform metadata.
  • Surface concept-id, provider-id, and Version in catalog results so granule search can disambiguate duplicate short names.
  • Ignore zero-valued orbit_number defaults so unset UI/LLM inputs no longer narrow CMR queries.

Test plan

  • pytest tests/test_nasa_earthdata_tools.py -q
  • pre-commit run --all-files
  • Manual: in QGIS, run an HLS Sentinel-2 false-color request (B08/B04/B03) and confirm the resulting layer is georeferenced and renders as RGB.

Add create_earthdata_rgb_composite which streams three Earthdata COG
bands through a GDAL VRT so QGIS gets a georeferenced RGB layer with
preserved CRS, instead of inline VRT XML that drops geotransform
metadata. Surface concept-id in the catalog and skip zero-valued orbit
number defaults so granule searches stay disambiguated and unfiltered.
Copilot AI review requested due to automatic review settings May 10, 2026 03:41
@github-actions

Copy link
Copy Markdown

@github-actions github-actions Bot temporarily deployed to pull request May 10, 2026 03:42 Inactive

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new NASA Earthdata tool to build RGB composites from three COG band URLs (via a GDAL VRT) and improves granule search disambiguation by surfacing and accepting collection concept IDs, while also avoiding unintended orbit filtering when defaults are zero.

Changes:

  • Added create_earthdata_rgb_composite for streaming (or optionally downloading) 3-band RGB composites into QGIS using a GDAL VRT.
  • Extended catalog parsing/output to include concept-id, provider-id, and Version, and updated granule search to accept concept_id and ignore zero/empty orbit filters.
  • Updated system prompt guidance and added/expanded tests covering the new tool surface and search behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
geoagent/tools/nasa_earthdata.py Adds RGB composite tool, orbit-number normalization, concept-id-aware granule search, and GDAL streaming configuration.
tests/test_nasa_earthdata_tools.py Expands test coverage for catalog metadata fields, orbit filter normalization, concept-id preference, and VRT composite creation.
geoagent/core/factory.py Updates NASA Earthdata workflow prompt guidance to use concept-id and the new RGB composite tool.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

gdal.SetConfigOption("GDAL_HTTP_NETRC_FILE", netrc_path)
gdal.SetConfigOption("GDAL_DISABLE_READDIR_ON_OPEN", "EMPTY_DIR")
gdal.SetConfigOption("CPL_VSIL_CURL_ALLOWED_EXTENSIONS", "tif,tiff,TIF,TIFF")
gdal.SetConfigOption("GDAL_HTTP_UNSAFESSL", "YES")
Comment on lines +324 to +354
def _write_gdal_cookie_file(session: Any) -> str | None:
"""Write requests-session cookies in Netscape format for GDAL."""
cookies = getattr(session, "cookies", None)
if not cookies:
return None
cookie_file = os.path.join(
tempfile.gettempdir(), f"geoagent_earthdata_gdal_{uuid.uuid4().hex}.cookies"
)
with open(cookie_file, "w", encoding="utf-8") as f:
f.write("# Netscape HTTP Cookie File\n")
for cookie in cookies:
domain = cookie.domain or ""
include_subdomains = "TRUE" if domain.startswith(".") else "FALSE"
path = cookie.path or "/"
secure = "TRUE" if cookie.secure else "FALSE"
expires = str(cookie.expires or 0)
f.write(
"\t".join(
[
domain,
include_subdomains,
path,
secure,
expires,
str(cookie.name),
str(cookie.value),
]
)
+ "\n"
)
return cookie_file
"green_source": channel_sources["green"],
"blue_source": channel_sources["blue"],
"source_type": "stream" if stream else "download",
"cookie_file": cookie_file or "",
@giswqs giswqs merged commit 5f49ef1 into main May 10, 2026
13 checks passed
@giswqs giswqs deleted the feat/earthdata-rgb-composite branch May 10, 2026 03:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants