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

Make default layer names in get_ds zero-based. #186

Closed
OnnoEbbens opened this issue Jun 5, 2023 · 1 comment
Closed

Make default layer names in get_ds zero-based. #186

OnnoEbbens opened this issue Jun 5, 2023 · 1 comment

Comments

@OnnoEbbens
Copy link
Collaborator

When you create a model dataset with 3 layers using nlmod.get_ds the layers are named 1, 2, 3 by default. I propose to use the Python zero-based approach and name them 0, 1, 2.

I encountered this when trying to add DataArrays to a dataset using the steps below. It took me ages to find out what was happening.

  1. I create a model dataset with 3 layers using get_ds. The layers are numbered 1, 2, 3
  2. I create and run a model using the dataset
  3. I use nlmod.gwf.get_budget_da to get the budget data array using the gwf object. This returns a DataArray with the layers numbered 0, 1, 2 because it does not know the layer numbering in the dataset.
  4. I add the DataArray from step 3 to the dataset of step 1. The first layer is removed from the DataArray and a layer with only nan's is appended at the end.
OnnoEbbens added a commit that referenced this issue Jun 5, 2023
@rubencalje
Copy link
Collaborator

The naming 1, 2, 3 was chosen so that titles in figures are one-based ('layer 1' for the first layer). But your example shows this can cause strange errors. Therefore making layer zero-based is probably better.

rubencalje added a commit that referenced this issue Jun 7, 2023
* fix for #186

* Update 00_model_from_scratch.ipynb

---------

Co-authored-by: Ruben Caljé <r.calje@artesia-water.nl>
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

No branches or pull requests

2 participants