Comments (5)
I have a suggestion for an alternative approach, which might even co-exist and might not be mutual excusive.
What about that every function that makes use of model_ds
starts with a list that contains which data_vars
and coords
it uses from model_ds
. More or less similar to what __slots__
is to modules, which announces which methods are available from the module/class. Right after defining this list, we call a checking function that has model_ds and the list as arguments. That function checks if all vars are already part of model_ds or, if not, provides hints for which functions/example notebooks can be used to generate those vars. I see two advantages over your suggestion:
- We can centralize the hints in a single function.
- I think we should stick close to the model_ds for generating the packages, and put as much in model_ds as is needed to generate those packages. Your approach allows for flexibility, but is that flexibility needed/desired?
The parameter descriptions you just gave, are great to put in the attrs of each corresponding data_vars, and of cours in the hints of the checking function.
What is your take on this?
from nlmod.
I'm not entirely sure, but isn't there a way to document it slightly different?
def ghb_from_model_ds(model_ds, gwf, da_name):
"""get general head boundary from model dataset.
Parameters
----------
model_ds : xarray.Dataset
dataset with model data.
gwf : flopy ModflowGwf
groundwaterflow object.
da_name : str
name of the ghb files in the model dataset.
Model_ds data_vars
-----------
ghb_cond : xarray.DataArray or None, optional
dataarray with the conductivity of the ghb. All non-zero cells are used
as ghb cells. If None the function argument model_ds should be defined.
Default is None
ghb_stage : xarray.DataArray or None, optional
dataarray with the stage of the ghb. If None the function argument
model_ds should be defined. Default is None
gridtype : str or None, optional
can be 'structured' or 'vertex'. If None the function argument model_ds
should be defined. Default is None
only_first_active_layer : bool, optional
if True only the ghb is only added to the first active layer in the
model. Default is True
first_active_layer : xarray.DataArray or None, optional
dataarray with for each cell the first active layer. Only necesarry
when use_first_active_layer is True. Default is None
only_active_cells : bool, optional
if True ghb cells are only to cells with an idomain of 1. Default is
False.
idomain : xarray.DataArray or None, optional
dataarray with the idomain. Only necesarry
when only_active_cells is True. Default is None
Returns
-------
....
Would something like that be allowed in the documentation standard we're using?
from nlmod.
I like your solution a lot and I think this the way to go.
When I tried to implement my original plan I didn't like all the function arguments with the default None
value. I think it makes the function less readable.
from nlmod.
Use DataArray source attribute to indicate source of data and maybe log (DEBUG level) when writing MF6 packages where data is coming from.
Linked to #48
from nlmod.
Solved by PR #188
from nlmod.
Related Issues (20)
- grid refinement with shapefile HOT 2
- AHN3 wcs niet langer beschikbaar
- HHNK peilgebieden rest not working HOT 2
- calculate_resistance calculates resistance between layers HOT 2
- test run on 'push' confusing
- tqdm progressbar output messy in documentation HOT 6
- UZF-notebook does not contain right output
- Move parts of webservices.py to waterboards.py HOT 1
- Hollands Noorderkwartier arcgis server is now secured and is not accessible by nlmod HOT 3
- nlmod.plot.modelgrid resets axes limits
- Change the way we write nlmod in the documentation and publications to NLmod
- Creating empty packages results in unguided errors HOT 3
- HHNK peilgebieden URL not working HOT 1
- Error in 'get_recharge' HOT 1
- feature: stacked box-plots for some parameter per layer with zonal mask option
- resample methods in to_model_ds HOT 1
- Not all files are installed HOT 1
- Remove delr/delc from dataset
- remove gridtype from dataset attributes HOT 2
- Remove explicit download of executables command from examples
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nlmod.