In [ ]:
#!pip install -e /workspace/volume/pyReefCore
In [ ]:
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import cmocean as cmo
%config InlineBackend.figure_format = 'svg'
pyReef-Core is a deterministic, one-dimensional (1-D) numerical model, that simulates the vertical coralgal growth patterns observed in a drill core, as well as the physical, environmental processes that effect coralgal growth.
The model is capable of integrating ecological processes like coralgal community interactions over centennial-to-millennial scales using predator-prey or Generalised Lotka-Volterra Equations.
In [ ]:
from pyReefCore.model import Model
Once the library has been loaded, the model initialisation is done using the following command:
In [ ]:
# Initialise model
reef = Model()
The next step consists in defining the initial conditions for our simulation. This is done by using an XmL input file which set the parameters to be used, such as:
In [ ]:
# Define the XmL input file
reef.load_xml('input-case1.xml')
Visualise the initial conditions of your model run can be done using the following command:
In [ ]:
reef.core.initialSetting(size=(10,4), fname='input',dpi=400)
The core of the code consist in solving the system of ODEs from the GLV equations using the RKF method.
Once a community association population is resolved, carbonate production is calculated using a carbonate production factor. Production factors are specified for the maximum population, and linearly scaled to the actual population.
To run the model for a given time period [years], the following function needs to be called:
In [ ]:
reef.run_to_time(-1500,showtime=500.,verbose=False)
In [ ]:
from matplotlib.cm import terrain, plasma
nbcolors = len(reef.core.coralH)+10
#colors = cmo.cm.dense(np.linspace(0, 4, nbcolors))
colors = terrain(np.linspace(0, 1, nbcolors))
nbcolors = len(reef.core.layTime)+3
colors2 = cmo.cm.haline_r(np.linspace(0, 1, nbcolors))
In [ ]:
reef.plot.communityTime(colors=colors, size=(10,4), font=8, dpi=100,fname='apop_t.pdf')
reef.plot.communityDepth(colors=colors, size=(10,4), font=8, dpi=100, fname ='apop_d.pdf')
reef.plot.accommodationTime(size=(10,4), font=8, dpi=100, fname ='acc_t.pdf')
The main output of the model consists in the synthetic core which shows the evolution of the coral stratigraphic architecture obtained from the interactions among species and with their environment. The plot is obtained using the following function:
reef.plot.drawCoreThe user has the option to save:
figname parameter (figname could either have a .png or .pdf extension)filename parameter. This will dump all output dataset for further analysis if required.
In [ ]:
#help(reef.plot.drawCore)
In [ ]:
reef.plot.drawCore(lwidth = 3, colsed=colors, tstep=20, coltime = colors2, size=(11,15), font=8, dpi=500,
figname='core.pdf')
In [ ]:
reef.force.plotsedy
In [ ]:
0.004=a*30+0.001