Skip to content

Commit

Permalink
ADD: Added new function for volume operation
Browse files Browse the repository at this point in the history
  • Loading branch information
syedhamidali committed Aug 31, 2024
1 parent 5f0babf commit f3c28b0
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions xradar/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,15 +546,20 @@ def apply_to_sweeps(dtree, func, pass_sweep_name=False, *args, **kwargs):
-------
DataTree
The DataTree object after applying the function to all sweeps.
Raises
------
Exception
Re-raises any exception that occurs during the function application.
"""
try:
for key in list(dtree.children):
if "sweep" in key:
for key in list(dtree.children):
if "sweep" in key:
try:
if pass_sweep_name:
dtree[key] = func(dtree[key], sweep=key, *args, **kwargs)

Check warning on line 559 in xradar/util.py

View check run for this annotation

Codecov / codecov/patch

xradar/util.py#L555-L559

Added lines #L555 - L559 were not covered by tests
else:
dtree[key] = func(dtree[key], *args, **kwargs)
except Exception:
pass
except Exception as e:
raise RuntimeError(f"An error occurred while processing {key}: {e}")

Check warning on line 563 in xradar/util.py

View check run for this annotation

Codecov / codecov/patch

xradar/util.py#L561-L563

Added lines #L561 - L563 were not covered by tests

return dtree

Check warning on line 565 in xradar/util.py

View check run for this annotation

Codecov / codecov/patch

xradar/util.py#L565

Added line #L565 was not covered by tests

0 comments on commit f3c28b0

Please sign in to comment.