xarray-spatial icon indicating copy to clipboard operation
xarray-spatial copied to clipboard

Simple fix: Allow for negative target elevation.

Open trygvels opened this issue 1 year ago • 2 comments

Author of Proposal:

Reason or Problem

I use the library to carry out viewshed analyses from an observer in a tall building, to see if they can see the facade of buildings around a city. However, running the viewshed function using DOM data. However, most of the visible points returned correspond to rooftops, and not actual building facades.

Proposal

To deal with this problem, it would be useful to be able to pass a negative target height, so that all other points are treated normally, but the target point has a decreased z-value.

Design: Implementing this should be simple, if I am understanding the code correctly. It should simple be a case of changing the following if statement: if target_elev > 0: to iff abs(target_elev) > 0: for the _viewshed_cpu - case.

I have done this in my local version of the code, but if you agree that this solves my issue, than it would be great if it was included in a future version.

If you want, I can also do a pull request.

trygvels avatar Oct 03 '24 09:10 trygvels

@trygvels Sorry for the late reply and thanks for the contribution

Negative target elevation sounds reasonable so I'll help to test / merge

brendancol avatar Dec 10 '24 15:12 brendancol

@trygvels hey just wanted to reiterate that would be interesting in seeing the PR you mentioned

brendancol avatar Feb 24 '25 21:02 brendancol