Moved kernel creation to name-specific functions.#127
Moved kernel creation to name-specific functions.#127brendancol merged 2 commits intoxarray-contrib:masterfrom
Conversation
|
Hell yeah! @thuydotm let me know what you think |
@chase-dwelle We should have a function name |
Changed. Agree on accepting any array-like object, but need to figure out if it would break any downstream dependencies, though assume we could just convert it to a numpy array during validation. |
|
@chase-dwelle the return of custom_kernel needs to be a numpy array for sure. @brendancol this PR looks good and ready to be merged. |
Per @thuydotm , simplified some kernel creation.
create_kernel(), now kernels are created by calling their name-specific functions. These are onlycircle_kernel()andannulus_kernel()at the moment. Custom kernels are any numpy array and therefore don't have a function, e.g.,kernel = np.ones((3, 3))._validate_kernel_shape()and replaced withvalidate_kernel(), which checks that the kernel is a numpy array and has odd dimensions. This isn't a strict requirement, but I think it makes sense to have the focal point be at the center of a kernel. Perhaps in the future we can accept custom kernels where the focal point is not centered and then pad the kernel in order to center it.