coecms / xmhw

Xarray version of Marine Heatwaves code by Eric Olivier
https://xmhw.readthedocs.io/en/latest/
Apache License 2.0
22 stars 10 forks source link

Check parity of w in runavg #5

Closed ccarouge closed 4 years ago

ccarouge commented 4 years ago

Add an assertion to ensure w is odd as input.

paolap commented 4 years ago

Since the smoothing window is passed as constraints in threshold function I put the check for that that and windowHalfWidth at the start of the function. So a user gets notified straight on. I'm using an exception rather than assert. So for the moment I won't merge this, but maybe we could still add the assert at the single functions level and potentially in other part of the code so I'll leave it open

paolap commented 4 years ago

Added exception also to rung function in case we use it elsewhere, added tests for both