From 854eab19683f001285a3491a20ddfea3cc361ef5 Mon Sep 17 00:00:00 2001 From: OnnoEbbens Date: Wed, 3 Jan 2024 14:18:07 +0100 Subject: [PATCH] fix rtd errors --- docs/examples/05_caching.ipynb | 18 +++++++++--------- docs/examples/10_modpath.ipynb | 4 ++-- nlmod/dims/base.py | 4 +--- nlmod/read/ahn.py | 1 + nlmod/read/knmi.py | 1 - 5 files changed, 13 insertions(+), 15 deletions(-) diff --git a/docs/examples/05_caching.ipynb b/docs/examples/05_caching.ipynb index 1494ff56..0c705248 100644 --- a/docs/examples/05_caching.ipynb +++ b/docs/examples/05_caching.ipynb @@ -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\")" ] }, { @@ -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`." ] @@ -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", @@ -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", @@ -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." ] @@ -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", @@ -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. " ] diff --git a/docs/examples/10_modpath.ipynb b/docs/examples/10_modpath.ipynb index 0d0b2b33..c70458cf 100644 --- a/docs/examples/10_modpath.ipynb +++ b/docs/examples/10_modpath.ipynb @@ -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\")" ] }, { @@ -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" ] }, { diff --git a/nlmod/dims/base.py b/nlmod/dims/base.py index f166f139..76a6e006 100644 --- a/nlmod/dims/base.py +++ b/nlmod/dims/base.py @@ -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 @@ -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. diff --git a/nlmod/read/ahn.py b/nlmod/read/ahn.py index 3f7a1f96..c2444e79 100644 --- a/nlmod/read/ahn.py +++ b/nlmod/read/ahn.py @@ -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 diff --git a/nlmod/read/knmi.py b/nlmod/read/knmi.py index 9499817f..512f34a1 100644 --- a/nlmod/read/knmi.py +++ b/nlmod/read/knmi.py @@ -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