Skip to content

Commit 481504e

Browse files
Sbozzolojuliasloan25
authored andcommitted
Conditionally use high res version of SST/SIC
Following CliMA/ClimaArtifacts#45, we have a thinned down artifact that can be automatically downloaded if the higher resolution version is not available.
1 parent 991f7d8 commit 481504e

File tree

5 files changed

+62
-3
lines changed

5 files changed

+62
-3
lines changed

NEWS.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
ClimaCoupler.jl Release Notes
2+
============================
3+
4+
`main`
5+
-------
6+
7+
### ClimaEarth features
8+
9+
### Sea-surface temperature and sea ice concentration data can now be automatically downloaded
10+
11+
Sea-surface temperature and sea ice concentration require external files. Now, a
12+
low-resolution version of such files is automatically downloaded when a
13+
higher-resolution version is not available. Please, refer to
14+
[ClimaArtifacts](https://github.com/CliMA/ClimaArtifacts) for more information.
15+

Project.toml

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ authors = ["CliMA Contributors <clima-software@caltech.edu>"]
44
version = "0.1.1"
55

66
[deps]
7+
Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
78
ClimaComms = "3a4d1b5c-c61d-41fd-a00a-5873ba7a1b0d"
89
ClimaCore = "d414da3d-4745-48bb-8d80-42e94e092884"
910
ClimaCoreTempestRemap = "d934ef94-cdd4-4710-83d6-720549644b70"
@@ -17,6 +18,7 @@ SurfaceFluxes = "49b00bb7-8bd4-4f2b-b78c-51cd0450215f"
1718
Thermodynamics = "b60c26fb-14c3-4610-9d3e-2d17fe7ff00c"
1819

1920
[compat]
21+
Artifacts = "1"
2022
ClimaComms = "0.5.6, 0.6"
2123
ClimaCore = "0.14.6"
2224
ClimaCoreTempestRemap = "0.3"

experiments/ClimaEarth/Artifacts.toml

+8-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,11 @@ git-tree-sha1 = "7486bf32e9352493f69364aead26f01eaf90d2af"
2222
git-tree-sha1 = "945e31f8028a581f7e8435cb691462124484567a"
2323

2424
[historical_sst_sic]
25-
git-tree-sha1 = "c4f82cd33fb26513ee45bff78330c6b606630fa5"
25+
git-tree-sha1 = "0d30d71a6f9b6548fe7395ca647e853ec36d1699"
26+
27+
[historical_sst_sic_lowres]
28+
git-tree-sha1 = "7f7b6d4ae6055c4c2b6a6dfba5be8b4e6ca1b0be"
29+
30+
[[historical_sst_sic_lowres.download]]
31+
sha256 = "b68c0ce6ea682c38e29cb87c9c6ced6736ecac32d0d32dbaba78beb66046a06c"
32+
url = "https://caltech.box.com/shared/static/ufnesb00zkvlc3sxzhnnmqc3zbatxkb9.gz"

experiments/ClimaEarth/run_amip.jl

+18-2
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,24 @@ The data files are downloaded from the `ClimaCoupler` artifacts directory. If th
173173
original sources.
174174
=#
175175
include(joinpath(pkgdir(ClimaCoupler), "artifacts", "artifact_funcs.jl"))
176-
sst_data = joinpath(@clima_artifact("historical_sst_sic", comms_ctx), "MODEL.SST.HAD187001-198110.OI198111-202206.nc")
177-
sic_data = joinpath(@clima_artifact("historical_sst_sic", comms_ctx), "MODEL.ICE.HAD187001-198110.OI198111-202206.nc")
176+
177+
if Utilities.artifact_exists("historical_sst_sic")
178+
sst_data =
179+
joinpath(@clima_artifact("historical_sst_sic", comms_ctx), "MODEL.SST.HAD187001-198110.OI198111-202206.nc")
180+
sic_data =
181+
joinpath(@clima_artifact("historical_sst_sic", comms_ctx), "MODEL.ICE.HAD187001-198110.OI198111-202206.nc")
182+
else
183+
ClimaComms.iamroot(comms_ctx) &&
184+
@warn "Using lowres sst sic. If you want the higher resolution version, you have to obtain it from ClimaArtifacts"
185+
sst_data = joinpath(
186+
@clima_artifact("historical_sst_sic_lowres", comms_ctx),
187+
"MODEL.SST.HAD187001-198110.OI198111-202206_lowres.nc",
188+
)
189+
sic_data = joinpath(
190+
@clima_artifact("historical_sst_sic_lowres", comms_ctx),
191+
"MODEL.ICE.HAD187001-198110.OI198111-202206_lowres.nc",
192+
)
193+
end
178194
co2_data = joinpath(co2_dataset_path(), "mauna_loa_co2.nc")
179195
land_mask_data = joinpath(mask_dataset_path(), "seamask.nc")
180196

src/Utilities.jl

+19
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,31 @@ modules in the coupler.
66
"""
77
module Utilities
88

9+
import Artifacts
910
import ClimaComms
1011
import ClimaCore as CC
1112
import Logging
1213

1314
export swap_space!
1415

16+
"""
17+
artifact_exists(name)
18+
19+
Return whether the artifact with the given name exists and is available to use.
20+
"""
21+
function artifact_exists(name)
22+
# There seems to be no easy way to determine if an artifact exists from the name
23+
# only...
24+
return try
25+
# We need to macroexpand because we only want to resolve @artifact_str when
26+
# we call this function
27+
@macroexpand Artifacts.@artifact_str(name)
28+
true
29+
catch error
30+
false
31+
end
32+
end
33+
1534
"""
1635
swap_space!(space_out::CC.Spaces.AbstractSpace, field_in::CC.Fields.Field)
1736

0 commit comments

Comments
 (0)