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] Notebook is raising an error #29

Closed santisoler closed 5 years ago

santisoler commented 5 years ago

On Ex5-Mapping-Curie-depth-EMAG2.ipynb an error is raised when running the following cell:

grid = pycurious.CurieOptimise(mag_grid, xmin, xmax, ymin, ymax)

window_size = 400e3

# centroid spacing of 50 km
xc_list, yc_list = grid.create_centroid_list(window_size, spacingX=50e3, spacingY=50e3)
print("number of centroids = {}".format(len(xc_list)))

beta, zt, dz, C = grid.optimise_routine(window_size, xc_list, yc_list)

>>> ValueError: node spacing should be identical (1000.5265929436546, 1000.5885815185403)

Seems that when creating the grid, the nodes are not equally spaced between two axis.

brmather commented 5 years ago

Ah this is an unexpected consequence of #14. Previously, we set a tolerance of 1.0:

abs(dx - dy) > 1.0

but now that we use np.allclose, I've fixed this issue with:

np.allclose(dx, dy, 1.0)