feat(nasa-earthdata): add HLS RGB composite tool#91
Merged
Conversation
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.
|
🚀 Deployed on https://69fffeb905855c383e6904b9--opengeos.netlify.app |
Contributor
There was a problem hiding this comment.
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_compositefor streaming (or optionally downloading) 3-band RGB composites into QGIS using a GDAL VRT. - Extended catalog parsing/output to include
concept-id,provider-id, andVersion, and updated granule search to acceptconcept_idand 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 "", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
create_earthdata_rgb_compositethat streams three Earthdata COG bands through a GDAL VRT, producing a georeferenced QGIS layer with preserved CRS and geotransform metadata.concept-id,provider-id, andVersionin catalog results so granule search can disambiguate duplicate short names.orbit_numberdefaults so unset UI/LLM inputs no longer narrow CMR queries.Test plan
pytest tests/test_nasa_earthdata_tools.py -qpre-commit run --all-files