From d429badb82ce47b8ed518fea92e04e7b27539b2d Mon Sep 17 00:00:00 2001 From: kmdeck Date: Fri, 6 Dec 2024 16:14:02 -0800 Subject: [PATCH] review comments --- src/Artifacts.jl | 15 ++++++++------- src/simulations/spatial_parameters.jl | 14 +++++++------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/Artifacts.jl b/src/Artifacts.jl index 414b1ef6b0..fd8abe052f 100644 --- a/src/Artifacts.jl +++ b/src/Artifacts.jl @@ -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 diff --git a/src/simulations/spatial_parameters.jl b/src/simulations/spatial_parameters.jl index d5779246e7..1e7dd036eb 100644 --- a/src/simulations/spatial_parameters.jl +++ b/src/simulations/spatial_parameters.jl @@ -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", @@ -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 =