Skip to content

Commit

Permalink
Small changes in Results struct (#54)
Browse files Browse the repository at this point in the history
* Multiprocessing fixed for OGGM

* Bug fixed

* Dynamic scope for OGGM config

* No multiprocessing downloading of climate data in test mode

* Test files updated

* Test mode added on test

* Sleipnir update for Functional inversions

* Small changes in Results struct

Changes to accommodate less complete results from the Halfar solution.
  • Loading branch information
JordiBolibar committed May 24, 2024
1 parent cf2ae77 commit 062acc6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
20 changes: 10 additions & 10 deletions src/simulations/results/Results.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ mutable struct Results{F <: AbstractFloat}
V::Matrix{F}
Vx::Matrix{F}
Vy::Matrix{F}
V_ref::Matrix{F}
Vx_ref::Matrix{F}
Vy_ref::Matrix{F}
V_ref::Union{Nothing, Matrix{F}}
Vx_ref::Union{Nothing, Matrix{F}}
Vy_ref::Union{Nothing, Matrix{F}}
Δx::F
Δy::F
lon::F
lat::F
lon::Union{Nothing, F}
lat::Union{Nothing, F}
θ::Union{Nothing, Vector{F}}
loss::Union{Nothing, Vector{F}}
end
Expand All @@ -29,13 +29,13 @@ function Results(glacier::G, ifm::IF;
V::Matrix{F} = zeros(F, size(ifm.V)),
Vx::Matrix{F} = zeros(F, size(ifm.Vx)),
Vy::Matrix{F} = zeros(F, size(ifm.Vy)),
V_ref::Matrix{F} = glacier.V,
Vx_ref::Matrix{F} = glacier.Vx,
Vy_ref::Matrix{F} = glacier.Vy,
V_ref::Union{Nothing, Matrix{F}} = glacier.V,
Vx_ref::Union{Nothing, Matrix{F}} = glacier.Vx,
Vy_ref::Union{Nothing, Matrix{F}} = glacier.Vy,
Δx::F = glacier.Δx,
Δy::F = glacier.Δy,
lon::F = glacier.cenlon,
lat::F = glacier.cenlat,
lon::Union{Nothing, F} = glacier.cenlon,
lat::Union{Nothing, F} = glacier.cenlat,
θ::Union{Nothing,Vector{F}} = nothing,
loss::Union{Nothing,Vector{F}} = nothing
) where {G <: AbstractGlacier, F <: AbstractFloat, IF <: AbstractModel}
Expand Down
8 changes: 7 additions & 1 deletion src/simulations/results/results_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ function create_results(simulation::SIM, glacier_idx::I, solution, loss=nothing;
else
iceflow_model = simulation.model.iceflow[batch_id]
end
if !isnothing(simulation.model.machine_learning)
θ = simulation.model.machine_learning.θ
else
θ = nothing
end

results = Results(simulation.glaciers[glacier_idx], iceflow_model;
H = H,
S = iceflow_model.S,
Expand All @@ -24,7 +30,7 @@ function create_results(simulation::SIM, glacier_idx::I, solution, loss=nothing;
Δy = simulation.glaciers[glacier_idx].Δy,
lon = simulation.glaciers[glacier_idx].cenlon,
lat = simulation.glaciers[glacier_idx].cenlat,
θ = simulation.model.machine_learning.θ,
θ = θ,
loss = loss
)

Expand Down

0 comments on commit 062acc6

Please sign in to comment.