-
Notifications
You must be signed in to change notification settings - Fork 5
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
Opening Angle method optimizations and organization #144
Merged
Conversation
This file contains 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
…izing in terms of min_disksize and step between disks.
…ction to be land pixels (consistent with the paper).
…s looping over 360 degrees. Split extra calculation of angles of shorelines into an optional way to process the angles from the same function, so now only returns a single obj, and the old behavior is achieved with two separate calls to the function.
…ptions to specify the query and test sets, and also allows the user to specify numviews. Previously numviews had no effect on the result. Now, numviews is treated in accordance with the p term in the original paper. up to p largest views are summed to give the result. Default choice is 1, however, whereas numviews=3 is consistent with p=3 in the paper.
…/functionality will be more difficult.
…es. Change the mehtod for edge detection -- this new method accurately includes strips of land a single pixel across, which were previously being missed by the gradient-based detection.
…entation, all params documented.
…) lead to the inlet not being marked as land when there is no delta built yet.
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.
overview
Significant optimizations and organizations applied to the opening angle method. This is a breaking PR, because it fixes several bugs within the implementation. These bugs likely did not affect the results of any work relying on the computations, but were points where the code was inconsistent with intention (e.g., off-by-one errors).
changes
This PR also changes some default options to be consistent with the paper in some places, but optimized for speed and clarity in others.
dm.plan.shaw_opening_angle_method()
with optional parameterquery_set=lwi
(land-water interface).numviews
is changed to 1. This provides acceptable results in nearly all circumstances, with a significant advantage of speed. Support is maintained to usenumviews=3
, which is consistent with the original paper. Note, the old implementation was never using more than a single view; this PR fixes this, so that the opening angle is the sum of thenumviews
largest view angles.speed
Speed also seems to be improved. In a simple example using the
golf
data and default options, the compute time is reduced from 0.79 to 0.28 seconds (excluding jit compile time!). The same test on this PR withnumviews=3
is 0.43 seconds, due to an extra necessary call tonp.sort
.PR also implements optional parallelization on the opening angle method calculation. Default is no parallelization, and an optional integer argument specifies the number of threads to use in computation. Parallelization here induces pretty low overhead for a smallish number of cores; therefore 2 cores -> ~2x speedup; 4 cores -> ~4x speedup.
I expect, but have not verified, that these benefits play out the same on larger data processing (e.g., timeseries with higher resolution data).