Skip to content

Implement 2d sel via Xarray accessor? #1

@willirath

Description

@willirath

We have https://git.geomar.de/python/xorca_lonlat2ij which basically

  • puts all horizontal coordinates into 3d space referenced to the center of the earth.
  • constructs a KD tree
  • looks up closest indices for any given lat, lon pair

(xorca_lonlat2ij.get_ij is a good entry point to get an overview of the logic.)

Then, we usually use these indices for a vector .sel() as seen here https://github.com/ESM-VFC/esm-vfc-workflows/blob/7edd9bbc7cd3532c0537f89f667154a9dd27156d/meteor_m85.1_vs_NEMO_FOCI_hydrography/compare_m81.1_hydrography_with_ORCA05_FOCI_Test_data.ipynb

What I'd like to have is this implemented as an Xarray accessor or something that is similarly easy to use.

This would not act on the staggered C grids, we'll need XGCM for, but could be easily generalized to XGCM-compatible datasets if xgcm/xgcm#200 became reality at a later point.

(@benbovy This could be a first thing to work on.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions