Skip to content

Conversation

@tdoerff
Copy link

@tdoerff tdoerff commented Dec 12, 2025

Closes #1425

Overview

  • in UxDataArrayCrossSectionAccessor: retrieve the name of the longitude / latitude coords from the input UxDataArray and update the coords of the output Dataset accordingly.

Expected Usage

Input data can be obtained here: https://kumulus.iap-kborn.de/index.php/s/qHiQFKzoA5Jwn2X

import uxarray as ux

data_path = "uvwtemp_3d_ML_19790124T000000Z.nc"
grid_path = "icon_grid_0013_R02B04_G.nc"

uxds = ux.open_dataset(grid_path, data_path)

cross_section_gca = uxds.temp.cross_section(start=(0, -90), end=(0., 90))

PR Checklist

General

  • An issue is linked created and linked
  • Add appropriate labels
  • Filled out Overview and Expected Usage (if applicable) sections

Testing

  • Adequate tests are created if there is new functionality
  • Tests cover all possible logical paths in your function
  • Tests are not too basic (such as simply calling a function and nothing else)

Documentation

  • Docstrings have been added to all new functions
  • Docstrings have updated with any function changes
  • Internal functions have a preceding underscore (_) and have been added to docs/internal_api/index.rst
  • User functions have been added to docs/user_api/index.rst

Examples

  • Any new notebook examples added to docs/examples/ folder
  • Clear the output of all cells before committing
  • New notebook files added to docs/examples.rst toctree
  • New notebook files added to new entry in docs/gallery.yml with appropriate thumbnail photo in docs/_static/thumbnails/

@tdoerff tdoerff marked this pull request as draft December 12, 2025 10:31
@rajeeja rajeeja self-requested a review December 12, 2025 20:37
@rajeeja
Copy link
Contributor

rajeeja commented Dec 12, 2025

Cross-section on ICON data fails now because the input has face coords clon/clat and we drop n_face, so the accessor tries to add new lat/lon coords on steps and triggers CoordinateValidationError (“clon has dimensions ('n_face',) but these are not a subset of ('time','height','steps')”) @tdoerff thanks for reporting this and providing this fix. I think the new lat_key/lon_key logic introduces problems: it always writes four coordinates (lat, lon, plus lat_key/lon_key) - can we do something better? How about we pick the existing face lat/lon coord names once (fallback to lat/lon if none) and attach only those so we don’t duplicate or clobber other coords.

@erogluorhan
Copy link
Member

Thanks for your contribution! It looks like this issue is related to our ICON I/O rather than cross-sections though. I think we missed dim/coord name parsing when opening ICON data/grid in uxarray, which can be fixed easily. @rajeeja does this make sense?

@tdoerff
Copy link
Author

tdoerff commented Dec 14, 2025

Hi, thanks for the feedback!

@rajeeja you wrote:

How about we pick the existing face lat/lon coord names once (fallback to lat/lon if none) and attach only those so we don’t duplicate or clobber other coords.

I think the new logics should in fact do the trick. lat_key_cands and lon_key_cand contain all labels containing the substrings "lat"/"lon", ie, either "clat"/"clon" or "lat"/"lon". If there are no candidates then we use "lat"/"lon" as fallback. Maybe a systematic test would be nice.

@erogluorhan This is a good point. Do you think it would be a better solution to rename the "clon"/"clat" dimension names in _icon._primal_to_ugrid()?

@erogluorhan
Copy link
Member

@erogluorhan This is a good point. Do you think it would be a better solution to rename the "clon"/"clat" dimension names in _icon._primal_to_ugrid()?

Yeah, probably something like that. I recall we have good dim/coord naming parsers in _mpas._primal_to_ugrid() and _mpas._dual_to_ugrid(), so we will need to reuse ideas from them into parsers in ICON.

@rajeeja
Copy link
Contributor

rajeeja commented Dec 16, 2025

Hi, thanks for the feedback!

@rajeeja you wrote:

How about we pick the existing face lat/lon coord names once (fallback to lat/lon if none) and attach only those so we don’t duplicate or clobber other coords.

I think the new logics should in fact do the trick. lat_key_cands and lon_key_cand contain all labels containing the substrings "lat"/"lon", ie, either "clat"/"clon" or "lat"/"lon". If there are no candidates then we use "lat"/"lon" as fallback. Maybe a systematic test would be nice.

@erogluorhan This is a good point. Do you think it would be a better solution to rename the "clon"/"clat" dimension names in _icon._primal_to_ugrid()?

@tdoerff please check #1430

@tdoerff tdoerff closed this Dec 17, 2025
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.

Naming conflicts on cross_section for ICON grids

3 participants