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

Create nlmod Datasets from flopy modelgrids #169

Merged
merged 10 commits into from
May 9, 2023
Merged

Conversation

dbrakenhoff
Copy link
Collaborator

Add functionality to create datasets from flopy modelgrids.

Usage:

gwf = sim.get_model("model")  # given some existing flopy MFSimulation + model

ds = nlmod.grid.modelgrid_to_ds(gwf.modelgrid)  # convert to Dataset

# add data from flopy
ds["k"] = ("layer", "cell2d"), gwf.npf.k.array

Perhaps this can serve as a base for future more complete nlmod.read.flopy functionality?

- get_structured_grid_ds: create a structured grid DataSet
- get_vertex_grid_ds: create a vertex grid Dataset
- allow creation of datasets based on flopy modelgrid objects
- supports both vertex and structured grid
- add gridtype attr
- improve reading grids at real-world coords
- set delr/delc for structured grids
add correct x,y-offsets
@dbrakenhoff
Copy link
Collaborator Author

@rubencalje, any idea what's causing the test failure?

@rubencalje
Copy link
Collaborator

@rubencalje, any idea what's causing the test failure?

I have no idea. Maybe fiona is updated. I would ignore it for now.

@rubencalje
Copy link
Collaborator

@rubencalje, any idea what's causing the test failure?

I have no idea. Maybe fiona is updated. I would ignore it for now.

Geopandas updated to version 0.13.0 on may 6, which is probably the reason of the failure. I will look for a fix.

@rubencalje
Copy link
Collaborator

@rubencalje, any idea what's causing the test failure?

I have no idea. Maybe fiona is updated. I would ignore it for now.

@rubencalje, any idea what's causing the test failure?

I have no idea. Maybe fiona is updated. I would ignore it for now.

Geopandas updated to version 0.13.0 on may 6, which is probably the reason of the failure. I will look for a fix.

I fixed this in my pull-request #174, so you can ignore it here.

@rubencalje
Copy link
Collaborator

I have two comments:

  • should we make get_structured_grid_ds and get_vertex_grid_ds internal methods, or do we want users to call them directly?
  • should cell2d not be an argument of get_vertex_grid_ds? The handling of cell2d is performed in modelgrid_to_ds, so get_vertex_grid_ds does not create a fully functioning model-ds, where the vertices are connected to the cells.

@dbrakenhoff dbrakenhoff merged commit b662e4b into dev May 9, 2023
@dbrakenhoff dbrakenhoff deleted the ds_from_modelgrids branch May 9, 2023 07:13
@dbrakenhoff
Copy link
Collaborator Author

@rubencalje Good suggestions, I'll push those directly to dev as soon as i manage to merge #170.

1 similar comment
@dbrakenhoff
Copy link
Collaborator Author

@rubencalje Good suggestions, I'll push those directly to dev as soon as i manage to merge #170.

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.

2 participants