10-minute tutorial

Use pyDeltaRCM in ten minutes! This simple guide will show you the absolute basics of getting a pyDeltaRCM model running, and give you some direction on where to go from there.

Important

If you haven’t already, be sure to follow the installation guide to get pyDeltaRCM set up properly on your computer.

A default model

You can get a model running with five simple lines of code. First, we instantiate the main DeltaModel model object.

>>> import pyDeltaRCM

>>> default_delta = pyDeltaRCM.DeltaModel()

Instantiating the DeltaModel() without any arguments will use a set of default parameters to configure the model run. The default options are a reasonable set for exploring some controls of the model, and would work perfectly well for a simple demonstration here.

The delta model is run forward with a call to the update() method. So, we simply create a for loop, and call the update function, and then wrap everything up with a call to finalize() the model:

>>> for _ in range(0, 5):
...     delta.update()

>>> delta.finalize()

That’s it! You ran the pyDeltaRCM model for five timesteps, with just five lines of code.

We can visualize the delta bed elevation, though it’s not very exciting after only five timesteps…

>>> import matplotlib.pyplot as plt

>>> fig, ax = plt.subplots()
>>> ax.imshow(delta.bed_elevation, vmax=-3)
>>> plt.show()

(png, hires.png)

../_images/10min_demo.png

The model with set parameters

To run a simulation with a non-default set of parameters, we use a configuration file written in the YAML markup language named 10min_tutorial.yaml. For example, we can specify where we would like the output file to be placed with the out_dir parameter, ensure that our simulation is easily reproducible by setting the random seed parameter, and examine what is the effect of a high fraction of bedload:

out_dir: '10min_tutorial'
seed: 451220118313
f_bedload: 0.9

Now, we can create a second instance of the DeltaModel(), this time using the input yaml file.

>>> second_delta = pyDeltaRCM.DeltaModel(input_file='10min_tutorial.yaml')

and repeat the same for loop operation as above:

>>> for _ in range(0, 5):
...     second_delta.update()

>>> second_delta.finalize()

Resources

Consider reading through the User Guide as a first action, and determine how to set up the model to complete your experiment, including tutorials and examples for customizing the model to achieve any arbitrary behavior you need!