Skip to content

Commit

Permalink
Apply suggested fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
charleskawczynski committed May 15, 2023
1 parent ca82d69 commit a8ecbfd
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
6 changes: 4 additions & 2 deletions experiments/LSM/ozark/ozark_met_drivers_FLUXNET.jl
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ lat = FT(38.7441) # degree
long = FT(-92.2000) # degree

function zenith_angle(
t::FT;
t::FT,
orbital_data;
latitude = lat,
longitude = long,
insol_params = earth_param_set.insol_params,
Expand All @@ -117,7 +118,7 @@ function zenith_angle(
FT(
instantaneous_zenith_angle(
dt,
Insolation.OrbitalData(),
orbital_data,
longitude,
latitude,
insol_params,
Expand All @@ -131,6 +132,7 @@ radiation = ClimaLSM.PrescribedRadiativeFluxes(
SW_IN_spline,
LW_IN_spline;
θs = zenith_angle,
orbital_data = Insolation.OrbitalData(),
)

transpiration = DiagnosticTranspiration{FT}()
5 changes: 3 additions & 2 deletions src/SharedUtilities/drivers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,9 @@ struct PrescribedRadiativeFluxes{FT, SW, LW, T} <: AbstractRadiativeDrivers{FT}
LW_d::LW
"Sun zenith angle, in radians"
θs::T
function PrescribedRadiativeFluxes(FT, SW_d, LW_d; θs = nothing)
args = (SW_d, LW_d, θs)
function PrescribedRadiativeFluxes(FT, SW_d, LW_d; θs = nothing, orbital_data)
args = (SW_d, LW_d, θs, orbital_data)
@assert !isnothing(orbital_data)
return new{FT, typeof.(args)...}(args...)
end
end
Expand Down
2 changes: 1 addition & 1 deletion src/Vegetation/Canopy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ function ClimaLSM.make_update_aux(
energy_per_photon = h * c / λ_γ
SW_d::FT = canopy.radiation.SW_d(t)
LW_d::FT = canopy.radiation.LW_d(t)
θs::FT = canopy.radiation.θs(t)
θs::FT = canopy.radiation.θs(t, canopy.radiation.orbital_data)
PAR = @.(SW_d / (energy_per_photon * N_a) / 2)
K = extinction_coeff.(ld, θs)
APAR .= plant_absorbed_ppfd.(PAR, ρ_leaf, K, LAI, Ω)
Expand Down
6 changes: 4 additions & 2 deletions test/Vegetation/canopy_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,16 @@ include(joinpath(pkgdir(ClimaLSM), "parameters", "create_parameters.jl"))
long = FT(-180) # degree

function zenith_angle(
t::FT;
t::FT,
orbital_data;
latitude = lat,
longitude = long,
insol_params = earth_param_set.insol_params,
) where {FT}
return FT(
instantaneous_zenith_angle(
DateTime(t),
Insolation.OrbitalData(),
orbital_data,
longitude,
latitude,
insol_params,
Expand Down Expand Up @@ -98,6 +99,7 @@ include(joinpath(pkgdir(ClimaLSM), "parameters", "create_parameters.jl"))
shortwave_radiation,
longwave_radiation;
θs = zenith_angle,
orbital_data = Insolation.OrbitalData(),
)

# Plant Hydraulics
Expand Down
6 changes: 4 additions & 2 deletions test/Vegetation/plant_hydraulics_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,16 @@ domains = [
long = FT(-180) # degree

function zenith_angle(
t::FT;
t::FT,
orbital_data;
latitude = lat,
longitude = long,
insol_params = earth_param_set.insol_params,
) where {FT}
return FT(
instantaneous_zenith_angle(
DateTime(t),
Insolation.OrbitalData(),
orbital_data,
longitude,
latitude,
insol_params,
Expand Down Expand Up @@ -102,6 +103,7 @@ domains = [
shortwave_radiation,
longwave_radiation;
θs = zenith_angle,
orbital_data = Insolation.OrbitalData(),
)
for domain in domains
# Parameters are the same as the ones used in the Ozark tutorial
Expand Down

0 comments on commit a8ecbfd

Please sign in to comment.