Package: terrainbento
ThingBadgeCI StatusCoverageDocsLicenseHealthStyleDOIConda RecipeDownloadsVersionPlatformsBinderterrainbentoA modular landscape evolution modeling package built on top of theLandlab Toolkit.terrainbento"s User Manual is located at ourRead The Docs page.We recommend that you start with a set of Jupyter notebooksthat introduce terrainbento and the model description paperBarnhart et al. (2019). The link above goes to a Binder instance, if you want the notebooks themselves clone the repo and navigate to the directorynotebooks.A quick exampleThe 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.fromterrainbentoimportBasicparams={# 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.fromlandlabimportimshow_gridfilenames=[]ds=model.to_xarray_dataset()foriinrange(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.importosimportimageiowithimageio.get_writer("terrainbento_example.gif",mode="I")aswriter:forfilenameinfilenames:image=imageio.imread(filename)writer.append_data(image)os.remove(filename)Installation instructionsBefore installing terrainbento you will need a python distribution. We recommend that you use theAnaconda 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).To install the release version of terrainbento (this is probably what you want) we support conda and pip package management.Using condaOpen a terminal and execute the following:conda config --add channels conda-forge
conda install terrainbentoUsing pipOpen a terminal and execute the following:pip install terrainbentoFrom source codeTo install the terrainbento source code version of terrainbento we recommend creating a conda environment for terrainbento.git clone https://github.com/TerrainBento/terrainbento.git
cd terrainbento
cconda env create -f environment-dev.yml
conda activate terrainbento-dev
python setup.py installA note to developersIf you plan to develop with terrainbento, please fork terrainbento, clone the forked repository, and replacepython setup.py installwithpython setup.py develop. If you have any questions, please contact us by making an Issue.How to citeBarnhart, 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.