Skip to main content

TerrainBento suite of landscape evolution models

Project description

CI Status Coverage Docs License Health Style DOI
Build Status Build status Coverage Status Documentation Status License: MIT Code Health Codacy Badge Code style: black DOI
Name Downloads Version Platforms
Conda Recipe Conda Downloads Conda Version Conda Platforms

terrainbento

A modular landscape evolution modeling package built on top of the Landlab Toolkit.

terrainbento"s User Manual is located at our Read The Docs page.

We recommend that you start with this set of Jupyter notebooks that introduce terrainbento and the model description paper Barnhart et al. (2019).

A quick example

The following is all the code needed to run the Basic model. There are a few different options available to create a model, here we will create one from a file-like object. The string will contain the same information as a YAML style input file that specifies the model construction and run.

from terrainbento import Basic

params = {
    # create the Clock.
    "clock": {"start": 0,
              "step": 10,
              "stop": 1e5},

    # Create the Grid
    "grid": {
        "RasterModelGrid": [
            (200, 320),
            {
                "xy_spacing": 10
            },
            {
                "fields": {
                    "node": {
                        "topographic__elevation": {
                            "random": [{
                                "where": "CORE_NODE"
                            }]
                        }
                    }
                }
            },
        ]
    },

    # Set up Boundary Handlers
    "boundary_handlers":{"NotCoreNodeBaselevelHandler": {"modify_core_nodes": True,
                                                         "lowering_rate": -0.001}},
    # Parameters that control output.
    "output_interval": 1e3,
    "save_first_timestep": True,
    "fields":["topographic__elevation"],

    # Parameters that control process and rates.
    "water_erodibility" : 0.001,
    "m_sp" : 0.5,
    "n_sp" : 1.0,
    "regolith_transport_parameter" : 0.2,           
         }

model = Basic.from_dict(params)
model.run()

Next we make an image for each output interval.

from landlab import imshow_grid

filenames = []
ds = model.to_xarray_dataset()
for i in range(ds.topographic__elevation.shape[0]):
    filename = "temp_output."+str(i)+".png"
    imshow_grid(model.grid, ds.topographic__elevation.values[i, :, :], cmap="viridis", limits=(0, 12), output=filename)
    filenames.append(filename)
model.remove_output_netcdfs()

Finally we compile the images into a gif.

import os
import imageio
with imageio.get_writer("terrainbento_example.gif", mode="I") as writer:
    for filename in filenames:
        image = imageio.imread(filename)
        writer.append_data(image)
        os.remove(filename)

Example terrainbento run

Installation instructions

Before installing terrainbento you will need a python distribution. We recommend that you use the Anaconda python distribution. Unless you have a specific reason to want Python 2.7 we strongly suggest that you install Python 3.7 (or the current 3.* version provided by Anaconda).

Using conda

To install the release version of terrainbento (this is probably what you want) open a terminal and execute the following:

conda config --add channels conda-forge
conda install terrainbento

From source code

To install the terrainbento source code version of terrainbento do the following:

Option A: You already have landlab installed (either through conda or through the source code)

git clone https://github.com/TerrainBento/terrainbento.git
cd terrainbento
conda install --file=requirements.txt
python setup.py install

Option B: You do not have landlab installed

conda config --add channels conda-forge
conda install landlab
git clone https://github.com/TerrainBento/terrainbento.git
cd terrainbento
conda install --file=requirements.txt
python setup.py install

A note to developers

If you plan to develop with terrainbento, please fork terrainbento, clone the forked repository, and replace python setup.py install with python setup.py develop. If you have any questions, please contact us by making an Issue.

How to cite

Barnhart, K. R., Glade, R. C., Shobe, C. M., and Tucker, G. E.: Terrainbento 1.0: a Python package for multi-model analysis in long-term drainage basin evolution, Geosci. Model Dev., 12, 1267-1297, https://doi.org/10.5194/gmd-12-1267-2019, 2019.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

terrainbento-1.1b3-py3-none-any.whl (253.2 kB view details)

Uploaded Python 3

File details

Details for the file terrainbento-1.1b3-py3-none-any.whl.

File metadata

  • Download URL: terrainbento-1.1b3-py3-none-any.whl
  • Upload date:
  • Size: 253.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.1

File hashes

Hashes for terrainbento-1.1b3-py3-none-any.whl
Algorithm Hash digest
SHA256 da0ac3d631817c0c2dac88371f80f90be98e5430d98b88a218b4162223942edc
MD5 03f99f0921683369ef79d47f5504ef13
BLAKE2b-256 8199f554b3b1866f76c0e89fbc5df5530464d1a6bbc4606ee0b1c46aa4d98ed1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page