Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce a checkbox to resample non-equidistant grids to equidistant. #81

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Huite
Copy link
Contributor

@Huite Huite commented Jul 25, 2024

This allows loading of non-equidistant grids.

This is also more robust for when grids are nearly equidistant (within 0.1%).

By default, non-equidistant grids are not resampled; the checkbox is not ticked.

@Huite Huite requested a review from JoerivanEngelen July 25, 2024 12:58
@Huite
Copy link
Contributor Author

Huite commented Jul 25, 2024

Interface change is very minor:

image

@Huite
Copy link
Contributor Author

Huite commented Jul 25, 2024

The ValueError is caught and shown via a MessageBox:

image

@Huite
Copy link
Contributor Author

Huite commented Jul 25, 2024

A simple test-case can be setup with:

import xarray as xr
import imod

# %%

da = xr.DataArray(
    data=[[1, 2], [3, 4]],
    coords={
        "y": [13.0, 10.5],
        "x": [0.5, 3.0],
        "dy": ("y", [-4.0, -1.0]),
        "dx": ("x", [1.0, 4.0]),
    },
    dims=("y", "x"),
)
# %%


imod.idf.save("simple.idf", da)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant