Skip to content

Commit

Permalink
fix rtd errors
Browse files Browse the repository at this point in the history
  • Loading branch information
OnnoEbbens committed Jan 3, 2024
1 parent 6535c4c commit 854eab1
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 15 deletions.
18 changes: 9 additions & 9 deletions docs/examples/05_caching.ipynb
Expand Up @@ -35,7 +35,7 @@
"outputs": [],
"source": [
"print(f\"nlmod version: {nlmod.__version__}\")\n",
"nlmod.util.get_color_logger(\"INFO\");"
"nlmod.util.get_color_logger(\"INFO\")"
]
},
{
Expand Down Expand Up @@ -71,7 +71,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Caching in nlmod\n",
"## Caching\n",
"\n",
"In `nlmod` you can use the `get_combined_layer_models` function to obtain a layer model based on `regis`."
]
Expand Down Expand Up @@ -141,7 +141,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## caching steps\n",
"## Caching steps\n",
"\n",
"The netCDF caching is applied to a number of functions in nlmod that have an xarray dataset as output. When you call these functions using the `cachedir` and `cachename` arguments the following steps are taken:\n",
"1. See if there is a netCDF file with the specified cachename in the specified cache directory. If the file exists go to step 2, otherwise go to step 3.\n",
Expand All @@ -156,17 +156,17 @@
"metadata": {},
"source": [
"This is the flowchart of an ordinary function call:\n",
"![image function call](img/ordinary_function_call.PNG)\n",
"![image function call](img/ordinary_function_call.png)\n",
"\n",
"This is the flowchart of a function call using the caching from nlmod:\n",
"![image cache function call](img/cache_function_call.PNG)"
"![image cache function call](img/cache_function_call.png)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### caching functions\n",
"### Caching functions\n",
"\n",
"The following functions use the caching as described above:\n",
"- nlmod.read.regis.get_combined_layer_models\n",
Expand Down Expand Up @@ -213,7 +213,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### clearing the cache\n",
"## Clearing the cache\n",
"\n",
"Sometimes you want to get rid of all the cached files to free disk space or to support your minimalistic lifestyle. You can use the `clear_cache` function to clear all cached files in a specific cache directory."
]
Expand Down Expand Up @@ -344,7 +344,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Properties\n",
"### Properties\n",
"1. All function arguments are pickled and saved together with the netcdf file. If the function arguments use a lot of memory this process can be become slow. This should be taken into account when you decide to use caching.\n",
"2. Function arguments that cannot be pickled using the `pickle` module raise an error in the caching process.\n",
"3. A function with mutable function arguments that are modified during function execution should not be used in caching. It can be used but the cache will never be used. The check on function arguments will always be False since the original function arguments are compared with the modified function argument.\n",
Expand All @@ -357,7 +357,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"#### storing cache on disk\n",
"### Storing cache on disk\n",
"\n",
"Many memoization methods use a hash of the function arguments as the filename. Thus creating multiple files for different function calls. The memoization in `nlmod` uses a user-defined filename (`cachename`) to store the cache. If the function is called with different arguments the previous cached file is overwritten. By not creating a new file for every unique set of function arguments we reduce the number of files and therefore the memory size on the disk. By saving the function output as netCDF file it is also possible to read the file seperately from the caching process. While this is not something you would often do it can help when debugging. "
]
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/10_modpath.ipynb
Expand Up @@ -41,7 +41,7 @@
"source": [
"print(f\"nlmod version: {nlmod.__version__}\")\n",
"\n",
"nlmod.util.get_color_logger(\"INFO\");"
"nlmod.util.get_color_logger(\"INFO\")"
]
},
{
Expand All @@ -50,7 +50,7 @@
"source": [
"## Groundwater Flow Model\n",
"\n",
"We use the groundwater flow model from the [03_local_grid_refinement notebook](03_local_grid_refinement). Make sure to run this notebook before you run this notebook"
"We use the groundwater flow model from the [03_local_grid_refinement notebook](03_local_grid_refinement.ipynb). Make sure to run this notebook before you run this notebook"
]
},
{
Expand Down
4 changes: 1 addition & 3 deletions nlmod/dims/base.py
Expand Up @@ -396,7 +396,7 @@ def _get_vertex_grid_ds(
yv : array_like
A 1D array of the y coordinates of the grid vertices.
cell2d : array-like
array-like with vertex grid cell2d info
array-like with vertex grid cell2d info.
extent : list
A list of [xmin, xmax, ymin, ymax] defining the extent of the model grid.
nlay : int or sequence of ints, optional
Expand Down Expand Up @@ -567,8 +567,6 @@ def get_ds(
transport : bool, optional
flag indicating whether dataset includes data for a groundwater
transport model (GWT). Default is False, no transport.
**kwargs : dict
Kwargs are passed into mbase.to_ds. These can be the model_name
or ds.
Expand Down
1 change: 1 addition & 0 deletions nlmod/read/ahn.py
Expand Up @@ -19,6 +19,7 @@
@cache.cache_netcdf
def get_ahn(ds=None, identifier="AHN4_DTM_5m", method="average", extent=None):
"""Get a model dataset with ahn variable.
Parameters
----------
ds : xr.Dataset
Expand Down
1 change: 0 additions & 1 deletion nlmod/read/knmi.py
Expand Up @@ -17,7 +17,6 @@
def get_recharge(ds, method="linear", most_common_station=False):
"""add multiple recharge packages to the groundwater flow model with knmi
data by following these steps:
1. check for each cell (structured or vertex) which knmi measurement
stations (prec and evap) are the closest.
2. download precipitation and evaporation data for all knmi stations that
Expand Down

0 comments on commit 854eab1

Please sign in to comment.