Add lat/lon support to OlmoEarth finetuning wrapper#574
Open
Add lat/lon support to OlmoEarth finetuning wrapper#574
Conversation
Adds `use_latlon` parameter to OlmoEarth. When enabled, computes lat/lon from SampleMetadata crop center + CRS projection and passes it to the encoder for geographic encoding during finetuning. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
favyen2
reviewed
Mar 30, 2026
| from rasterio.crs import CRS | ||
| from rasterio.warp import transform | ||
|
|
||
| wgs84 = CRS.from_epsg(4326) |
Collaborator
There was a problem hiding this comment.
More consistent with rest of code to use rslearn tooling for this:
from rslearn.const import WGS84_PROJECTION
geom = STGeometry(meta.projection.crs, shapely.Point(cx, cy), None)
wgs84_geom = geom.to_projection(WGS84_PROJECTION)
latlons.append([wgs84_geom.shp.y, wgs84_geom.shp.x])
favyen2
reviewed
Mar 30, 2026
| Returns: | ||
| Tensor of shape (B, 2) with (latitude, longitude) in degrees. | ||
| """ | ||
| from rasterio.crs import CRS |
Collaborator
There was a problem hiding this comment.
Move imports to top of file.
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
use_latlon: boolparameter toOlmoEarthwrapperSampleMetadatacrop center + CRS projection viarasterio.warp.transformlatlononMaskedOlmoEarthSampleso the encoder applies geographic encoding during finetuninguse_latlon_encoding=TrueRelated PRs
Test plan
use_latlon=True, backward compat withuse_latlon=False🤖 Generated with Claude Code