Skip to content

Commit

Permalink
Merge pull request #11 from TerrainBento/barnhark/update_after_refactor
Browse files Browse the repository at this point in the history
Barnhark/update after refactor
  • Loading branch information
kbarnhart committed Jan 31, 2019
2 parents 9111ab4 + 283ae1a commit c3aabd5
Show file tree
Hide file tree
Showing 13 changed files with 855 additions and 3,189 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
env:
matrix:
- TRAVIS_PYTHON_VERSION="2.7"
- TRAVIS_PYTHON_VERSION="3.5"
- TRAVIS_PYTHON_VERSION="3.6"
- TRAVIS_PYTHON_VERSION="3.7"
global:
- CONDA_PREFIX=$HOME/miniconda
- MINICONDA_URL_BASE="https://repo.continuum.io/miniconda/Miniconda3-latest"
Expand Down Expand Up @@ -38,8 +38,8 @@ install:
- conda install scripting -c csdms-stack
- |
if [[ "$TRAVIS_BRANCH" == "release" ]]; then
conda install landlab -c landlab
conda install terrainbento -c terrainbento
conda install landlab -c conda-forge
conda install terrainbento -c conda-forge
else
pushd ../..
git clone --depth=50 https://github.com/landlab/landlab.git landlab/landlab
Expand Down
32 changes: 15 additions & 17 deletions Welcome_to_TerrainBento.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"\n",
"You have just cloned the `examples_test_and_tutorials` repository for the terrainbento multi-model package. Congratulations! \n",
"\n",
"If you are interested in reading about the details of terrainbento, this package is described in the following OpenAccess manuscript [LINK TO MANUSCRIPT].\n",
"If you are interested in reading about the details of terrainbento, this package is described in [Barnhart et al. (2019)](https://www.geosci-model-dev-discuss.net/gmd-2018-204/).\n",
"\n",
"The documentation for the package is provided [here](http://terrainbento.readthedocs.io/en/latest/).\n",
"\n",
Expand All @@ -22,9 +22,9 @@
"\n",
"The simplest model, called Basic, evolves topography using stream power and linear diffusion. It has the following governing equation:\n",
"\n",
"$\\frac{\\partial \\eta}{\\partial t} = - KA^{1/2}S + D\\nabla^2 \\eta$\n",
"$\\frac{\\partial \\eta}{\\partial t} = - KQ^{1/2}S + D\\nabla^2 \\eta$\n",
"\n",
"Other models modify Basic by adding or changing a process component. \n",
"where $K$ and $D$ are constants, $Q$ is discharge, $S$ is local slope, and $\\eta$ is the topography. Other models modify Basic by adding or changing a process component and changing the governing equation. See the [model Basic documentation](https://terrainbento.readthedocs.io/en/latest/source/terrainbento.derived_models.model_basic.html) for additional information. \n",
"\n",
"## Example usage\n",
"\n",
Expand All @@ -34,51 +34,49 @@
" \n",
"2) [Introduction to boundary conditions in terrainbento](http://localhost:8888/notebooks/example_usage/introduction_to_boundary_conditions.ipynb)\n",
" \n",
"3) [Introduction to OutputWriters in terrainbento](http://localhost:8888/notebooks/example_usage/introduction_to_output_writers.ipynb). \n",
"3) [Introduction to output writers in terrainbento](http://localhost:8888/notebooks/example_usage/introduction_to_output_writers.ipynb). \n",
" \n",
"\n",
"## Example Coupled Models\n",
"\n",
"This section provides links to five notebooks that show the usage of five example models provided in terrainbento. In each of these notebooks we provide the governing equation(s) for the model, initialize and run the model, make a slope-area plot, save a NetCDF of the final topography, and plot a image of the final topography. \n",
"\n",
"1) [Basic](http://localhost:8888/notebooks/coupled_process_elements/model_000_COUPLED_steady_solution.ipynb) the simplest landscape evolution model in the terrainbento package.\n",
"1) [Basic](http://localhost:8888/notebooks/coupled_process_elements/model_basic_steady_solution.ipynb) the simplest landscape evolution model in the terrainbento package.\n",
"\n",
"2) [BasicVm](http://localhost:8888/notebooks/coupled_process_elements/model_001_COUPLED_steady_solution.ipynb) which permits the drainage area exponent to change\n",
"2) [BasicVm](http://localhost:8888/notebooks/coupled_process_elements/model_basic_var_m_steady_solution.ipynb) which permits the drainage area exponent to change\n",
"\n",
"3) [BasicCh](http://localhost:8888/notebooks/coupled_process_elements/model_040_COUPLED_steady_solution.ipynb) which uses a non-linear hillslope erosion and transport law\n",
"3) [BasicCh](http://localhost:8888/notebooks/coupled_process_elements/model_basicCh_steady_solution.ipynb) which uses a non-linear hillslope erosion and transport law\n",
"\n",
"4) [BasicVs](http://localhost:8888/notebooks/coupled_process_elements/model_200_COUPLED_steady_solution.ipynb) which uses variable source area hydrology\n",
"4) [BasicVs](http://localhost:8888/notebooks/coupled_process_elements/model_basicVs_steady_solution.ipynb) which uses variable source area hydrology\n",
"\n",
"5) [BasisRt](http://localhost:8888/notebooks/coupled_process_elements/model_800_COUPLED_steady_solution.ipynb) which allows for two lithologies with different K values"
"5) [BasisRt](http://localhost:8888/notebooks/coupled_process_elements/model_basicCh_steady_solution.ipynb) which allows for two lithologies with different K values"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"display_name": "Python 3",
"language": "python",
"name": "python2"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.14"
"pygments_lexer": "ipython3",
"version": "3.6.8"
}
},
"nbformat": 4,
Expand Down
145 changes: 72 additions & 73 deletions coupled_process_elements/model_basicCh_steady_solution.ipynb

