Skip to content

Commit

Permalink
Use SpaceVaryingInput for runoff
Browse files Browse the repository at this point in the history
  • Loading branch information
Sbozzolo committed Mar 27, 2024
1 parent a3dadab commit d8dc224
Showing 1 changed file with 4 additions and 26 deletions.
30 changes: 4 additions & 26 deletions experiments/standalone/Soil/richards_runoff.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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
Expand Down Expand Up @@ -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)

0 comments on commit d8dc224

Please sign in to comment.