API Documentation
CarboKitten.run_model
— Functionrun_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")
CarboKitten.Box
— TypeBox{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
.
CarboKitten.box_axes
— Functionbox_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
.
CarboKitten.TimeProperties
— TypeTimeProperties(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.
CarboKitten.time_axis
— Functiontime_axis(time::TimeProperties)
Retrieve the time values for which output was/will be written.
Components
CarboKitten.Components.ActiveLayer.disintegration
— Methoddisintegration(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
.
CarboKitten.Components.ActiveLayer.transportation
— Methodtransportation(input::Input) -> f
Prepares the transportation step. Returns a function f(state::State, active_layer)
, transporting the active layer, returning a transported Amount
of sediment.
Utility
CarboKitten.Utility.enumerate_seq
— Methodenumerate_seq(s)
Enumerates an iterator of sequences, such that the following equivalence holds:
enumerate(flatten(s)) == flatten(enumerate_seq(s))
CarboKitten.Utility.find_ranges
— Methodfind_ranges(v::AbstractVector{Bool})
Take a vector of bools, returns an iterator over all ranges for which the vector is true
.
CarboKitten.Skeleton.skeleton
— Methodskeleton(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
.
Export
CarboKitten.Export.age_depth_model
— Methodage_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 select
s SAC columns, transformed into ADM.
CarboKitten.Export.extract_sac
— Methodextract_sac(header::Header, data::Data, grid_locations::Vector{NTuple{2,Int}})
Extract Sediment Accumumlation Curve (SAC) from the data. The SAC is directly copied from data.sediment_elevation
. Returns a DataFrame
with time
and sac<n>
columns where <n>
is in the range 1:length(grid_locations)
.
CarboKitten.Export.extract_sc
— Methodextract_sc(header::Header, data::Data, grid_locations::Vector{NTuple{2,Int}})
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)
.
CarboKitten.Export.stratigraphic_column
— Methodstratigraphic_column(header::Header, data::Data, loc::NTuple{2,Int}, 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.
CarboKitten.Export.unitful_headers
— Methodunitful_headers(df::DataFrame)
Gets a string representation for all column names including their unit. Returns a Vector{String}
.
CarboKitten.Export.write_unitful_csv
— Methodwrite_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.
Unitful.ustrip
— Methodustrip(df::DataFrame)
Strip units from a DataFrame
. Returns a new DataFrame
.
Submodules
CarboKitten.Denudation.Abstract.denudation
— Methoddenudation(box, param, state)
FIXME 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
.
CarboKitten.Denudation.Abstract.denudation
— Methoddenudation(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.
CarboKitten.Denudation.Abstract.redistribution
— Methodredistribution()
FIXME
CarboKitten.Denudation.NoDenudationMod
— Modulemodule NoDenudation
Doesn't do any denudation: used for testing purposes.