ENH: move station coords to root and add optional_groups parameter#333
Open
aladinor wants to merge 6 commits intoopenradar:mainfrom
Open
ENH: move station coords to root and add optional_groups parameter#333aladinor wants to merge 6 commits intoopenradar:mainfrom
aladinor wants to merge 6 commits intoopenradar:mainfrom
Conversation
…penradar#331) Move latitude, longitude, and altitude from sweep datasets to root node as coordinates, leveraging DataTree coordinate inheritance. Add optional_groups parameter (default False) to all open_*_datatree() functions to control inclusion of /radar_parameters, /georeferencing_correction, and /radar_calibration subgroups.
Add changelog entries, update importers guide with common DataTree behavior section, and note station coordinates on root in data model.
…penradar#331) cfradial1 has its own _get_required_root_dataset() that was missing the set_coords() promotion for lat/lon/alt. Roundtrip transform tests (to_cfradial1 -> to_cfradial2) need optional_groups=True to preserve radar_parameters through the conversion pipeline.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #333 +/- ##
==========================================
- Coverage 93.59% 93.52% -0.07%
==========================================
Files 27 27
Lines 5654 5717 +63
==========================================
+ Hits 5292 5347 +55
- Misses 362 370 +8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…radar#331) Revert the station-coord stripping from sweeps since xarray does not yet support scalar coordinate inheritance (pydata/xarray#9077). Station coords now remain on sweeps AND are promoted to coordinates on the root node. This preserves backward compatibility for georeference code and single-sweep access via xr.open_dataset().
The notebook demonstrates the full CfRadial2 structure including radar_parameters, so it needs optional_groups=True now that the default is False.
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
kmuehlbauer
reviewed
Feb 20, 2026
Add tests exercising the optional_groups=True code path for all 9 backends that were missing coverage (gamic, odim, iris, rainbow, furuno, datamet, hpl, metek, uf). NEXRAD already had one.
10 tasks
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
Closes #331
latitude,longitude,altitude) to coordinates on the root node, aligning with CfRadial 2.0 Section 4.4. Station coords remain on sweeps for backward compatibility since xarray does not yet support scalar coordinate inheritance (pydata/xarray#9077). Once xarray adds this, a follow-up PR can remove sweep-level copies.optional_groupsparameter (defaultFalse) to all 11open_*_datatree()functions, controlling inclusion of/radar_parameters,/georeferencing_correction, and/radar_calibrationmetadata subgroups. These are mostly empty or sparsely populated and excluded by default for a leaner DataTree.xr.open_dataset()withsite_coords=True(single-sweep access) continues to work unchanged.Motivation: performance and compliance
Profiling a 6-month KVNX radar DataTree (126 zarr groups, 1868 arrays) on EC2 revealed structural inefficiencies in how xradar builds DataTrees:
set_coords()optional_groups=Falseby default excludes themCfRadial 2.0 compliance
All three metadata subgroups are explicitly optional per the CfRadial 2.0 spec:
Test plan
dtree.ds.coords["latitude"])optional_groups=Truepreserves metadata subgroupsoptional_groups=True