diff --git a/Project.toml b/Project.toml index 85c0274..1ee9d30 100644 --- a/Project.toml +++ b/Project.toml @@ -5,6 +5,7 @@ version = "0.6.1" [deps] CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0" +ComponentArrays = "b0b7db55-cfe3-40fc-9ded-d10e2dbeff66" CondaPkg = "992eb4ea-22a4-4c89-a5bb-47a3300528ab" Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b" diff --git a/src/Sleipnir.jl b/src/Sleipnir.jl index b46572f..7206b63 100644 --- a/src/Sleipnir.jl +++ b/src/Sleipnir.jl @@ -15,6 +15,7 @@ using Statistics using CairoMakie using Downloads using HDF5 +using ComponentArrays # ############################################## # ############ PARAMETERS ############### diff --git a/src/glaciers/climate/climate2D_utils.jl b/src/glaciers/climate/climate2D_utils.jl index 944dcea..d82fb12 100644 --- a/src/glaciers/climate/climate2D_utils.jl +++ b/src/glaciers/climate/climate2D_utils.jl @@ -204,7 +204,7 @@ end function partial_year(period::Type{<:Period}, float) _year, Δ = divrem(float, 1) - year_start = Date(_year) + year_start = Date(convert(Int,_year)) year = period((year_start + Year(1)) - year_start) partial = period(round(Dates.value(year) * Δ)) year_start + partial diff --git a/src/parameters/Parameters.jl b/src/parameters/Parameters.jl index b99e994..aa61cd3 100644 --- a/src/parameters/Parameters.jl +++ b/src/parameters/Parameters.jl @@ -4,7 +4,7 @@ abstract type AbstractParameters end const AbstractEmptyParams = Union{AbstractParameters,Nothing} -struct Parameters{PPHY <: AbstractEmptyParams, PSIM <: AbstractEmptyParams, PHY <: AbstractEmptyParams, +mutable struct Parameters{PPHY <: AbstractEmptyParams, PSIM <: AbstractEmptyParams, PHY <: AbstractEmptyParams, PSOL <: AbstractEmptyParams, PUDE <: AbstractEmptyParams, POGGM <: AbstractEmptyParams, PINV <: AbstractEmptyParams} physical::PPHY simulation::PSIM diff --git a/src/simulations/results/Results.jl b/src/simulations/results/Results.jl index bb3f6d3..432f13b 100644 --- a/src/simulations/results/Results.jl +++ b/src/simulations/results/Results.jl @@ -15,7 +15,7 @@ mutable struct Results{F <: AbstractFloat} Δy::F lon::Union{Nothing, F} lat::Union{Nothing, F} - θ::Union{Nothing, Vector{F}} + θ::Union{Nothing, ComponentArray{F}} loss::Union{Nothing, Vector{F}} end @@ -36,7 +36,7 @@ function Results(glacier::G, ifm::IF; Δy::F = glacier.Δy, lon::Union{Nothing, F} = glacier.cenlon, lat::Union{Nothing, F} = glacier.cenlat, - θ::Union{Nothing,Vector{F}} = nothing, + θ::Union{Nothing,ComponentArray{F}} = nothing, loss::Union{Nothing,Vector{F}} = nothing ) where {G <: AbstractGlacier, F <: AbstractFloat, IF <: AbstractModel}