From 214b0e8139bdc3cbb82e0db469e07a4863356f1f Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Tue, 23 Apr 2024 05:33:29 +0000 Subject: [PATCH] build based on 4281d27 --- dev/.documenter-siteinfo.json | 2 +- dev/faq/index.html | 2 +- dev/gallery/index.html | 2 +- dev/guide/configuration/index.html | 2 +- dev/guide/inspection/index.html | 2 +- dev/guide/simulation/index.html | 2 +- dev/guide/system/index.html | 2 +- dev/guide/variable/index.html | 2 +- dev/guide/visualization/index.html | 2 +- dev/index.html | 2 +- dev/installation/index.html | 2 +- dev/reference/declaration/index.html | 4 ++-- dev/reference/index.html | 2 +- dev/reference/inspection/index.html | 4 ++-- dev/reference/simulation/index.html | 10 +++++----- dev/reference/visualization/index.html | 6 +++--- dev/tutorials/cropbox/index.html | 2 +- dev/tutorials/julia/index.html | 2 +- dev/tutorials/makingamodel/index.html | 2 +- dev/tutorials/usingamodel/index.html | 2 +- 20 files changed, 28 insertions(+), 28 deletions(-) diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index 9953fb32..56b39302 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.2","generation_timestamp":"2024-04-22T23:51:11","documenter_version":"1.4.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.10.2","generation_timestamp":"2024-04-23T05:33:24","documenter_version":"1.4.0"}} \ No newline at end of file diff --git a/dev/faq/index.html b/dev/faq/index.html index ec867507..e84e9c68 100644 --- a/dev/faq/index.html +++ b/dev/faq/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-192782823-1', {'page_path': location.pathname + location.search + location.hash}); -
+
diff --git a/dev/gallery/index.html b/dev/gallery/index.html index 1ed14128..40faab4f 100644 --- a/dev/gallery/index.html +++ b/dev/gallery/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-192782823-1', {'page_path': location.pathname + location.search + location.hash}); -
+
diff --git a/dev/guide/configuration/index.html b/dev/guide/configuration/index.html index b3351eed..32387c3e 100644 --- a/dev/guide/configuration/index.html +++ b/dev/guide/configuration/index.html @@ -101,4 +101,4 @@

context=<Context> config=<Config> D=3×2 DataFrame… - + diff --git a/dev/guide/inspection/index.html b/dev/guide/inspection/index.html index 2ed3f164..1dbaf496 100644 --- a/dev/guide/inspection/index.html +++ b/dev/guide/inspection/index.html @@ -34,4 +34,4 @@ S → context = <Context> config = <Config> - a = 1.0 + a = 1.0 diff --git a/dev/guide/simulation/index.html b/dev/guide/simulation/index.html index 646dda7f..eca1955f 100644 --- a/dev/guide/simulation/index.html +++ b/dev/guide/simulation/index.html @@ -79,4 +79,4 @@ a=20.0 - + diff --git a/dev/guide/system/index.html b/dev/guide/system/index.html index 314fac30..4fa9b5a8 100644 --- a/dev/guide/system/index.html +++ b/dev/guide/system/index.html @@ -66,4 +66,4 @@ (last - init) / step end end ~ preserve::int(round, optional) -end +end diff --git a/dev/guide/variable/index.html b/dev/guide/variable/index.html index deab8c5b..4d332227 100644 --- a/dev/guide/variable/index.html +++ b/dev/guide/variable/index.html @@ -589,4 +589,4 @@ b(a) => a ~ track(when=flag) end -simulate(S; stop=3u"hr")
4×4 DataFrame
Rowtimeaflagb
Quantity…Float64BoolFloat64
10.0 hr0.0false0.0
21.0 hr1.0false0.0
32.0 hr2.0true2.0
43.0 hr3.0true3.0
+simulate(S; stop=3u"hr")
4×4 DataFrame
Rowtimeaflagb
Quantity…Float64BoolFloat64
10.0 hr0.0false0.0
21.0 hr1.0false0.0
32.0 hr2.0true2.0
43.0 hr3.0true3.0
diff --git a/dev/guide/visualization/index.html b/dev/guide/visualization/index.html index a01e57bf..7c40f546 100644 --- a/dev/guide/visualization/index.html +++ b/dev/guide/visualization/index.html @@ -347,4 +347,4 @@

-

manipulate()

The manipulate function has two different methods for creating an interactive plot.

manipulate(f::Function; parameters, config=())

Create an interactive plot updated by callback f. Only works in Jupyter Notebook.

manipulate(args...; parameters, kwargs...)

Create an interactive plot by calling manipulate with visualize as a callback.

+

manipulate()

The manipulate function has two different methods for creating an interactive plot.

manipulate(f::Function; parameters, config=())

