From 22dd5a6f8deae15df48b547b233b605ebba133fc Mon Sep 17 00:00:00 2001 From: imreddyTeja Date: Fri, 4 Oct 2024 15:52:16 -0700 Subject: [PATCH 1/2] Change albedo artifascts to use ClimaArtifacts Both cesm2_albedo_dataset_path and bareground_albedo_dataset_path now use the new ClimaArtifact cesm2_albedo. This commit also deletes src/standalone/Bucket/artifacts, which was in an include, but never used. --- Artifacts.toml | 7 +++ src/Artifacts.jl | 28 ++--------- src/standalone/Bucket/Bucket.jl | 3 -- src/standalone/Bucket/artifacts/artifacts.jl | 51 -------------------- 4 files changed, 12 insertions(+), 77 deletions(-) delete mode 100644 src/standalone/Bucket/artifacts/artifacts.jl diff --git a/Artifacts.toml b/Artifacts.toml index da7f7d6270..ec4b49daa5 100644 --- a/Artifacts.toml +++ b/Artifacts.toml @@ -1,3 +1,10 @@ +[cesm2_albedo] +git-tree-sha1 = "316096635acaa8102477820f480ca02fe66eb828" + + [[cesm2_albedo.download]] + sha256 = "5ac358d4485f6ba7bae129d4570cabc712b793d4a3e22caa8808de147b2c8f9b" + url = "https://caltech.box.com/shared/static/awz2lku3ngoto6t78muktzfk3kjloxsw.gz" + [clm_data] git-tree-sha1 = "5fcb868a751f4a2e32181612bb0c123e9a8e7e97" diff --git a/src/Artifacts.jl b/src/Artifacts.jl index 650c1147d8..b9154763b8 100644 --- a/src/Artifacts.jl +++ b/src/Artifacts.jl @@ -304,19 +304,10 @@ This dataset contains monthly albedo data from 15/01/1850 to 15/12/2014. """ function cesm2_albedo_dataset_path(; context = nothing) - dir = joinpath(@__DIR__, "../") - land_albedo_dataset = ArtifactWrapper( - dir, - "land_albedo", - ArtifactFile[ArtifactFile( - url = "https://caltech.box.com/shared/static/1uhqspj4xujkyz661x0pio59hvmgsi5c.nc", - filename = "esw_albedo_Amon_CESM2_historical_r1i1p1f1_gn_185001-201412_v2.nc", - ),], - ) - path = get_data_folder(land_albedo_dataset) + artifact_path = @clima_artifact("cesm2_albedo", context) return joinpath( - path, - "esw_albedo_Amon_CESM2_historical_r1i1p1f1_gn_185001-201412_v2.nc", + artifact_path, + "sw_albedo_Amon_CESM2_historical_r1i1p1f1_gn_185001-201412_v2_no-nans.nc", ) end @@ -330,17 +321,8 @@ this file. This dataset does not contain a time component. """ function bareground_albedo_dataset_path(; context = nothing) - dir = joinpath(@__DIR__, "../") - bareground_albedo_dataset = ArtifactWrapper( - dir, - "bareground_albedo", - ArtifactFile[ArtifactFile( - url = "https://caltech.box.com/shared/static/ga9385kyl82t955dylsbnn4x51b412md.nc", - filename = "bareground_albedo.nc", - ),], - ) - path = get_data_folder(bareground_albedo_dataset) - return joinpath(path, "bareground_albedo.nc") + artifact_path = @clima_artifact("cesm2_albedo", context) + return joinpath(artifact_path, "bareground_albedo.nc") end end diff --git a/src/standalone/Bucket/Bucket.jl b/src/standalone/Bucket/Bucket.jl index 26f5aadc62..551ba842c4 100644 --- a/src/standalone/Bucket/Bucket.jl +++ b/src/standalone/Bucket/Bucket.jl @@ -56,9 +56,6 @@ export BucketModelParameters, surface_albedo, partition_snow_surface_fluxes -include( - joinpath(pkgdir(ClimaLand), "src/standalone/Bucket/artifacts/artifacts.jl"), -) abstract type AbstractBucketModel{FT} <: AbstractExpModel{FT} end diff --git a/src/standalone/Bucket/artifacts/artifacts.jl b/src/standalone/Bucket/artifacts/artifacts.jl deleted file mode 100644 index 03933b052c..0000000000 --- a/src/standalone/Bucket/artifacts/artifacts.jl +++ /dev/null @@ -1,51 +0,0 @@ -import ArtifactWrappers as AW - -export cesm2_albedo_dataset_path, bareground_albedo_dataset_path - -""" - cesm2_albedo_dataset_path() - -Triggers the download of the CESM2 land albedo dataset, if not -already downloaded, using Julia Artifacts, and returns the path to -this file. - -This dataset contains monthly albedo data from 15/01/1850 -to 15/12/2014. -""" -function cesm2_albedo_dataset_path() - land_albedo_dataset = AW.ArtifactWrapper( - @__DIR__, - "land_albedo", - AW.ArtifactFile[AW.ArtifactFile( - url = "https://caltech.box.com/shared/static/eesee8iv3c21z3pysizcgnuncfp5xykv.nc", - filename = "esw_albedo_Amon_CESM2_historical_r1i1p1f1_gn_185001-201412_v2.nc", - ),], - ) - path = AW.get_data_folder(land_albedo_dataset) - return joinpath( - path, - "esw_albedo_Amon_CESM2_historical_r1i1p1f1_gn_185001-201412_v2.nc", - ) -end - -""" - bareground_albedo_dataset_path() - -Triggers the download of the average bareground land albedo dataset, if not -already downloaded, using Julia Artifacts, and returns the path to -this file. - -This dataset does not contain a time component. -""" -function bareground_albedo_dataset_path() - bareground_albedo_dataset = AW.ArtifactWrapper( - @__DIR__, - "bareground_albedo", - AW.ArtifactFile[AW.ArtifactFile( - url = "https://caltech.box.com/shared/static/ga9385kyl82t955dylsbnn4x51b412md.nc", - filename = "bareground_albedo.nc", - ),], - ) - path = AW.get_data_folder(bareground_albedo_dataset) - return joinpath(path, "bareground_albedo.nc") -end From cd2656b6e7d5b55f93a94f20babeb28b1b8fae48 Mon Sep 17 00:00:00 2001 From: imreddyTeja Date: Fri, 4 Oct 2024 16:04:43 -0700 Subject: [PATCH 2/2] Add function to get folder --- src/Artifacts.jl | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/Artifacts.jl b/src/Artifacts.jl index b9154763b8..732acdfc2a 100644 --- a/src/Artifacts.jl +++ b/src/Artifacts.jl @@ -293,6 +293,20 @@ function mizoguchi1990_soil_freezing_data(; context = nothing) return dataset_path end +""" + cesm2_albedo_dataset_folder() + +Triggers the download of the CESM2 albedo folder, if not +already downloaded, using Julia Artifacts, and returns the path to +this file. + +This dataset contains monthly albedo data from 15/01/1850 +to 15/12/2014. +""" +function cesm2_albedo_dataset_folder(; context = nothing) + return artifact_path = @clima_artifact("cesm2_albedo", context) +end + """ cesm2_albedo_dataset_path() @@ -304,9 +318,8 @@ This dataset contains monthly albedo data from 15/01/1850 to 15/12/2014. """ function cesm2_albedo_dataset_path(; context = nothing) - artifact_path = @clima_artifact("cesm2_albedo", context) return joinpath( - artifact_path, + cesm2_albedo_dataset_folder(; context), "sw_albedo_Amon_CESM2_historical_r1i1p1f1_gn_185001-201412_v2_no-nans.nc", ) end @@ -321,8 +334,10 @@ this file. This dataset does not contain a time component. """ function bareground_albedo_dataset_path(; context = nothing) - artifact_path = @clima_artifact("cesm2_albedo", context) - return joinpath(artifact_path, "bareground_albedo.nc") + return joinpath( + cesm2_albedo_dataset_folder(; context), + "bareground_albedo.nc", + ) end end