Skip to content

Commit b6d5976

Browse files
committed
clm parameters to tuples
1 parent f2efcab commit b6d5976

File tree

8 files changed

+40
-76
lines changed

8 files changed

+40
-76
lines changed

experiments/benchmarks/land.jl

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -129,16 +129,8 @@ function setup_prob(t0, tf, Δt; nelements = (101, 15))
129129
)
130130
# Spatially varying canopy parameters from CLM
131131
clm_parameters = ClimaLand.clm_canopy_parameters(surface_space)
132-
(;
133-
Ω,
134-
rooting_depth,
135-
is_c3,
136-
Vcmax25,
137-
g1,
138-
G_Function,
139-
ρ_leaf,
140-
τ_leaf,
141-
) = clm_parameters
132+
(; Ω, rooting_depth, is_c3, Vcmax25, g1, G_Function, ρ_leaf, τ_leaf) =
133+
clm_parameters
142134

143135
# Energy Balance model
144136
ac_canopy = FT(2.5e3)

experiments/integrated/global/global_parameters.jl

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,8 @@ runoff_model = ClimaLand.Soil.Runoff.TOPMODELRunoff{FT}(;
4141

4242
# Spatially varying canopy parameters from CLM
4343
clm_parameters = ClimaLand.clm_canopy_parameters(surface_space)
44-
(;
45-
Ω,
46-
rooting_depth,
47-
is_c3,
48-
Vcmax25,
49-
g1,
50-
G_Function,
51-
ρ_leaf,
52-
τ_leaf,
53-
) = clm_parameters
44+
(; Ω, rooting_depth, is_c3, Vcmax25, g1, G_Function, ρ_leaf, τ_leaf) =
45+
clm_parameters
5446
# Energy Balance model
5547
ac_canopy = FT(2.5e3)
5648
# Plant Hydraulics and general plant parameters

experiments/integrated/global/global_soil_canopy.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ atmos, radiation = ClimaLand.prescribed_forcing_era5(
6464
time_interpolation_method = time_interpolation_method,
6565
)
6666

67-
# Discretization of radiationi
67+
# Discretization of radiation
6868
spectral_discretization = ClimaLand.TwoBandSpectralDiscretization{FT}()
6969

7070
include(
@@ -111,8 +111,6 @@ canopy_component_types = (;
111111
autotrophic_respiration_args =
112112
(; parameters = Canopy.AutotrophicRespirationParameters(FT))
113113
# Set up radiative transfer
114-
ρ_leaf = @. (ρ_PAR_leaf, ρ_NIR_leaf)
115-
τ_leaf = @. (τ_PAR_leaf, τ_NIR_leaf)
116114
radiative_transfer_args = (;
117115
parameters = Canopy.TwoStreamParameters(
118116
FT;

experiments/long_runs/land.jl

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -129,16 +129,8 @@ function setup_prob(t0, tf, Δt; outdir = outdir, nelements = (101, 15))
129129

130130
# Spatially varying canopy parameters from CLM
131131
clm_parameters = ClimaLand.clm_canopy_parameters(surface_space)
132-
(;
133-
Ω,
134-
rooting_depth,
135-
is_c3,
136-
Vcmax25,
137-
g1,
138-
G_Function,
139-
ρ_leaf,
140-
τ_leaf,
141-
) = clm_parameters
132+
(; Ω, rooting_depth, is_c3, Vcmax25, g1, G_Function, ρ_leaf, τ_leaf) =
133+
clm_parameters
142134

143135
# Energy Balance model
144136
ac_canopy = FT(2.5e3)

experiments/long_runs/land_region.jl

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,16 +134,8 @@ function setup_prob(t0, tf, Δt; outdir = outdir, nelements = (10, 10, 15))
134134

135135
# Spatially varying canopy parameters from CLM
136136
clm_parameters = ClimaLand.clm_canopy_parameters(surface_space)
137-
(;
138-
Ω,
139-
rooting_depth,
140-
is_c3,
141-
Vcmax25,
142-
g1,
143-
G_Function,
144-
ρ_leaf,
145-
τ_leaf,
146-
) = clm_parameters
137+
(; Ω, rooting_depth, is_c3, Vcmax25, g1, G_Function, ρ_leaf, τ_leaf) =
138+
clm_parameters
147139
# Energy Balance model
148140
ac_canopy = FT(2.5e3)
149141
# Plant Hydraulics and general plant parameters

experiments/long_runs/snowy_land.jl

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,16 +134,8 @@ function setup_prob(t0, tf, Δt; outdir = outdir, nelements = (101, 15))
134134

135135
# Spatially varying canopy parameters from CLM
136136
clm_parameters = ClimaLand.clm_canopy_parameters(surface_space)
137-
(;
138-
Ω,
139-
rooting_depth,
140-
is_c3,
141-
Vcmax25,
142-
g1,
143-
G_Function,
144-
ρ_leaf,
145-
τ_leaf,
146-
) = clm_parameters
137+
(; Ω, rooting_depth, is_c3, Vcmax25, g1, G_Function, ρ_leaf, τ_leaf) =
138+
clm_parameters
147139

148140
# Energy Balance model
149141
ac_canopy = FT(2.5e3)

src/simulations/spatial_parameters.jl

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,23 +73,37 @@ function clm_canopy_parameters(
7373
regridder_kwargs = (; extrapolation_bc,),
7474
)
7575
G_Function = CLMGFunction(χl)
76-
compose_function = (PAR, NIR) -> (PAR, NIR)
77-
ρ_leaf = SpaceVaryingInput(
76+
ρ_PAR_leaf = SpaceVaryingInput(
7877
joinpath(clm_artifact_path, "vegetation_properties_map.nc"),
79-
["rholvis", "rholnir"],
78+
"rholvis",
8079
surface_space;
8180
regridder_type,
8281
regridder_kwargs = (; extrapolation_bc,),
83-
compose_function,
8482
)
85-
τ_leaf = SpaceVaryingInput(
83+
ρ_NIR_leaf = SpaceVaryingInput(
8684
joinpath(clm_artifact_path, "vegetation_properties_map.nc"),
87-
["taulvis", "taulnir"],
85+
"rholnir",
8886
surface_space;
8987
regridder_type,
9088
regridder_kwargs = (; extrapolation_bc,),
91-
compose_function,
9289
)
90+
τ_PAR_leaf = SpaceVaryingInput(
91+
joinpath(clm_artifact_path, "vegetation_properties_map.nc"),
92+
"taulvis",
93+
surface_space;
94+
regridder_type,
95+
regridder_kwargs = (; extrapolation_bc,),
96+
)
97+
τ_NIR_leaf = SpaceVaryingInput(
98+
joinpath(clm_artifact_path, "vegetation_properties_map.nc"),
99+
"taulnir",
100+
surface_space;
101+
regridder_type,
102+
regridder_kwargs = (; extrapolation_bc,),
103+
)
104+
to_tuple_valued_field = (PAR, NIR) -> (PAR, NIR)
105+
ρ_leaf = to_tuple_valued_field.(ρ_PAR_leaf, ρ_NIR_leaf)
106+
τ_leaf = to_tuple_valued_field.(τ_PAR_leaf, τ_NIR_leaf)
93107
# Conductance Model
94108
# g1 is read in units of sqrt(kPa) and then converted to sqrt(Pa)
95109
g1 = SpaceVaryingInput(
@@ -352,6 +366,9 @@ function default_spatially_varying_soil_parameters(
352366
"NIR_albedo_wet",
353367
),
354368
)
369+
to_tuple_valued_field = (PAR, NIR) -> (PAR, NIR)
370+
albedo_dry = to_tuple_valued_field.(PAR_albedo_dry, NIR_albedo_dry)
371+
albedo_wet = to_tuple_valued_field.(PAR_albedo_wet, NIR_albedo_wet)
355372

356373
return (;
357374
ν = ν,
@@ -362,8 +379,8 @@ function default_spatially_varying_soil_parameters(
362379
K_sat = K_sat,
363380
S_s = S_s,
364381
θ_r = θ_r,
365-
albedo_wet = (PAR_albedo_wet, NIR_albedo_wet),
366-
albedo_dry = (PAR_albedo_dry, NIR_albedo_dry),
382+
albedo_wet = albedo_wet,
383+
albedo_dry = albedo_dry,
367384
f_max = f_max,
368385
mask = mask,
369386
)

test/simulations/spatial_parameters.jl

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -73,24 +73,13 @@ clm_parameters = ClimaLand.clm_canopy_parameters(
7373
regridder_type = regridder_type,
7474
extrapolation_bc = extrapolation_bc,
7575
)
76-
param_names = (
77-
,
78-
:rooting_depth,
79-
:is_c3,
80-
:Vcmax25,
81-
:g1,
82-
:ρ_leaf,
83-
:τ_leaf,
84-
)
85-
param_names_banded = (
86-
:ρ_leaf,
87-
:τ_leaf,
88-
)
76+
param_names = (, :rooting_depth, :is_c3, :Vcmax25, :g1, :ρ_leaf, :τ_leaf)
77+
param_names_banded = (:ρ_leaf, :τ_leaf)
8978
for p in param_names
9079
@test p propertynames(clm_parameters)
9180
@test axes(getproperty(clm_parameters, p)) == surface_space
9281
end
93-
for p in param_nams_banded
82+
for p in param_names_banded
9483
@test p propertynames(clm_parameters)
9584
nbands = length(getproperty(clm_parameters, p))
9685
for i in 1:nbands

0 commit comments

Comments
 (0)