DeltaRCM / pyDeltaRCM

Delta model with a reduced-complexity approach
https://deltarcm.org/pyDeltaRCM/
MIT License
18 stars 11 forks source link

Add an example for how to resume from checkpoint and continue a model run #250

Closed amoodie closed 2 years ago

amoodie commented 2 years ago

We do not currently have any examples demonstrating how to resume from a checkpoint file and continue the model run.

Yet, we use this extensively in the documentation and in our own research. It has become clear this is a really valuable tool and an example for how to use this functionality is needed.

I think we could essentially take from one of the docs pyplots to make something that shows how to do this. Pseudo code below.

import warnings

import numpy as np
import matplotlib.pyplot as plt

import pyDeltaRCM

# use this in a not-shown code block to init delta model
with pyDeltaRCM.shared_tools._docs_temp_directory() as output_dir:
    delta = pyDeltaRCM.DeltaModel(
        out_dir=output_dir,
        resume_checkpoint='../../_resources/checkpoint')

# use this in a shown code block to demonstrate init the delta model
    delta = pyDeltaRCM.DeltaModel(
        resume_checkpoint='../../_resources/checkpoint')

delta.update()

# set up axis
fig, ax = plt.subplots()
pyDeltaRCM.debug_tools.plot_domain(
    'eta', ax=ax, grid=False)

plt.tight_layout()
plt.show()
elbeejay commented 2 years ago

Closed by #252