Conversation
This is a rought implementation that returns almost the correct shadow image. There is still some work to be done. The output needs to be returned as a series instead of an image and steps should be taken to minimize memory use, especially in the _clean_wires() function, by passing ndarrays rather than allocating a new array for every step. Currently this implementation appears to be more sensitive than the matlab version, and includes more remnants of clouds in the output.
Initially adds basic tests for data without any fixed shadows.
In the remove_pillars step the masks were passed in the wrong order.
This is consistent with the comments in the original matlab code, although it is not 100% clear to me that it matches the implementation. Since it produces results that are closer to the output (in addition to matching the comments) from the MATLAB code, I will assume that my reading of the original implementation was not correct.
Changes to better match the original implementation. Still not completely sure that this correct though.
Rather than applying it on successively more cleaned up images.
This should be slightly more efficient, plus it matched the intent of the code better. Also updates name of structuring element to match its shape
Converts the image back to a series and re-indexes it like the input series.
|
@cwhanse I've pretty much got the Matlab version ported over. This version does not seem to do quite as good a job removing cloud shadows that are "connected" to wires in the demo data from PVLIB_MATLAB. If you have a little time, I would appreciate a second pair of eyes on the Still some work to do on tests and performance. As it stands it is pretty slow, but there are some obvious places for performance improvement (notably in the |
cwhanse
left a comment
There was a problem hiding this comment.
It looks well structured and readable. Do we want to add a test that produces an image similar to the output of the matlab code?
Co-authored-by: Cliff Hansen <cwhanse@sandia.gov>
Adds a better docstring for the returned series.
Following NEP 29, we can now require at least 0.24.0 which was released 24 months ago.
Without specifying an output array the image processing and numpy functions will allocate a new array for every operation. This can be a very expensive operation; fortunately we can avoid it by using a temporary array for the morphological operations and specifying an output array for the resulting image with horizontal bars removed.
Improves performance by reducing the number of new arrays that must be allocated.
|
@cwhanse I think this is ready for a closer look. The test failure is in the |
|
I verified that the structuring elements used in |
Add image to return values
Co-authored-by: Cliff Hansen <cwhanse@sandia.gov>
Description
This is a port of the pvl_detect_shadows function from MATLAB_PVLIB.
Checklist
docs/api.rstin
docs/whatsnewfor all changes. Includes link to the GitHub Issue with
:issue:`num`or this Pull Request with
:pull:`num`. Includes contributor nameand/or GitHub username (link with
:ghuser:`user`).