Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kmdeck committed Dec 7, 2024
1 parent 10ff617 commit d429bad
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
15 changes: 8 additions & 7 deletions src/Artifacts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,20 @@ end
"""
soil_grids_params_artifact_path(; lowres = true, context)
Return the path to the folder that contains the soil texture parameters
Return the path to the file that contains the soil texture parameters
needed for the Balland and Arp (2005) thermal conductivity model.
Returns a ~1 degree version by default (lowres = true).
"""
function soil_grids_params_artifact_folder_path(;
context = nothing,
lowres = true,
)
function soil_grids_params_artifact_path(; context = nothing, lowres = true)
if lowres
return @clima_artifact("soilgrids_lowres", context)
dir = @clima_artifact("soilgrids_lowres", context)
file = "soil_solid_vol_fractions_soilgrids_lowres.nc"
return joinpath(dir, file)
else
return @clima_artifact("soilgrids", context)
dir = @clima_artifact("soilgrids", context)
file = "soil_solid_vol_fractions_soilgrids.nc"
return joinpath(dir, file)
end
end

Expand Down
14 changes: 7 additions & 7 deletions src/simulations/spatial_parameters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -295,12 +295,11 @@ function default_spatially_varying_soil_parameters(
1,
)

soilgrids_artifact_dir =
ClimaLand.Artifacts.soil_grids_params_artifact_folder_path(;
soilgrids_artifact_path =
ClimaLand.Artifacts.soil_grids_params_artifact_path(;
lowres = true,
context,
)
soilgrids_artifact_path = joinpath(soilgrids_artifact_dir, "soil_solid_vol_fractions_soilgrids_lowres.nc")
ν_ss_om = SpaceVaryingInput(
soilgrids_artifact_path,
"nu_ss_om",
Expand All @@ -327,12 +326,13 @@ function default_spatially_varying_soil_parameters(
# we require that the sum of these be less than 1 and equal to or bigger than zero.
# The input should satisfy this almost exactly, but the regridded values may not.
function texture_sum_norm(ν_ss_gravel, ν_ss_quartz, ν_ss_om)
texture_sum = ν_ss_gravel + ν_ss_quartz + ν_ss_om
texture_sum = ν_ss_gravel + ν_ss_quartz + ν_ss_om
texture_norm = texture_sum <= 1 ? 1 : texture_sum
end
@. ν_ss_gravel = ν_ss_gravel / texture_sum_norm(ν_ss_gravel, ν_ss_quartz, ν_ss_om)
@. ν_ss_om = ν_ss_om / texture_sum_norm(ν_ss_gravel, ν_ss_quartz, ν_ss_om)
@. ν_ss_quartz = ν_ss_quartz / texture_sum_norm(ν_ss_gravel, ν_ss_quartz, ν_ss_om)
texture_norm = texture_sum_norm.(ν_ss_gravel, ν_ss_quartz, ν_ss_om)
@. ν_ss_gravel = ν_ss_gravel / texture_norm
@. ν_ss_om = ν_ss_om / texture_norm
@. ν_ss_quartz = ν_ss_quartz / texture_norm


soil_params_mask_sfc =
Expand Down

0 comments on commit d429bad

Please sign in to comment.