2020-02-10 23:32:44 +00:00
|
|
|
module Model = {
|
2020-02-14 21:53:47 +00:00
|
|
|
let make = (currentDateTime: MomentRe.Moment.t) => {
|
|
|
|
let yearsFromNow = "normal(50,30)";
|
|
|
|
let dist = CdfLibrary.Distribution.fromString(yearsFromNow, 1000);
|
|
|
|
let timeLimitedDomain =
|
|
|
|
TimeLimitedDomainCdf.make(
|
|
|
|
~timeVector={zero: currentDateTime, unit: `years},
|
|
|
|
~distribution=dist,
|
|
|
|
~probabilityAtMaxX=0.7,
|
|
|
|
~maxX=`x(200.),
|
|
|
|
);
|
|
|
|
Prop.Value.TimeLimitedDomainCdf(timeLimitedDomain);
|
2020-02-10 23:32:44 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
module Interface = {
|
|
|
|
let dayKey = "Day";
|
|
|
|
|
|
|
|
let run = (p: Prop.Combo.t) => {
|
|
|
|
switch (Prop.Combo.InputValues.toValueArray(p)) {
|
2020-02-14 21:53:47 +00:00
|
|
|
| [|Some(DateTime(currentYear))|] => Some(Model.make(currentYear))
|
2020-02-10 23:32:44 +00:00
|
|
|
| _ => None
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
let model: Prop.Model.t =
|
|
|
|
Prop.{
|
|
|
|
name: "Global Catastrophe",
|
2020-02-10 23:45:54 +00:00
|
|
|
description: "The chances of having at least one catastrophe per year in the future, assuming no other catastrophe until then.",
|
2020-02-10 23:32:44 +00:00
|
|
|
version: "1.0.0",
|
|
|
|
author: "Ozzie Gooen",
|
2020-02-14 21:53:47 +00:00
|
|
|
inputTypes: [|TypeWithMetadata.currentYear|],
|
2020-02-10 23:32:44 +00:00
|
|
|
outputTypes: [||],
|
|
|
|
run,
|
|
|
|
};
|
|
|
|
};
|