From fdf0cc22afe0713c5a1bf1c5fd5b9c9b4b92d54d Mon Sep 17 00:00:00 2001 From: monty Date: Fri, 24 Nov 2023 12:48:47 -0700 Subject: [PATCH] addobs --- src/MadsCalibrate.jl | 2 +- src/MadsObservations.jl | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/MadsCalibrate.jl b/src/MadsCalibrate.jl index d38b12ef..cc5fb275 100644 --- a/src/MadsCalibrate.jl +++ b/src/MadsCalibrate.jl @@ -208,7 +208,7 @@ function calibrate(madsdata::AbstractDict; tolX::Number=1e-4, tolG::Number=1e-6, rootname = Mads.getmadsrootname(madsdata) madsdir = Mads.getmadsproblemdir(madsdata) if !isdir(madsdir) - mkdir(madsdir) + Mads.recursivemkdir(madsdir) end f_lm, g_lm, o_lm = Mads.makelmfunctions(madsdata; parallel_gradients=parallel_optimization) optparamkeys = Mads.getoptparamkeys(madsdata) diff --git a/src/MadsObservations.jl b/src/MadsObservations.jl index 18afbac3..e867012b 100644 --- a/src/MadsObservations.jl +++ b/src/MadsObservations.jl @@ -3,6 +3,13 @@ import OrderedCollections import DocumentFunction import JSON +function addobs!(madsdata::AbstractDict, obskey::AbstractString, obs::AbstractDict) + if !haskey(madsdata, "Observations") + madsdata["Observations"] = OrderedCollections.OrderedDict{String,OrderedCollections.OrderedDict}() + end + madsdata["Observations"][obskey] = obs +end + """ Is a dictionary containing all the observations