Deltares / imod-python

🐍🧰 Make massive MODFLOW models
https://deltares.github.io/imod-python/
MIT License
18 stars 3 forks source link

regrid should have an option for to_cellsize #46

Closed Manangka closed 10 months ago

Manangka commented 5 years ago

In GitLab by @tessodk on Mar 27, 2019, 16:39

like is one way of specifying what the output grid should look like, but to_cellsize is a good convenience option.

Additionally, round_extent option might be desirable.

Manangka commented 5 years ago

In GitLab by @visr on Jun 4, 2019, 15:05

For round_extent, if you mean snapping outside to rounded coordinates, we can use this code which I had lying around.

def round_extent(extent, snap, prec=None):
    """Increases the extent until all sides lie on a coordinate
    divideable by 'snap'."""
    xmin, ymin, xmax, ymax = extent
    snap = float(snap)  # prevent integer division issues
    xmin = round(np.floor(xmin / snap) * snap, prec)
    ymin = round(np.floor(ymin / snap) * snap, prec)
    xmax = round(np.ceil(xmax / snap) * snap, prec)
    ymax = round(np.ceil(ymax / snap) * snap, prec)
    return xmin, ymin, xmax, ymax
Manangka commented 4 years ago

In GitLab by @Huite on Feb 11, 2020, 16:35

I just had a somewhat painful realization: the current methods should've been named regrid_like (and also reproject_like), cf. xarray.reindex and xarray.reindex_like...

Manangka commented 11 months ago

In GitLab by @JoerivanEngelen on Oct 26, 2023, 09:20

Cleaning up the board. Developments efforts of the team are focused on the Regridder in xugrid, which will eventually replace the regridder in iMOD Python. So no extra features will be added to iMOD Python's regridder.