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

Multiple improvements #289

Merged
merged 20 commits into from
Nov 21, 2023
Merged

Multiple improvements #289

merged 20 commits into from
Nov 21, 2023

Conversation

rubencalje
Copy link
Collaborator

@rubencalje rubencalje commented Nov 14, 2023

This pull request does the following:

  • All layer models in nlmod will no longer have a layer dimension in the top, see issue Always use Modflow way of storing layers (no 3d top in layer Datasets anymore) #270. So when you download regis, NaN's in top and bottom (where the layer does not occur) will be filled by overlying and underlying layers with data, and only the top of the entire model and the bottom of each layer is stored.
  • It speeds up the filling of tops and bottoms (mentioned as comment by Onno in issue Improve nlmod.layers.fill_top_and_bottom() #275)
  • extrapolate_ds accepts a layer argument, so you can use it for geotop data as well
  • fix a bug in extrapolate_ds for 2d (non-layered) data
  • add "concentration" to perioddata of buyuoncy package, to correctly account for density in modflow packages of boundary conditions (drn, ghb, riv)
  • add nlmod.plot.geotop_lithok_on_map (tested in tests/test_002_regis_geotop.py)
  • change url of webservices of Wetterkip Fryslan and Noorderzijlvest
  • update test of download of surface water data from Fryslan to HHNK as this webservice of Fryslan is broken
  • update modpath excecutable

So the most important change is the first: nlmod.read.get_regis(extent) will return a Dataset without a layer dimension in the variable top (which can be overridden by setting drop_layer_dim_from_top to False by the way). Does everybode agree?

Update modpath executable
Add nlmod.plot.geotop_lithok_on_map()
Add "concentration" to perioddata in nlmod.gwf.buy()
Add optional "layer" argument to extrapolate_ds, so you can use method for geotop-data with layer="z" as well
See comment from Onno in issue #275
…in top of regis and geotop

And fix codacy issue
And fix some tests
Fix extrapolate_ds for 2d-data-arrays
@rubencalje rubencalje marked this pull request as ready for review November 16, 2023 16:46
Copy link
Collaborator

@dbrakenhoff dbrakenhoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Two comments to discuss:

  • one about the naming of the fill_top_and_bottom() method and what it does.
  • can we think of names for the two layer model data models that we can reference by name, and explain somewhere in the documentation. e.g. "full-3D layer model" and "Modflow layer model". Maybe we can also use those names in our function names convert_to_modflow_layermodel and convert_to_3d_layermodel(). And in that explanation we should show how inactive zones can be derived from the thickness attribute. Come to think of it we should maybe add a method, get_active_domain(ds, layer=None).

Anyway, those were my thoughts.

nlmod/dims/layers.py Outdated Show resolved Hide resolved
return qm


def _add_geotop_lithok_legend(lithok_props, ax, lithok=None, **kwargs):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docstring :)?

return ax.legend(handles=handles, **kwargs)


def _get_geotop_cmap_and_norm(lithok, lithok_props):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docstring?

nlmod/read/geotop.py Outdated Show resolved Hide resolved
nlmod/read/regis.py Outdated Show resolved Hide resolved
nlmod/read/regis.py Show resolved Hide resolved
)

# make sure the total thickness of the two models is equal (does not assert to True yet)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is that... ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea yet... It is a difference of 0.125 if I sum the total thickness. I have no idea where this comes from.

ds2["botm"].loc[new_layer].data[mask] == ds1["botm"].loc[layer].data[mask]
).all()

# make sure the top of the new layer is euqal to the top of the original layer
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment typo, euqal

Copy link
Collaborator

@dbrakenhoff dbrakenhoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add

  • convert_to_modflow_layermodel(), alias for remove_layer_dim_from_top + remove NaNs
  • convert_to_regis_layermodel(), alias for add_layer_dim_to_top + add NaNs

plot_test(regis, regis_split, colors=colors)


def test_add_layer_dim_to_top():
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add some check here?

@@ -450,13 +450,17 @@ def facet_plot(
if iper is None:
raise ValueError("Pass 'period' to select timestep to plot.")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be iper?

@rubencalje rubencalje removed the request for review from OnnoEbbens November 21, 2023 13:08
@rubencalje rubencalje merged commit 23d9926 into dev Nov 21, 2023
2 of 3 checks passed
@rubencalje rubencalje deleted the multiple_improvements branch November 21, 2023 13:09
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