brmather / pycurious

Python package for computing the Curie depth from the magnetic anomaly
https://brmather.github.io/pycurious/
GNU Lesser General Public License v3.0
38 stars 17 forks source link

[REVIEW] Raise error if window is too big #16

Closed santisoler closed 5 years ago

santisoler commented 5 years ago

Part of https://github.com/openjournals/joss-reviews/issues/1544.

When extracting a subgrid, an error is raised if its center falls outside the data range: https://github.com/brmather/pycurious/blob/759fc520c22503f0b40b6a63faa4e632dd9f1e88/pycurious/grid.py#L96-L98

That's a nice thing to check! I would add another check: if the window is too big it may reach regions beyond the data range, what may cause errors afterwards but would be hard to track where they were originated. What do you think?

brmather commented 5 years ago

This makes sense. I have also received suggestions to pad the subgrid with zeros if the window size exceeds the grid extent, but I think this will result in quite significant errors. Therefore I am happy to implement this check in 2896c0e301237317f3b5ba8952b6f990a3b10df3. I am closing this issue now, but feel free to reopen it if you have more queries.