Closed aladinor closed 10 months ago
@aladinor Empty rays might happen if the original data is further away than the tolerance.
Should we make the tolerance more prominent in the reindex_angle
-docstring or examples?
@kmuehlbauer The way that I think we can handle this is to make tolerance more prominent, as you mentioned. In utils.py
#L189 tolerance is defined as resolution / 2.0
. I would make it resolution / 1.75
either by default value or by pointing it in the docstring or documentation.
This is how I solved it without any source code modification
def fix_angle(ds, tol=None):
angle_dict = xd.util.extract_angle_parameters(ds)
# display(angle_dict)
start_ang = angle_dict["start_angle"]
stop_ang = angle_dict["stop_angle"]
angle_res = angle_dict["angle_res"]
direction = angle_dict["direction"]
tol = angle_res / 1.75 ### <--------------------- here
# first find exact duplicates and remove
ds = xd.util.remove_duplicate_rays(ds)
# second reindex according to retrieved parameters
ds = xd.util.reindex_angle(
ds, start_ang, stop_ang, angle_res, direction, method="nearest",
tolerance=tol
)
return ds
@aladinor I'm hesitant to change it to values > angle_res/2. From the assumption that the angle_res is more or less comparable to actual beam width it means that there is at least the beam edge on the new angle.
Instead I'm suggesting to check if we get NaN rays and issue a warning. Then the user can take measures to resolve.
Another solution would be to check actual beam width and angle_res and try to calculate a decent value from that to make sure the above assumptions are fulfilled.
Maybe we should set up some test case with artificial values and try to work along until we are happy.
Sorry @kmuehlbauer for my late reply. I think we don't need to change any default value since we can pass the tolerance parameter to xd.util.reindex_angle
method. Thanks for your time!
Hi everyone,
I am working with angle reindexing, and after doing some tests, I noticed that I got empty rays.
The output is this![empty_rays](https://github.com/openradar/xradar/assets/18624932/903db009-d1f9-4c53-9da2-4943aa8effa8)
Diggin around, I realized that in
xd.util.reindex_angle
method, we can specify the tolerance that by default isangle_res / 2.0
. For this specific example, the default tolerance is0.25
. If I change the tolerance to0.26
it will handle the empty rays as follows.Please let me know your comments.
Alfonso