UCL / pyCascadia

Implementation of GEBCO cookbook remove-restore and other cleaning of topography/bathymetry. Uses `pyGMT`.
Mozilla Public License 2.0
9 stars 0 forks source link

Bugfix/increment mismatch #76

Closed alessandrofelder closed 2 years ago

alessandrofelder commented 2 years ago

Previously, the grid.resample function would not guarantee that the resampled grid had the exact user-specified spacing. This is because gmt grdsample would by default guarantee the specified region (and slightly adapt the spacing accordingly). This caused pyCascadia problems down the line, specifically when using interpolation to calculate the difference grid, which relies on knowing the spacing.

An alternative solution might be to store the spacing returned by grdsample in our grid class, and use that going forward. I will ask @dimitrasal for preferences.

alessandrofelder commented 2 years ago

@dimitrasal prefers to guarantee the spacing at the expense of a slightly larger domain, when resampling happens.

alessandrofelder commented 2 years ago

Yes, that is correct. Documented in the grdsample docs as

-Ix_inc[+e|n][/y_inc[+e|n]] ... +e to slightly adjust the max x (east) or y (north) to fit exactly the given increment if needed [Default is to slightly adjust the increment to fit the given domain].