Create an interactive plot updated by callback f. Only works in Jupyter Notebook.

manipulate(args...; parameters, kwargs...)

Create an interactive plot by calling manipulate with visualize as a callback.

diff --git a/dev/index.html b/dev/index.html index 63171fb5..4e856834 100644 --- a/dev/index.html +++ b/dev/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-192782823-1', {'page_path': location.pathname + location.search + location.hash}); -

Cropbox

What is Cropbox?

Cropbox is a declarative modeling framework specifically designed for developing crop models. The goal is to let crop modelers focus on what the model should look like rather than how the model is technically implemented under the hood.

Getting started

Citation

When using Cropbox in your work, please cite the following paper:

Yun K, Kim S-H (2023) Cropbox: a declarative crop modelling framework. in silico Plants 5(1), diac021 (https://doi.org/10.1093/insilicoplants/diac021)
+

Cropbox

What is Cropbox?

Cropbox is a declarative modeling framework specifically designed for developing crop models. The goal is to let crop modelers focus on what the model should look like rather than how the model is technically implemented under the hood.

Getting started

Citation

When using Cropbox in your work, please cite the following paper:

Yun K, Kim S-H (2023) Cropbox: a declarative crop modelling framework. in silico Plants 5(1), diac021 (https://doi.org/10.1093/insilicoplants/diac021)
diff --git a/dev/installation/index.html b/dev/installation/index.html index f6a49622..edb8799e 100644 --- a/dev/installation/index.html +++ b/dev/installation/index.html @@ -15,4 +15,4 @@ _/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release |__/ | -julia>

Using Binder

The docker image can be also launched via Binder without installing anything locally. This method is the least recommended due to its timeout duration.

Binder

+julia>

Using Binder

The docker image can be also launched via Binder without installing anything locally. This method is the least recommended due to its timeout duration.

Binder

diff --git a/dev/reference/declaration/index.html b/dev/reference/declaration/index.html index 25bf001c..e95323c9 100644 --- a/dev/reference/declaration/index.html +++ b/dev/reference/declaration/index.html @@ -7,7 +7,7 @@ a => 1 ~ preserve(parameter) b(a) ~ accumulate end -Ssource
Cropbox.@configMacro
@config c.. -> Config | Vector{Config}

Construct a set or multiple sets of configuration.

A basic unit of configuration for a system S is represented by a pair in the form of S => pv. System name S is expressed in a symbol. If actual type of system is used, its name will be automatically converted to a symbol.

A parameter name and corresponding value is then represented by another pair in the form of p => v. When specifiying multiple parameters, a tuple of pairs like (p1 => v1, p2 => v2) or a named tuple like (p1 = v1, p2 = v2) can be used. Parameter name must be a symbol and should indicate a variable declared with parameter tag as often used by preserve state variable. For example, :S => (:a => 1, :b => 2) has the same meaning as S => (a = 1, b = 2) in the same scope.

Configurations for multiple systems can be concatenated by a tuple. Multiple elements in c separated by commas implicitly forms a tuple. For example, :S => (:a => 1, :b => 2), :T => :x => 1 represents a set of configuration for two systems S and T with some parameters. When the same names of system or variable appears again during concatenation, it will be overriden by later ones in an order appeared in a tuple. For example, :S => :a => 1, :S => :a => 2 results into :S => :a => 2. Instead of commas, + operator can be used in a similar way as (:S => :a => 1) + (:S => :a => 2). Note parentheses placed due to operator precedence.

When multiple sets of configurations are needed, as in configs for simulate, a vector of Config is used. This macro supports some convenient ways to construct a vector by composing simpler configurations. Prefix operator ! allows expansion of any iterable placed in the configuration value. Infix operator * allows multiplication of a vector of configurations with another vector or a single configuration to construct multiple sets of configurations. For example, !(:S => :a => 1:2) is expanded into two sets of separate configurations [:S => :a => 1, :S => :a => 2]. (:S => :a => 1:2) * (:S => :b => 0) is multiplied into [:S => (a = 1, b = 0), :S => (a = 2, b = 0)].

Examples

julia> @config :S => (:a => 1, :b => 2)
+S
source
Cropbox.@configMacro
@config c.. -> Config | Vector{Config}

Construct a set or multiple sets of configuration.

A basic unit of configuration for a system S is represented by a pair in the form of S => pv. System name S is expressed in a symbol. If actual type of system is used, its name will be automatically converted to a symbol.

A parameter name and corresponding value is then represented by another pair in the form of p => v. When specifiying multiple parameters, a tuple of pairs like (p1 => v1, p2 => v2) or a named tuple like (p1 = v1, p2 = v2) can be used. Parameter name must be a symbol and should indicate a variable declared with parameter tag as often used by preserve state variable. For example, :S => (:a => 1, :b => 2) has the same meaning as S => (a = 1, b = 2) in the same scope.

Configurations for multiple systems can be concatenated by a tuple. Multiple elements in c separated by commas implicitly forms a tuple. For example, :S => (:a => 1, :b => 2), :T => :x => 1 represents a set of configuration for two systems S and T with some parameters. When the same names of system or variable appears again during concatenation, it will be overriden by later ones in an order appeared in a tuple. For example, :S => :a => 1, :S => :a => 2 results into :S => :a => 2. Instead of commas, + operator can be used in a similar way as (:S => :a => 1) + (:S => :a => 2). Note parentheses placed due to operator precedence.

When multiple sets of configurations are needed, as in configs for simulate, a vector of Config is used. This macro supports some convenient ways to construct a vector by composing simpler configurations. Prefix operator ! allows expansion of any iterable placed in the configuration value. Infix operator * allows multiplication of a vector of configurations with another vector or a single configuration to construct multiple sets of configurations. For example, !(:S => :a => 1:2) is expanded into two sets of separate configurations [:S => :a => 1, :S => :a => 2]. (:S => :a => 1:2) * (:S => :b => 0) is multiplied into [:S => (a = 1, b = 0), :S => (a = 2, b = 0)].

Examples

julia> @config :S => (:a => 1, :b => 2)
 Config for 1 system:
   S
     a = 1
@@ -20,4 +20,4 @@
  <Config>
julia> @config (:S => :a => 1:2) * (:S => :b => 0)
 2-element Vector{Config}:
  <Config>
- <Config>
source
+ <Config>source diff --git a/dev/reference/index.html b/dev/reference/index.html index e370fe47..b1bce114 100644 --- a/dev/reference/index.html +++ b/dev/reference/index.html @@ -3,4 +3,4 @@ function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-192782823-1', {'page_path': location.pathname + location.search + location.hash}); -
+
diff --git a/dev/reference/inspection/index.html b/dev/reference/inspection/index.html index b765753b..aa655909 100644 --- a/dev/reference/inspection/index.html +++ b/dev/reference/inspection/index.html @@ -15,7 +15,7 @@ a param [code] - a => 1 ~ preserve(parameter)source
Cropbox.diveFunction
dive(s)

Inspect an instance of system s by navigating hierarchy of variables displayed in a tree structure.

Pressing up/down arrow keys allows navigation. Press 'enter' to dive into a deeper level and press 'q' to come back. A leaf node of the tree shows an output of look regarding the variable. Pressing 'enter' again would return a variable itself and exit to REPL.

Only works in a terminal environment; not working on Jupyter Notebook.

See also: look

Arguments

  • s::System: instance of target system.

Examples

julia> @system S(Controller) begin
+  a => 1 ~ preserve(parameter)
source
Cropbox.diveFunction
dive(s)

Inspect an instance of system s by navigating hierarchy of variables displayed in a tree structure.

Pressing up/down arrow keys allows navigation. Press 'enter' to dive into a deeper level and press 'q' to come back. A leaf node of the tree shows an output of look regarding the variable. Pressing 'enter' again would return a variable itself and exit to REPL.

Only works in a terminal environment; not working on Jupyter Notebook.

See also: look

Arguments

  • s::System: instance of target system.

Examples

julia> @system S(Controller) begin
            a => 1 ~ preserve(parameter)
        end;
 
@@ -25,4 +25,4 @@
 S
  → context = <Context>
    config = <Config>
-   a = 1.0
source
+ a = 1.0source diff --git a/dev/reference/simulation/index.html b/dev/reference/simulation/index.html index c44d1a91..c45c8258 100644 --- a/dev/reference/simulation/index.html +++ b/dev/reference/simulation/index.html @@ -13,7 +13,7 @@ context = <Context> config = <Config> a = 1.0 - b = 0.0source
Cropbox.simulateFunction
simulate([f,] S[, layout, [configs]]; <keyword arguments>) -> DataFrame

Run simulations by making instance of system S with given configuration to generate an output in the form of DataFrame. layout contains a list of variables to be saved in the output. A layout of single simulation can be specified in the layout arguments placed as keyword arguments. configs contains a list of configurations for each run of simulation. Total number of simulation runs equals to the size of configs. For a single configuration, config keyword argument may be preferred. Optional callback function f allows do-block syntax to specify snatch argument for finer control of output format.

See also: instance, @config

Arguments

  • S::Type{<:System}: type of system to be simulated.
  • layout::Vector: list of output layout definition in a named tuple (; base, index, target, meta).
  • configs::Vector: list of configurations for defining multiple runs of simluations.

Keyword Arguments

Layout

  • base=nothing: base system where index and target are populated; default falls back to the instance of S.
  • index=nothing: variables to construct index columns of the output; default falls back to context.clock.time.
  • target=nothing: variables to construct non-index columns of the output; default includes most variables in the root instance.
  • meta=nothing: name of systems in the configuration to be included in the output as metadata.

Configuration

  • config=(): a single configuration for the system, or a base for multiple configurations (when used with configs).
  • configs=[]: multiple configurations for the system.
  • seed=nothing: random seed for resetting each simulation run.

Progress

  • stop=nothing: condition checked before calling updates for the instance; default stops with no update.
  • snap=nothing: condition checked to decide if a snapshot of current update is saved in the output; default snaps all updates.
  • snatch=nothing: callback for modifying intermediate output; list of DataFrame D collected from current update and the instance of system s are provided.
  • verbose=true: shows a progress bar.

Format

  • nounit=false: remove units from the output.
  • long=false: convert output table from wide to long format.

Examples

julia> @system S(Controller) begin
+  b = 0.0
source
Cropbox.simulateFunction
simulate([f,] S[, layout, [configs]]; <keyword arguments>) -> DataFrame

Run simulations by making instance of system S with given configuration to generate an output in the form of DataFrame. layout contains a list of variables to be saved in the output. A layout of single simulation can be specified in the layout arguments placed as keyword arguments. configs contains a list of configurations for each run of simulation. Total number of simulation runs equals to the size of configs. For a single configuration, config keyword argument may be preferred. Optional callback function f allows do-block syntax to specify snatch argument for finer control of output format.

See also: instance, @config

Arguments

  • S::Type{<:System}: type of system to be simulated.
  • layout::Vector: list of output layout definition in a named tuple (; base, index, target, meta).
  • configs::Vector: list of configurations for defining multiple runs of simluations.

Keyword Arguments

Layout

  • base=nothing: base system where index and target are populated; default falls back to the instance of S.
  • index=nothing: variables to construct index columns of the output; default falls back to context.clock.time.
  • target=nothing: variables to construct non-index columns of the output; default includes most variables in the root instance.
  • meta=nothing: name of systems in the configuration to be included in the output as metadata.

Configuration

  • config=(): a single configuration for the system, or a base for multiple configurations (when used with configs).
  • configs=[]: multiple configurations for the system.
  • seed=nothing: random seed for resetting each simulation run.

Progress

  • stop=nothing: condition checked before calling updates for the instance; default stops with no update.
  • snap=nothing: condition checked to decide if a snapshot of current update is saved in the output; default snaps all updates.
  • snatch=nothing: callback for modifying intermediate output; list of DataFrame D collected from current update and the instance of system s are provided.
  • verbose=true: shows a progress bar.

Format

  • nounit=false: remove units from the output.
  • long=false: convert output table from wide to long format.

Examples

julia> @system S(Controller) begin
            a => 1 ~ preserve(parameter)
            b(a) ~ accumulate
        end;
@@ -24,7 +24,7 @@
      │ Quantity…  Float64  Float64
 ─────┼─────────────────────────────
    1 │    0.0 hr      1.0      0.0
-   2 │    1.0 hr      1.0      1.0
source
Cropbox.evaluateFunction
evaluate(S, obs; <keyword arguments>) -> Number | Tuple

Compare output of simulation results for the given system S and observation data obs with a choice of evaluation metric.

Arguments

  • S::Type{<:System}: type of system to be evaluated.
  • obs::DataFrame: observation data to be used for evaluation.

Keyword Arguments

Configuration

  • config=(): a single configuration for the system (can't be used with configs).
  • configs=[]: multiple configurations for the system (can't be used with config).

Layout

  • index=nothing: variables to construct index columns of the output; default falls back to context.clock.time.
  • target: variables to construct non-index columns of the output.

Evaluation

  • metric=nothing: evaluation metric (:rmse, :nrmse, :mae, :mape, :ef, :dr); default is RMSE.

Remaining keyword arguments are passed down to simulate with regard to running system S.

See also: simulate, calibrate, @config

Examples

julia> @system S(Controller) begin
+   2 │    1.0 hr      1.0      1.0
source
Cropbox.evaluateFunction
evaluate(S, obs; <keyword arguments>) -> Number | Tuple

Compare output of simulation results for the given system S and observation data obs with a choice of evaluation metric.

Arguments

  • S::Type{<:System}: type of system to be evaluated.
  • obs::DataFrame: observation data to be used for evaluation.

Keyword Arguments

Configuration

  • config=(): a single configuration for the system (can't be used with configs).
  • configs=[]: multiple configurations for the system (can't be used with config).

Layout

  • index=nothing: variables to construct index columns of the output; default falls back to context.clock.time.
  • target: variables to construct non-index columns of the output.

Evaluation

  • metric=nothing: evaluation metric (:rmse, :nrmse, :mae, :mape, :ef, :dr); default is RMSE.

Remaining keyword arguments are passed down to simulate with regard to running system S.

See also: simulate, calibrate, @config

Examples

julia> @system S(Controller) begin
            a => 19 ~ preserve(u"m/hr", parameter)
            b(a) ~ accumulate(u"m")
        end;
@@ -34,7 +34,7 @@
 julia> configs = @config !(:S => :a => [19, 21]);
 
 julia> evaluate(S, obs; configs, target=:b, stop=10u"hr")
-10.0 m
source
evaluate(obs, est; <keyword arguments>) -> Number | Tuple

Compare observation data obs and estimation data est with a choice of evaluation metric.

Arguments

  • obs::DataFrame: observation data to be used for evaluation.
  • est::DataFrame: estimated data from simulation.

Keyword Arguments

Layout

  • index: variables referring to index columns of the output.
  • target: variables referring to non-index columns of the output.

Evaluation

  • metric=nothing: evaluation metric (:rmse, :nrmse, :mae, :mape, :ef, :dr); default is RMSE.

See also: evaluate

Examples

julia> obs = DataFrame(time = [1, 2, 3]u"hr", b = [10, 20, 30]u"g");
+10.0 m
source
evaluate(obs, est; <keyword arguments>) -> Number | Tuple

Compare observation data obs and estimation data est with a choice of evaluation metric.

Arguments

  • obs::DataFrame: observation data to be used for evaluation.
  • est::DataFrame: estimated data from simulation.

Keyword Arguments

Layout

  • index: variables referring to index columns of the output.
  • target: variables referring to non-index columns of the output.

Evaluation

  • metric=nothing: evaluation metric (:rmse, :nrmse, :mae, :mape, :ef, :dr); default is RMSE.

See also: evaluate

Examples

julia> obs = DataFrame(time = [1, 2, 3]u"hr", b = [10, 20, 30]u"g");
 
 julia> est = DataFrame(time = [1, 2, 3]u"hr", b = [10, 20, 30]u"g", c = [11, 19, 31]u"g");
 
@@ -42,7 +42,7 @@
 0.0 g
 
 julia> evaluate(obs, est; index = :time, target = :b => :c)
-1.0 g
source
Cropbox.calibrateFunction
calibrate(S, obs; <keyword arguments>) -> Config | OrderedDict

Obtain a set of parameters for the given system S that simulates provided observation obs closely as possible. A multitude of simulations are conducted with a differing combination of parameter sets specified by the range of possible values and the optimum is selected based on a choice of evaluation metric. Internally, differential evolution algorithm from BlackboxOptim.jl is used.

Arguments

  • S::Type{<:System}: type of system to be calibrated.
  • obs::DataFrame: observation data to be used for calibration.

Keyword Arguments

Configuration

  • config=(): a single base configuration for the system (can't be used with configs).
  • configs=[]: multiple base configurations for the system (can't be used with config).

Layout

  • index=nothing: variables to construct index columns of the output; default falls back to context.clock.time.
  • target: variables to construct non-index columns of the output.

Calibration

  • parameters: parameters with a range of boundary values to be calibrated within.
  • metric=nothing: evaluation metric (:rmse, :nrmse, :mae, :mape, :ef, :dr); default is RMSE.

Multi-objective

  • weight=nothing: weights for calibrating multiple targets; default assumes equal weights.
  • pareto=false: returns a dictionary containing Pareto frontier instead of a single solution satisfying multiple targets.

Advanced

  • optim=(): extra options for BlackBoxOptim.bboptimize.

Remaining keyword arguments are passed down to simulate with regard to running system S.

See also: simulate, evaluate, @config

Examples

julia> @system S(Controller) begin
+1.0 g
source
Cropbox.calibrateFunction
calibrate(S, obs; <keyword arguments>) -> Config | OrderedDict

Obtain a set of parameters for the given system S that simulates provided observation obs closely as possible. A multitude of simulations are conducted with a differing combination of parameter sets specified by the range of possible values and the optimum is selected based on a choice of evaluation metric. Internally, differential evolution algorithm from BlackboxOptim.jl is used.

Arguments

  • S::Type{<:System}: type of system to be calibrated.
  • obs::DataFrame: observation data to be used for calibration.

Keyword Arguments

Configuration

  • config=(): a single base configuration for the system (can't be used with configs).
  • configs=[]: multiple base configurations for the system (can't be used with config).

Layout

  • index=nothing: variables to construct index columns of the output; default falls back to context.clock.time.
  • target: variables to construct non-index columns of the output.

Calibration

  • parameters: parameters with a range of boundary values to be calibrated within.
  • metric=nothing: evaluation metric (:rmse, :nrmse, :mae, :mape, :ef, :dr); default is RMSE.

Multi-objective

  • weight=nothing: weights for calibrating multiple targets; default assumes equal weights.
  • pareto=false: returns a dictionary containing Pareto frontier instead of a single solution satisfying multiple targets.

Advanced

  • optim=(): extra options for BlackBoxOptim.bboptimize.

Remaining keyword arguments are passed down to simulate with regard to running system S.

See also: simulate, evaluate, @config

Examples

julia> @system S(Controller) begin
            a => 0 ~ preserve(parameter)
            b(a) ~ accumulate
        end;
@@ -53,4 +53,4 @@
 ...
 Config for 1 system:
   S
-    a = 20.0
source
+ a = 20.0source diff --git a/dev/reference/visualization/index.html b/dev/reference/visualization/index.html index 7e405eeb..e5b34e64 100644 --- a/dev/reference/visualization/index.html +++ b/dev/reference/visualization/index.html @@ -5,8 +5,8 @@ gtag('config', 'UA-192782823-1', {'page_path': location.pathname + location.search + location.hash});

Visualization

Cropbox.plotFunction
plot(df::DataFrame, x, y; <keyword arguments>) -> Plot
 plot(X::Vector, Y::Vector; <keyword arguments>) -> Plot
-plot(df::DataFrame, x, y, z; <keyword arguments>) -> Plot

Plot a graph from provided data source. The type of graph is selected based on arguments.

See also: plot!, visualize

source
plot(v::Number; kind, <keyword arguments>) -> Plot
-plot(V::Vector; kind, <keyword arguments>) -> Plot

Plot a graph of horizontal/vertical lines depending on kind, which can be either :hline or :vline. An initial plotting of hline requires xlim and vline requires ylim, respectively.

See also: plot!, visualize

source
Cropbox.plot!Function
plot!(p, <arguments>; <keyword arguments>) -> Plot

Update an existing Plot object p by appending a new graph made with plot.

See also: plot

Arguments

  • p::Union{Plot,Nothing}: plot object to be updated; nothing creates a new plot.
source
Cropbox.visualizeFunction
visualize(<arguments>; <keyword arguments>) -> Plot

Make a plot from an output collected by running necessary simulations. A convenient function to run both simulate and plot together.

See also: visualize!, simulate, plot, manipulate

Examples

julia> @system S(Controller) begin
+plot(df::DataFrame, x, y, z; <keyword arguments>) -> Plot

Plot a graph from provided data source. The type of graph is selected based on arguments.

See also: plot!, visualize

source
plot(v::Number; kind, <keyword arguments>) -> Plot
+plot(V::Vector; kind, <keyword arguments>) -> Plot

Plot a graph of horizontal/vertical lines depending on kind, which can be either :hline or :vline. An initial plotting of hline requires xlim and vline requires ylim, respectively.

See also: plot!, visualize

source
Cropbox.plot!Function
plot!(p, <arguments>; <keyword arguments>) -> Plot

Update an existing Plot object p by appending a new graph made with plot.

See also: plot

Arguments

  • p::Union{Plot,Nothing}: plot object to be updated; nothing creates a new plot.
source
Cropbox.visualizeFunction
visualize(<arguments>; <keyword arguments>) -> Plot

Make a plot from an output collected by running necessary simulations. A convenient function to run both simulate and plot together.

See also: visualize!, simulate, plot, manipulate

Examples

julia> @system S(Controller) begin
            a(a) => a ~ accumulate(init=1)
        end;
 
@@ -29,4 +29,4 @@
      1 │.........''''                           │
        └────────────────────────────────────────┘
        0                                        5
-                      time (hr)
source
Cropbox.visualize!Function
visualize!(p, <arguments>; <keyword arguments>) -> Plot

Update an existing Plot object p by appending a new graph made with visualize.

See also: visualize

Arguments

  • p::Union{Plot,Nothing}: plot object to be updated; nothing creates a new plot.
source
Cropbox.manipulateFunction
manipulate(f::Function; parameters, config=())

Create an interactive plot updated by callback f. Only works in Jupyter Notebook.

Arguments

  • f::Function: callback for generating a plot; interactively updated configuration c is provided.
  • parameters: parameters adjustable with interactive widgets; value should be an iterable.
  • config=(): a baseline configuration.
source
manipulate(args...; parameters, kwargs...)

Create an interactive plot by calling manipulate with visualize as a callback.

See also: visualize

Arguments

  • args: positional arguments for visualize.
  • parameters: parameters for manipulate.
  • kwargs: keyword arguments for visualize.
source
+ time (hr)source
Cropbox.visualize!Function
visualize!(p, <arguments>; <keyword arguments>) -> Plot

Update an existing Plot object p by appending a new graph made with visualize.

See also: visualize

Arguments

  • p::Union{Plot,Nothing}: plot object to be updated; nothing creates a new plot.
source
Cropbox.manipulateFunction
manipulate(f::Function; parameters, config=())

Create an interactive plot updated by callback f. Only works in Jupyter Notebook.

Arguments

  • f::Function: callback for generating a plot; interactively updated configuration c is provided.
  • parameters: parameters adjustable with interactive widgets; value should be an iterable.
  • config=(): a baseline configuration.
source
manipulate(args...; parameters, kwargs...)

Create an interactive plot by calling manipulate with visualize as a callback.

See also: visualize

Arguments

  • args: positional arguments for visualize.
  • parameters: parameters for manipulate.
  • kwargs: keyword arguments for visualize.
source
diff --git a/dev/tutorials/cropbox/index.html b/dev/tutorials/cropbox/index.html index 4471f6c6..1d086474 100644 --- a/dev/tutorials/cropbox/index.html +++ b/dev/tutorials/cropbox/index.html @@ -175,4 +175,4 @@

Simulation

Evaluation

The evaluate() function can be used to compare two datasets with a choice of evaluation metric, such as root-mean-square error. For instance, we could compare a dataset of the observed values from an experiment to the estimated values from a simulation. To do this, we would enter in the observed dataset as a DataFrame.

using DataFrames
 obs = DataFrame(time = [0.0 ,1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0]u"hr", x = [1, .985, 1.06, 1.15, 1.14, 1.17, 1.24, 1.34, 1.76, 1.53, 1.68])
-est = simulate(S, config = config, stop = 10)
11×5 DataFrame
Rowtimeiarx
Quantity…Float64Float64Float64Float64
10.0 hr1.00.050.051.0
21.0 hr1.00.050.05251.05
32.0 hr1.00.050.0551251.1025
43.0 hr1.00.050.05788131.15763
54.0 hr1.00.050.06077531.21551
65.0 hr1.00.050.06381411.27628
76.0 hr1.00.050.06700481.3401
87.0 hr1.00.050.0703551.4071
98.0 hr1.00.050.07387281.47746
109.0 hr1.00.050.07756641.55133
1110.0 hr1.00.050.08144471.62889

We compare this dataset to the results of the simulation visually by adding it to the our previous plot p using the plot!() function.

plot!(p,obs, :time, :x)
Example block output

Then, we can use the evaluate() function to calculate the error between the observed and simulated values. The index will be time by default and the target will be the variables we want to compare.

evaluate(obs, df; index = :time, target = :x, metric = :rmse)
0.10466658629266519

In addition to being able to compare two DataFrames, the evaluate() function can also be used to compare a system to a DataFrame.

evaluate(S, est; target = :a, stop = 10)
0.05000000000000001
+est = simulate(S, config = config, stop = 10)
11×5 DataFrame
Rowtimeiarx
Quantity…Float64Float64Float64Float64
10.0 hr1.00.050.051.0
21.0 hr1.00.050.05251.05
32.0 hr1.00.050.0551251.1025
43.0 hr1.00.050.05788131.15763
54.0 hr1.00.050.06077531.21551
65.0 hr1.00.050.06381411.27628
76.0 hr1.00.050.06700481.3401
87.0 hr1.00.050.0703551.4071
98.0 hr1.00.050.07387281.47746
109.0 hr1.00.050.07756641.55133
1110.0 hr1.00.050.08144471.62889

We compare this dataset to the results of the simulation visually by adding it to the our previous plot p using the plot!() function.

plot!(p,obs, :time, :x)
Example block output

Then, we can use the evaluate() function to calculate the error between the observed and simulated values. The index will be time by default and the target will be the variables we want to compare.

evaluate(obs, df; index = :time, target = :x, metric = :rmse)
0.10466658629266519

In addition to being able to compare two DataFrames, the evaluate() function can also be used to compare a system to a DataFrame.

evaluate(S, est; target = :a, stop = 10)
0.05000000000000001
diff --git a/dev/tutorials/julia/index.html b/dev/tutorials/julia/index.html index e34a334d..25ee8f01 100644 --- a/dev/tutorials/julia/index.html +++ b/dev/tutorials/julia/index.html @@ -5,4 +5,4 @@ gtag('config', 'UA-192782823-1', {'page_path': location.pathname + location.search + location.hash});

Getting Started with Julia

Julia is a relatively new programming language designed for scientific computing in mind. It is a dynamic programming language as convenient as Python and R, but also provides high performance and extensibility as C/C++ and Fortran. Check the chart here to see where Julia stands as a programming language among other languages today; its position has been rising fast.

If you already have a fair understanding of Julia or would like to skip ahead to learning about Cropbox, please go to Getting Started With Cropbox.

Installing Julia

You can download and install Julia from the official Julia downloads page. For new users, it is recommended to install the "Current stable release" for Julia. In general, you will want to install the 64-bit version. If you run into an issue installing the 64-bit version, you can try the 32-bit version. During installation, select "Add Julia to PATH". You can also add Julia to PATH after installation using the command-line interface (CLI).

For more detailed platform-specific instructions, you can check the official Julia instructions.

If you are new to coding and require a development environment, check the Installation section for more information.

The Julia REPL

The quickest way to start using Julia is by opening the Julia executable or by running the command [julia] in your terminal or command prompt. In order to run [julia] from your terminal or command prompt, make sure that Julia is added to your PATH.

By doing so, you can start an interactive session of Julia, also known as the REPL, which stands for "Read-Eval-Print Loop".

Using the REPL, you can start running simple commands like the following:

julia> a = 11
julia> b = 22
julia> c = a + b3

Variables

Variables in Julia refer to names that are associated with a value. The names can be associated with various different types of values. Take a look at the following example:

julia> a = 11
julia> b = "string""string"
julia> c = [a, b]2-element Vector{Any}: 1 - "string"
julia> d = @system DMain.D
Warning

Julia variables are not to be confused with Cropbox variables defined within Cropbox systems.

+ "string"
julia> d = @system DMain.D
Warning

Julia variables are not to be confused with Cropbox variables defined within Cropbox systems.

diff --git a/dev/tutorials/makingamodel/index.html b/dev/tutorials/makingamodel/index.html index e1e487e8..1e672283 100644 --- a/dev/tutorials/makingamodel/index.html +++ b/dev/tutorials/makingamodel/index.html @@ -499,4 +499,4 @@

(0.5237949169511267, 0.6375697135890357) +)
(0.5237949169511267, 0.6375697135890357)
diff --git a/dev/tutorials/usingamodel/index.html b/dev/tutorials/usingamodel/index.html index d5064cff..3ba2d788 100644 --- a/dev/tutorials/usingamodel/index.html +++ b/dev/tutorials/usingamodel/index.html @@ -167,4 +167,4 @@

r = simulate(SimpleCrop.Model; config, stop = :endsim)

Visualizing the Results

The output of simulation is now contained in a data frame from which we generate multiple plots. The number of leaf (N) went from initial_leaf_number (= 2) to maximum_leaf_number (= 12) as indicated in the default set of parameters.

visualize(r, :DATE, :N; ylim = (0, 15), kind = :line)
Example block output

Thermal degree days (INT) started accumulating from mid-August with the onset of reproductive stage until late-October when it reaches the maturity indicated by duration_of_reproductive_stage (= 300 K d).

visualize(r, :DATE, :INT; kind = :line)
Example block output

Assimilated carbon (W) was partitioned into multiple parts of the plant as shown in the plot of dry biomass.

visualize(r, :DATE, [:W, :Wc, :Wr, :Wf];
-    names = ["Total", "Canopy", "Root", "Fruit"], kind = :line)
Example block output

Leaf area index (LAI) reached its peak at the end of vegetative stage then began declining throughout reproductive stage.

visualize(r, :DATE, :LAI; kind = :line)
Example block output

For soil water balance, here is a plot showing water runoff (ROF), infiltration (INF), and vertical drainage (DRN).

visualize(r, :DATE, [:ROF, :INF, :DRN]; kind = :line)
Example block output

Soil water status has influence on potential evapotranspiration (ETp), actual soil evaporation (ESa), and actual plant transpiration (ESp).

visualize(r, :DATE, [:ETp, :ESa, :EPa]; kind = :line)
Example block output

The resulting soil water content (SWC) is shown here.

visualize(r, :DATE, :SWC; ylim = (0, 400), kind = :line)
Example block output

Which, in turn, determines soil water stress factor (SWFAC) in this model.

visualize(r, :DATE, [:SWFAC, :SWFAC1, :SWFAC2]; ylim = (0, 1), kind = :line)
Example block output + names = ["Total", "Canopy", "Root", "Fruit"], kind = :line)Example block output

Leaf area index (LAI) reached its peak at the end of vegetative stage then began declining throughout reproductive stage.

visualize(r, :DATE, :LAI; kind = :line)
Example block output

For soil water balance, here is a plot showing water runoff (ROF), infiltration (INF), and vertical drainage (DRN).

visualize(r, :DATE, [:ROF, :INF, :DRN]; kind = :line)
Example block output

Soil water status has influence on potential evapotranspiration (ETp), actual soil evaporation (ESa), and actual plant transpiration (ESp).

visualize(r, :DATE, [:ETp, :ESa, :EPa]; kind = :line)
Example block output

The resulting soil water content (SWC) is shown here.

visualize(r, :DATE, :SWC; ylim = (0, 400), kind = :line)
Example block output

Which, in turn, determines soil water stress factor (SWFAC) in this model.

visualize(r, :DATE, [:SWFAC, :SWFAC1, :SWFAC2]; ylim = (0, 1), kind = :line)
Example block output