Skip to content

Commit

Permalink
Merge pull request #914 from CliMA/es/fluxnet_climaArtifact
Browse files Browse the repository at this point in the history
Use fluxnet data from ClimaArtifacts
  • Loading branch information
Espeer5 authored Nov 8, 2024
2 parents 767825d + 871f8e9 commit 1a98220
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 24 deletions.
7 changes: 7 additions & 0 deletions Artifacts.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,10 @@ git-tree-sha1 = "043f9354b961fd3ef6ac4cf71d0c99930e177a92"
[[bonan_richards_eqn.download]]
sha256 = "50f1739dfd8193742488f249bd1ba8a157dfc7c1d8a27392ba7edbe9b4c0db03"
url = "https://caltech.box.com/shared/static/4jcz9c1lp6rt750q28kx3qvihi8393tv.gz"

[fluxnet_sites]
git-tree-sha1 = "2fc70601badf6f83dee2b84ba9c386ad041de8e2"

[[fluxnet_sites.download]]
sha256 = "f05b4c01b57afe9c0f59095b39cea1c0cf46b20deecd5c7afb44f474d9cd9966"
url = "https://caltech.box.com/shared/static/otrr2y0rgjct7hqhmq214nb8qjsvqj5p.gz"
2 changes: 1 addition & 1 deletion experiments/integrated/fluxnet/met_drivers_FLUXNET.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ include(
joinpath(pkgdir(ClimaLand), "experiments/integrated/fluxnet/pull_MODIS.jl"),
)

data_path = ClimaLand.Artifacts.experiment_fluxnet_data_path(site_ID, data_link)
data_path = ClimaLand.Artifacts.experiment_fluxnet_data_path(site_ID)
driver_data = readdlm(data_path, ',')

LOCAL_DATETIME = DateTime.(format.(driver_data[2:end, 1]), "yyyymmddHHMM")
Expand Down
6 changes: 6 additions & 0 deletions lib/ClimaLandSimulations/src/Artifacts.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[fluxnet_sites]
git-tree-sha1 = "2fc70601badf6f83dee2b84ba9c386ad041de8e2"

[[fluxnet_sites.download]]
sha256 = "f05b4c01b57afe9c0f59095b39cea1c0cf46b20deecd5c7afb44f474d9cd9966"
url = "https://caltech.box.com/shared/static/otrr2y0rgjct7hqhmq214nb8qjsvqj5p.gz"
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
export make_drivers

import ClimaUtilities.ClimaArtifacts: @clima_artifact

function make_drivers(site_ID, setup, config, params, context)
#earth_param_set = create_lsm_parameters(FT)

af = ArtifactFile(
url = config.data_link,
filename = "AMF_$(site_ID)_FLUXNET_FULLSET.csv",
)
dataset = ArtifactWrapper(
"$climalandsimulations_dir/src/Fluxnet/fluxnet_sites/$site_ID",
"ameriflux_data",
ArtifactFile[af],
)
dataset_path = get_data_folder(dataset)
data = joinpath(dataset_path, "AMF_$(site_ID)_FLUXNET_FULLSET.csv")
dataset_path = @clima_artifact("fluxnet_sites", context)
data = joinpath(dataset_path, "$(site_ID).csv")
driver_data = readdlm(data, ',')

LOCAL_DATETIME = DateTime.(format.(driver_data[2:end, 1]), "yyyymmddHHMM")
Expand Down
17 changes: 5 additions & 12 deletions src/Artifacts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ end

"""
experiment_fluxnet_data_path(
site_ID,
data_link;
site_ID;
context = nothing,
)
Expand Down Expand Up @@ -86,17 +85,11 @@ Citation: Siyan Ma, Liukang Xu, Joseph Verfaillie, Dennis Baldocchi (2023), Amer
AmeriFlux CC-BY-4.0 License
"""
function experiment_fluxnet_data_path(site_ID, data_link; context = nothing)
function experiment_fluxnet_data_path(site_ID; context = nothing)
@assert site_ID ("US-MOz", "US-Var", "US-NR1", "US-Ha1")
dir = joinpath(@__DIR__, "../")
af = ArtifactFile(
url = data_link,
filename = "AMF_$(site_ID)_FLUXNET_FULLSET.csv",
)
dataset =
ArtifactWrapper(dir, "ameriflux_data_$(site_ID)", ArtifactFile[af])
folder_path = get_data_folder(dataset)
data_path = joinpath(folder_path, "AMF_$(site_ID)_FLUXNET_FULLSET.csv")

folder_path = @clima_artifact("fluxnet_sites", context)
data_path = joinpath(folder_path, "$(site_ID).csv")
return data_path
end

Expand Down

0 comments on commit 1a98220

Please sign in to comment.