From d8dc224b449cb5cbefcfbdc57b69d72ea53da272 Mon Sep 17 00:00:00 2001 From: Gabriele Bozzola Date: Wed, 13 Mar 2024 11:12:31 -0700 Subject: [PATCH] Use SpaceVaryingInput for runoff --- .../standalone/Soil/richards_runoff.jl | 30 +++---------------- 1 file changed, 4 insertions(+), 26 deletions(-) diff --git a/experiments/standalone/Soil/richards_runoff.jl b/experiments/standalone/Soil/richards_runoff.jl index 027e44701d..49674eb858 100644 --- a/experiments/standalone/Soil/richards_runoff.jl +++ b/experiments/standalone/Soil/richards_runoff.jl @@ -11,6 +11,7 @@ using ClimaLand using ClimaLand.Soil import ClimaLand import ClimaLand.Parameters as LP +import ClimaLand.SpaceVaryingInputs: SpaceVaryingInput context = ClimaComms.context() outdir = joinpath(pkgdir(ClimaLand), "experiments/standalone/Soil/artifacts") @@ -37,31 +38,12 @@ topmodel_dataset = ArtifactWrapper( ),], ) infile_path = joinpath(get_data_folder(topmodel_dataset), "means_2.5_new.nc") -regrid_dirpath = "regrid" outfile_root = joinpath(pkgdir(ClimaLand), "experiments/standalone/Soil/static_data_cgll") -ClimaLand.Regridder.hdwrite_regridfile_rll_to_cgll( - FT, - regrid_dirpath, - infile_path, - ["fmax", "landsea_mask"], - surface_space, - outfile_root; - mono = true, -) -file_info = ClimaLand.FileReader.FileInfo( - infile_path, - regrid_dirpath, - ["fmax", "landsea_mask"], - outfile_root, - [], - [], -) -data = ClimaLand.FileReader.PrescribedDataStatic{typeof(file_info)}(file_info) -f_max = ClimaLand.FileReader.get_data_at_date(data, surface_space, "fmax") -mask = - ClimaLand.FileReader.get_data_at_date(data, surface_space, "landsea_mask") +f_max = SpaceVaryingInput(infile_path, "fmax", surface_space) +mask = SpaceVaryingInput(infile_path, "landsea_mask", surface_space) + oceans_to_zero(field, mask) = mask > 0.5 ? field : eltype(field)(0) f_over = FT(3.28) # 1/m R_sb = FT(1.484e-4 / 1000) # m/s @@ -311,7 +293,3 @@ CairoMakie.heatmap!( Colorbar(fig[1, 4], colorrange = clims2) outfile = joinpath(outdir, string("heatmap_∫ϑdz.png")) CairoMakie.save(outfile, fig) - - -# Delete testing directory and files -rm(regrid_dirpath; recursive = true, force = true)