Large diffs are not rendered by default.

172 changes: 91 additions & 81 deletions coupled_process_elements/model_basicRt_steady_solution.ipynb

Large diffs are not rendered by default.

152 changes: 79 additions & 73 deletions coupled_process_elements/model_basicVs_steady_solution.ipynb

Large diffs are not rendered by default.

144 changes: 74 additions & 70 deletions coupled_process_elements/model_basic_steady_solution.ipynb

Large diffs are not rendered by default.

137 changes: 69 additions & 68 deletions coupled_process_elements/model_basic_var_m_steady_solution.ipynb

Large diffs are not rendered by default.

124 changes: 124 additions & 0 deletions coupled_process_elements/readme_example.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"from terrainbento import Basic\n",
"\n",
"params = {\n",
" # create the Clock.\n",
" \"clock\": {\"start\": 0, \n",
" \"step\": 10,\n",
" \"stop\": 1e5},\n",
" \n",
" # Create the Grid.\n",
" \"grid\": {\"grid\": {\"RasterModelGrid\":[(200, 320), {\"xy_spacing\": 10}]},\n",
" \"fields\": {\"at_node\": {\"topographic__elevation\":{\"random\":[{\"where\":\"CORE_NODE\"}]}}}},\n",
" \n",
" # Set up Boundary Handlers\n",
" \"boundary_handlers\":{\"NotCoreNodeBaselevelHandler\": {\"modify_core_nodes\": True, \n",
" \"lowering_rate\": -0.001}},\n",
" # Parameters that control output.\n",
" \"output_interval\": 1e3, \n",
" \"save_first_timestep\": True,\n",
" \"fields\":[\"topographic__elevation\"],\n",
" \n",
" # Parameters that control process and rates.\n",
" \"water_erodability\" : 0.001,\n",
" \"m_sp\" : 0.5,\n",
" \"n_sp\" : 1.0, \n",
" \"regolith_transport_parameter\" : 0.2, \n",
" }\n",
"\n",
"model = Basic.from_dict(params)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"model.run()"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<Figure size 432x288 with 0 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from landlab import imshow_grid\n",
"\n",
"filenames = []\n",
"ds = model.to_xarray_dataset()\n",
"for i in range(ds.topographic__elevation.shape[0]):\n",
" filename = \"temp_output.\"+str(i)+\".png\"\n",
" imshow_grid(model.grid, \n",
" ds.topographic__elevation.values[i, :, :], \n",
" cmap=\"viridis\", \n",
" limits=(0, 12), \n",
" output=filename)\n",
" filenames.append(filename)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"import imageio\n",
"with imageio.get_writer(\"terrainbento_example.gif\", mode=\"I\") as writer:\n",
" for filename in filenames:\n",
" image = imageio.imread(filename)\n",
" writer.append_data(image)\n",
" os.remove(filename)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"model.remove_output_netcdfs()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.8"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Loading

0 comments on commit c3aabd5

Please sign in to comment.