From 9eec259d5fc6448a7983843c21ac497d7d48ecdc Mon Sep 17 00:00:00 2001 From: akshaysridhar Date: Mon, 21 Oct 2024 09:34:40 -0700 Subject: [PATCH] Add earth orography artifacts to toml file Add artifact getter function TEST BUILD: Update `soil_params_mask` to use ETOPO2022 dataset modified: land.jl modified: .buildkite/pipeline.yml modified: experiments/long_runs/land.jl --- .buildkite/pipeline.yml | 2 +- Artifacts.toml | 11 +++++++++ experiments/long_runs/land.jl | 44 +++++++++++++++++++++++++---------- src/Artifacts.jl | 15 ++++++++++++ 4 files changed, 59 insertions(+), 13 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index c843811823..b50cc2d739 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -11,7 +11,7 @@ env: steps: - label: "init environment :computer:" - key: "init_cpu_env" + key: "init_gpu_env" concurrency: 1 concurrency_group: 'depot/climaland-ci' command: diff --git a/Artifacts.toml b/Artifacts.toml index 0c57f5440f..7f76d97feb 100644 --- a/Artifacts.toml +++ b/Artifacts.toml @@ -38,3 +38,14 @@ git-tree-sha1 = "b849eb95c09190095e7bf021494ddeda8858af01" [[modis_clumping_index.download]] sha256 = "e4c766a93a673e5dc22540687ef5616416d65bb13a0f4a67789b95d49ccbb158" url = "https://caltech.box.com/shared/static/ec2y3k5kqpl9wjvtsx3584wgkp5q8dyw.gz" + +[earth_orography_30arcseconds] +git-tree-sha1 = "03dd08fcbf363ed055a176dd7adefb60ff1c3493" + +[earth_orography_60arcseconds] +git-tree-sha1 = "fe19d8dbe7a18ff39588e1f718014b0479d9c0f7" +lazy = true + + [[earth_orography_60arcseconds.download]] + sha256 = "eca66c0701d1c2b9e271742314915ffbf4a0fae92709df611c323f38e019966e" + url = "https://caltech.box.com/shared/static/4asrxcgl6xsgenfcug9p0wkkyhtqilgk.gz" diff --git a/experiments/long_runs/land.jl b/experiments/long_runs/land.jl index 31363cb96e..17636b0549 100644 --- a/experiments/long_runs/land.jl +++ b/experiments/long_runs/land.jl @@ -57,6 +57,10 @@ diagnostics_outdir = joinpath(root_path, "global_diagnostics") outdir = ClimaUtilities.OutputPathGenerator.generate_output_path(diagnostics_outdir) +function mask_land_tendencies(Yₜ, land_mask) + @. Yₜ *= land_mask +end + function setup_prob(t0, tf, Δt; outdir = outdir, nelements = (101, 15)) earth_param_set = LP.LandParameters(FT) @@ -70,8 +74,24 @@ function setup_prob(t0, tf, Δt; outdir = outdir, nelements = (101, 15)) dz_tuple = FT.((10.0, 0.05)), ) surface_space = domain.space.surface + + # Land Mask Example + extrapolation_bc = ( + Interpolations.Periodic(), + Interpolations.Flat(), + ) + comms_ctx = ClimaComms.context(surface_space); + soil_params_mask = SpaceVaryingInput( + ClimaLand.Artifacts.earth_orography_file_path(; context = comms_ctx), + "z", + surface_space; + regridder_kwargs = (; extrapolation_bc,), + file_reader_kwargs = (; preprocess_func = (data) -> data >= 0), + ) + # TODO : Define smoothing operation in preprocess pipeline + subsurface_space = domain.space.subsurface - + start_date = DateTime(2021) # Forcing data era5_artifact_path = @@ -94,17 +114,17 @@ function setup_prob(t0, tf, Δt; outdir = outdir, nelements = (101, 15)) Interpolations.Flat(), Interpolations.Flat(), ) - soil_params_mask = SpaceVaryingInput( - joinpath( - soil_params_artifact_path, - "vGalpha_map_gupta_etal2020_1.0x1.0x4.nc", - ), - "α", - subsurface_space; - regridder_type, - regridder_kwargs = (; extrapolation_bc,), - file_reader_kwargs = (; preprocess_func = (data) -> data > 0,), - ) + #soil_params_mask = SpaceVaryingInput( + # joinpath( + # soil_params_artifact_path, + # "vGalpha_map_gupta_etal2020_1.0x1.0x4.nc", + # ), + # "α", + # subsurface_space; + # regridder_type, + # regridder_kwargs = (; extrapolation_bc,), + # file_reader_kwargs = (; preprocess_func = (data) -> data > 0,), + #) oceans_to_value(field, mask, value) = mask == 1.0 ? field : eltype(field)(value) diff --git a/src/Artifacts.jl b/src/Artifacts.jl index 37d9948435..76e39b5542 100644 --- a/src/Artifacts.jl +++ b/src/Artifacts.jl @@ -349,4 +349,19 @@ function bareground_albedo_dataset_path(; context = nothing) ) end +""" + earth_orography_file_path(; context=nothing) + +Construct the file path for the 60arcsecond orography data NetCDF file. + +Downloads the 60arc-second dataset by default. +""" +function earth_orography_file_path(; context = nothing) + filename = "ETOPO_2022_v1_60s_N90W180_surface.nc" + return joinpath( + @clima_artifact("earth_orography_60arcseconds", context), + filename, + ) +end + end