-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dtree constructor #221
Dtree constructor #221
Conversation
Thanks, @kmuehlbauer, for implementing this in #223. I was working during the weekend doing some tests, and I had some questions before submitting other changes. However, I think I can add them under the new head node. On the other hand, I realized that some backends might not contain the |
14edd9f
to
617bd34
Compare
@aladinor Thanks! Yes, I agree. Citing from the FM301 docs for
So we are on safe ground, to have these subgroups available, even when they are empty. |
@kmuehlbauer I did some refactoring for keeping all This is how a cfradial dtree will look like <xarray.DataTree>
Group: /
│ Dimensions: (sweep: 9)
│ Dimensions without coordinates: sweep
│ Data variables:
│ volume_number int32 4B ...
│ platform_type |S32 32B ...
│ primary_axis |S32 32B ...
│ status_str |S1 1B ...
│ instrument_type |S32 32B ...
│ time_coverage_start |S32 32B ...
│ time_coverage_end |S32 32B ...
│ latitude float64 8B ...
│ longitude float64 8B ...
│ altitude float64 8B ...
│ sweep_group_name (sweep) <U7 252B 'sweep_0' 'sweep_1' ... 'sweep_8'
│ sweep_fixed_angle (sweep) float32 36B ...
│ Attributes: (12/13)
│ Conventions: CF/Radial instrument_parameters radar_parameters rad...
│ version: 1.2
│ title: TIMREX
│ institution:
│ references:
│ source:
│ ... ...
│ comment:
│ instrument_name: SPOLRVP8
│ site_name:
│ scan_name:
│ scan_id: 0
│ platform_is_mobile: false
├── Group: /sweep_0
│ Dimensions: (azimuth: 483, range: 996)
│ Coordinates:
│ time (azimuth) datetime64[ns] 4kB 2008-06-04T00:15:...
│ elevation (azimuth) float32 2kB ...
│ latitude float64 8B ...
│ longitude float64 8B ...
│ altitude float64 8B ...
│ * azimuth (azimuth) float32 2kB 0.0 0.75 ... 358.5 359.2
│ * range (range) float32 4kB 150.0 300.0 ... 1.494e+05
│ Data variables: (12/18)
│ sweep_number int32 4B ...
│ sweep_mode <U20 80B 'azimuth_surveillance'
│ prt_mode |S32 32B ...
│ follow_mode |S32 32B ...
│ sweep_fixed_angle float32 4B ...
│ pulse_width (azimuth) timedelta64[ns] 4kB ...
│ ... ...
│ r_calib_index (azimuth) int8 483B ...
│ measured_transmit_power_h (azimuth) float32 2kB ...
│ measured_transmit_power_v (azimuth) float32 2kB ...
│ scan_rate (azimuth) float32 2kB ...
│ DBZ (azimuth, range) float32 2MB ...
│ VR (azimuth, range) float32 2MB ...
├── Group: /sweep_1
│ Dimensions: (azimuth: 483, range: 996)
│ Coordinates:
│ time (azimuth) datetime64[ns] 4kB 2008-06-04T00:16:...
│ elevation (azimuth) float32 2kB ...
│ latitude float64 8B ...
│ longitude float64 8B ...
│ altitude float64 8B ...
│ * azimuth (azimuth) float32 2kB 0.0 0.75 ... 358.5 359.2
│ * range (range) float32 4kB 150.0 300.0 ... 1.494e+05
│ Data variables: (12/18)
│ sweep_number int32 4B ...
│ sweep_mode <U20 80B 'azimuth_surveillance'
│ prt_mode |S32 32B ...
│ follow_mode |S32 32B ...
│ sweep_fixed_angle float32 4B ...
│ pulse_width (azimuth) timedelta64[ns] 4kB ...
│ ... ...
│ r_calib_index (azimuth) int8 483B ...
│ measured_transmit_power_h (azimuth) float32 2kB ...
│ measured_transmit_power_v (azimuth) float32 2kB ...
│ scan_rate (azimuth) float32 2kB ...
│ DBZ (azimuth, range) float32 2MB ...
│ VR (azimuth, range) float32 2MB ...
├── Group: /sweep_2
│ Dimensions: (azimuth: 482, range: 996)
│ Coordinates:
│ time (azimuth) datetime64[ns] 4kB 2008-06-04T00:17:...
│ elevation (azimuth) float32 2kB ...
│ latitude float64 8B ...
│ longitude float64 8B ...
│ altitude float64 8B ...
│ * azimuth (azimuth) float32 2kB 0.0 0.75 ... 358.5 359.2
│ * range (range) float32 4kB 150.0 300.0 ... 1.494e+05
│ Data variables: (12/18)
│ sweep_number int32 4B ...
│ sweep_mode <U20 80B 'azimuth_surveillance'
│ prt_mode |S32 32B ...
│ follow_mode |S32 32B ...
│ sweep_fixed_angle float32 4B ...
│ pulse_width (azimuth) timedelta64[ns] 4kB ...
│ ... ...
│ r_calib_index (azimuth) int8 482B ...
│ measured_transmit_power_h (azimuth) float32 2kB ...
│ measured_transmit_power_v (azimuth) float32 2kB ...
│ scan_rate (azimuth) float32 2kB ...
│ DBZ (azimuth, range) float32 2MB ...
│ VR (azimuth, range) float32 2MB ...
├── Group: /radar_parameters
│ Dimensions: ()
│ Data variables:
│ radar_beam_width_h float32 4B ...
│ radar_antenna_gain_v float32 4B ...
│ radar_antenna_gain_h float32 4B ...
│ radar_beam_width_v float32 4B ...
│ radar_receiver_bandwidth float32 4B ...
├── Group: /georeferencing_correction
│ Dimensions: ()
│ Data variables: (12/16)
│ elevation_correction float32 4B ...
│ heading_correction float32 4B ...
│ eastward_ground_speed_correction float32 4B ...
│ latitude_correction float32 4B ...
│ pitch_correction float32 4B ...
│ longitude_correction float32 4B ...
│ ... ...
│ vertical_velocity_correction float32 4B ...
│ tilt_correction float32 4B ...
│ northward_ground_speed_correction float32 4B ...
│ pressure_altitude_correction float32 4B ...
│ roll_correction float32 4B ...
│ radar_altitude_correction float32 4B ...
└── Group: /radar_calibration
Dimensions: ()
Data variables: (12/45)
time |S32 32B ...
pulse_width timedelta64[ns] 8B ...
xmit_power_h float32 4B ...
xmit_power_v float32 4B ...
two_way_waveguide_loss_h float32 4B ...
two_way_waveguide_loss_v float32 4B ...
... ...
test_power_h float32 4B ...
test_power_v float32 4B ...
receiver_slope_hc float32 4B ...
receiver_slope_vc float32 4B ...
receiver_slope_hx float32 4B ...
receiver_slope_vx float32 4B ... |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #221 +/- ##
=======================================
Coverage 92.79% 92.80%
=======================================
Files 26 26
Lines 4957 5003 +46
=======================================
+ Hits 4600 4643 +43
- Misses 357 360 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@aladinor Yes, make this a bulk refactor. No need to separate I think. But do as you prefer. The repr looks great! |
Hi @aladinor, @kmuehlbauer I think we should cover the pytests for the below given functions with this PR in the iris.py module to increase codecov. Currently, it is at 85%.
|
I added these above-mentioned pytests in #226 |
@aladinor I've found the issue with to_zarr. "sweep_group_name" was missing the fixup of the old dtype (int) to the new dtype (str). Not sure what's going on with the GH Actions, though. Maybe a temporal disturbance... |
OK, seems like GH Actions has had an incident (https://www.githubstatus.com/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking really good. Only the new entries in the radar_calibration subgroup need fixing.
Co-authored-by: Kai Mühlbauer <[email protected]>
Co-authored-by: Kai Mühlbauer <[email protected]>
@aladinor Sorry, I've bugged a paranthesis ;-) |
@aladinor Huge thanks to you! I think we can live with the slight inconsistencies in the model. We can handle that later. Please add entry in history.md, I'm going to merge if you are ready! |
Great job @aladinor! Thank you very much! |
Thank you @kmuehlbauer and @syedhamidali for your help. Excited to have |
😍 @aladinor 💯 |
* refactoring dtree node apend using _attach_sweep_groups function * refactoring iris datatree to use from_dict constructor * running pre-commit hook * refactoring calibration subgroup * dropping common attributes present in all sweeps * refactoring to use from_dict datatree constructor * refactoring loop by iterating only over sweeps * fixing failing test with attributes * addding comments * Update xradar/io/backends/iris.py * fix lint * fixing typo * refactoring datamet backend to use from_dict datatree construnctor * fixing issue with group test since datamet now has root, georefernce, radar_parameter, and calib groups * adding some calibration variables from Furuno datasets * refactoring furuno backeds to use from_dict contructor * getting ride of unncessary attributes in the root dataset * updating global attrributes * adding gamic radar calibration parameters * refactoring gamic backend to use from_dict datatree constructor * refactoring code. moving _get_required_root_dataset, _get_subgroup, to common.py file * using dtree.match to iterate over sweep nodes * refactoring _get_subgroups and _get_required_root funcition * fixing typo * adding _get_radar_calibration fuction * refactoring and moving _get_requiered_root_Dataset, _get_subgroup, and _get_calibration function to commo.py file * refactoring and moving _get_calibration function to commo.py file * refactoring hpl backends to use from_dict contructor and adding sweeps * using radar_calibration group from common.py in Datamet backend * using radar calibration subgrup fucntion from common.py in iris backend * allowing metek to read lines from gzip file when using context manager * refactoring _get_required_root function to fit with metek backend * refactoring metek backend to use from_dict constructor * fixing nexrad test that support the radar_calibration, georeference, and parameter group * refactoring nexrad backend to use from_dict constructor * reformating odim test to include calibration, georeference, and radar parameter groups in odim backend * refactoring odim backend to use from_dict constructor * refactoring odim export to iterate only over sweeps * refactoring rainbow test to only iterate over sweeps * refactoring rainbow backend to use from_dict constructor * fixin typo * adding test for _get_requered_root_group, _get_subgroup, and _get_radar_calibration functions * Update xradar/model.py * Update history.md
refactored the code to use the DataTree.from_dict constructor to create the DataTree structure instead of manually setting each node during the creation process.
DataTree.from_dict
constructor to create the DataTree structure instead of manually setting each node #222history.md