Skip to content

feat: add spherical geometry utilities for global domain support#561

Closed
arzoo0511 wants to merge 1 commit into
mllam:mainfrom
arzoo0511:feat/spherical-geometry
Closed

feat: add spherical geometry utilities for global domain support#561
arzoo0511 wants to merge 1 commit into
mllam:mainfrom
arzoo0511:feat/spherical-geometry

Conversation

@arzoo0511

Copy link
Copy Markdown

Describe your changes

This PR introduces basic spherical geometry utilities to support future global forecasting capabilities in Neural-LAM.

Summary of changes

  • Added lat_lon_to_cartesian() for converting latitude–longitude coordinates to Cartesian coordinates on the unit sphere
  • Added get_area_weights() for computing latitude-based area weighting
  • (Optional) Added helper method in datastore to expose Cartesian coordinates

Motivation and context

Current implementations assume planar geometry, which does not extend well to global forecasting. These utilities provide a reusable and modular foundation for geometry-aware graph construction on a spherical domain, aligning with ongoing work toward global support.

Dependencies

  • No additional dependencies introduced
  • Uses existing PyTorch utilities

Issue Link

Related to global forecasting discussions (no specific issue linked)


Type of change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📖 Documentation (Addition or improvements to documentation)

Checklist before requesting a review

  • My branch is up-to-date with the target branch
  • I have performed a self-review of my code
  • For any new/modified functions/classes I have added docstrings that clearly describe its purpose, expected inputs and returned values
  • I have placed in-line comments to clarify the intent of any hard-to-understand passages of my code
  • I have updated the README (not required for this change)
  • I have added tests (planned in follow-up PR)
  • I have given the PR a name that clearly describes the change, written in imperative form

Notes

This PR is intentionally scoped to be small and modular, focusing only on geometry utilities. Future work will build on this to implement global graph construction and integration into the training pipeline.

Copilot AI review requested due to automatic review settings March 31, 2026 09:15

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 initial spherical-geometry utilities intended to support future global-domain workflows in Neural-LAM.

Changes:

  • Introduces lat_lon_to_cartesian() for converting latitude/longitude (degrees) to 3D unit-sphere Cartesian coordinates (PyTorch).
  • Introduces get_area_weights() for latitude-based area weighting.
  • Adds a helper get_cartesian_coords (currently implemented as a free function).

Reviewed changes

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

File Description
geometry.py Adds spherical-geometry helper functions (lat/lon → Cartesian, latitude area weights, and a Cartesian-coords helper).
.cora/analytics/index.json Adds a generated analytics index artifact.

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

Comment thread geometry.py
Comment thread geometry.py
Comment thread geometry.py
Comment thread geometry.py
Comment thread geometry.py
Comment thread .cora/analytics/index.json
@sadamov

sadamov commented Mar 31, 2026

Copy link
Copy Markdown
Collaborator

#473 is currently a draft PR that addresses these concerns already. it would be great if you could hop over there and contribute to that PR/discussion directly.

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.

3 participants