API Documentation

CarboKitten.run_modelFunction
run_model(f, ::Type{Model{M}}, input::AbstractInput) where M
run_model(f, ::Type{Model{M}}, input::AbstractInput, state::AbstractState) where M

Run a model and send Frames to callback f. The type parameter M should be a model, being a module with both initial_state! and step! defined.

The second version with explicit state is used by H5Writer so we can perform an additional action between creating the initial state and starting the model run (saving metadata to the HDF5 file).

source
run_model(::Type{Model{M}}, input::AbstractInput, filename::AbstractString) where M

Run a model and write output to HDF5. Here M should be a model, i.e. a module with initial_state, step! and write_header defined. Example:

run_model(Model{ALCAP}, ALCAP.Example.INPUT, "example.h5")
source
CarboKitten.BoxType
Box{BoundaryType}(grid_size, phys_scale)

Stores the spatial properties of the simulation grid, where grid_size is a tuple of two integers and phys_scale is a Quantity of dimension Length.

source
CarboKitten.box_axesFunction
box_axes(box::Box)

Return the x and y components of the box grid in meters. The grid starts at 0.0u"m" and runs to (box.grid_size .- 1) .* box.phys_scale.

source
CarboKitten.TimePropertiesType
TimeProperties(t0, Δt, steps, write_interval)

Stores properties of the time integration. Here, t0 and Δt should be a Quantity, steps is the number of integration steps, and write_interval the number of steps between writing output.

source
CarboKitten.time_axisFunction
time_axis(time::TimeProperties)

Retrieve the time values for which output was/will be written. Returns a range.

source

Components

CarboKitten.Components.ActiveLayer.disintegratorMethod
disintegrator(input) -> f!

Prepares the disintegration step. Returns a function f!(state::State). The returned function modifies the state, popping sediment from the sediment_buffer and returns an array of Amount.

source

Utility

CarboKitten.Utility.enumerate_seqMethod
enumerate_seq(s)

Enumerates an iterator of sequences, such that the following equivalence holds:

enumerate(flatten(s)) == flatten(enumerate_seq(s))
source
CarboKitten.Skeleton.skeletonMethod
skeleton(bitmap::AbstractMatrix{Bool})

Computes the skeleton of a bitmap, i.e. reduces features with some thickness to a set of line segments. This function is designed with stratigraphic application in mind: we scan each row in the bitmap for connected regions, then link neighbouring regions when they overlap. The result is a graph that represents hiatus in the sediment accumulation.

Returns a tuple of vertices and edges, where vertices is a vector of 2-tuples and edges is a nx2 matrix of indices into the vertices.

source
CarboKitten.Stencil.stencil!Method
stencil!(f, Boundary, Size, out, inp...)

Performs stencil operation. The function f should take a number of abstract arrays (same as the number of inp values), and return a single value of the same type as elements in out. The Size parameter should be a type parameter size of the stencil, e.g. Size(3, 3) to get a 3 by 3 stencil.

Prefer to use this version over the older implementations.

source

Export

CarboKitten.Export.age_depth_modelMethod
age_depth_model(sediment_accumulation_curve::Vector)
age_depth_model(sediment_accumulation_curve::DataFrame)

Compute the ADM from the SAC. Implemented as:

reverse ∘ accumulate(min) ∘ reverse

The DataFrame version selects SAC columns, transformed into ADM.

source
CarboKitten.Export.extract_sacMethod
extract_sac(header::Header, data::DataColumn)

Extract Sediment Accumumlation Curve (SAC) from the data. The SAC is directly copied from data.sediment_thickness. Returns a DataFrame with time and sac_<n> columns where <n> is in the range 1:length(grid_locations).

source
CarboKitten.Export.extract_scMethod
extract_sc(header::Header, data::DataColumn)

Extract Stratigraphic Column (SC) from the data. Returns a DataFrame with time and sc<n> columns where <n> is in the range 1:length(grid_locations).

source
CarboKitten.Export.extract_wdMethod
extract_wd(header::Header, data::DataColumn)

Extract the water depth from the data. Returns a DataFrame with time and wd<n> columns where <n> is in the range 1:length(grid_locations).

source
CarboKitten.Export.stratigraphic_columnMethod
stratigraphic_column(header::Header, column::DataColumn, facies::Int)

Compute the Stratigraphic Column for a given grid position loc and facies index. Returns an Array{Quantity, 2} where the Quantity is in units of meters.

source
CarboKitten.Export.write_unitful_csvMethod
write_unitful_csv(io::IO, df::DataFrame)

Write a CSV from a DataFrame with Unitful units. The units will be represented in the CSV header, and stripped from the individual values.

source
Unitful.ustripMethod
ustrip(df::DataFrame)

Strip units from a DataFrame. Returns a new DataFrame.

source

Transport

CarboKitten.Transport.Advection.transport!Method
transport!(box, diffusivity, wave_velocity,
           C, w, dC)

Computes dC given a box, diffusivity constant in units of m/Myr, wave_velocity is a function of water depth, returning both velocity in units of m/Myr, and shear in units of 1/Myr, which should be the derivative of the velocity w.r.t. water depth. C is the concentration of entrained sediment, w the water depth, and dC the output derivative of C.

source

Submodules

CarboKitten.Denudation.Abstract.denudationMethod
denudation(box, param, state)

Computes the denudation for a single time-step, given denudation parameters param and a simulation state state. param should have a DenudationType type and state should contain the height property and sealevel.

Returns denudation mass in units of meters.

source
CarboKitten.Denudation.Abstract.denudationMethod
denudation(box::Box, param::DenudationType, water_depth, slope, facies)

Computes the amount of denudation. This function is called on a pixel by pixel basis, so all arguments can be assumed to be scalar. The param argument should be of a subtype of DenudationType containing all the input parameters for this specific denudation model.

source