Skip to content

Commit

Permalink
Merge pull request #964 from CliMA/gb/lowres_sic_sst
Browse files Browse the repository at this point in the history
Conditionally use high res version of SST/SIC
  • Loading branch information
juliasloan25 authored Sep 30, 2024
2 parents 991f7d8 + ec7da49 commit f5b8c7b
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 3 deletions.
15 changes: 15 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
ClimaCoupler.jl Release Notes
============================

`main`
-------

### ClimaEarth features

### Sea-surface temperature and sea ice concentration data can now be automatically downloaded

Sea-surface temperature and sea ice concentration require external files. Now, a
low-resolution version of such files is automatically downloaded when a
higher-resolution version is not available. Please, refer to
[ClimaArtifacts](https://github.com/CliMA/ClimaArtifacts) for more information.

2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ authors = ["CliMA Contributors <clima-software@caltech.edu>"]
version = "0.1.1"

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

[compat]
Artifacts = "1"
ClimaComms = "0.5.6, 0.6"
ClimaCore = "0.14.6"
ClimaCoreTempestRemap = "0.3"
Expand Down
9 changes: 8 additions & 1 deletion experiments/ClimaEarth/Artifacts.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,11 @@ git-tree-sha1 = "7486bf32e9352493f69364aead26f01eaf90d2af"
git-tree-sha1 = "945e31f8028a581f7e8435cb691462124484567a"

[historical_sst_sic]
git-tree-sha1 = "c4f82cd33fb26513ee45bff78330c6b606630fa5"
git-tree-sha1 = "0d30d71a6f9b6548fe7395ca647e853ec36d1699"

[historical_sst_sic_lowres]
git-tree-sha1 = "7f7b6d4ae6055c4c2b6a6dfba5be8b4e6ca1b0be"

[[historical_sst_sic_lowres.download]]
sha256 = "b68c0ce6ea682c38e29cb87c9c6ced6736ecac32d0d32dbaba78beb66046a06c"
url = "https://caltech.box.com/shared/static/ufnesb00zkvlc3sxzhnnmqc3zbatxkb9.gz"
20 changes: 18 additions & 2 deletions experiments/ClimaEarth/run_amip.jl
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,24 @@ The data files are downloaded from the `ClimaCoupler` artifacts directory. If th
original sources.
=#
include(joinpath(pkgdir(ClimaCoupler), "artifacts", "artifact_funcs.jl"))
sst_data = joinpath(@clima_artifact("historical_sst_sic", comms_ctx), "MODEL.SST.HAD187001-198110.OI198111-202206.nc")
sic_data = joinpath(@clima_artifact("historical_sst_sic", comms_ctx), "MODEL.ICE.HAD187001-198110.OI198111-202206.nc")

if Utilities.artifact_exists("historical_sst_sic")
sst_data =
joinpath(@clima_artifact("historical_sst_sic", comms_ctx), "MODEL.SST.HAD187001-198110.OI198111-202206.nc")
sic_data =
joinpath(@clima_artifact("historical_sst_sic", comms_ctx), "MODEL.ICE.HAD187001-198110.OI198111-202206.nc")
else
ClimaComms.iamroot(comms_ctx) &&
@warn "Using lowres sst sic. If you want the higher resolution version, you have to obtain it from ClimaArtifacts"
sst_data = joinpath(
@clima_artifact("historical_sst_sic_lowres", comms_ctx),
"MODEL.SST.HAD187001-198110.OI198111-202206_lowres.nc",
)
sic_data = joinpath(
@clima_artifact("historical_sst_sic_lowres", comms_ctx),
"MODEL.ICE.HAD187001-198110.OI198111-202206_lowres.nc",
)
end
co2_data = joinpath(co2_dataset_path(), "mauna_loa_co2.nc")
land_mask_data = joinpath(mask_dataset_path(), "seamask.nc")

Expand Down
19 changes: 19 additions & 0 deletions src/Utilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,31 @@ modules in the coupler.
"""
module Utilities

import Artifacts
import ClimaComms
import ClimaCore as CC
import Logging

export swap_space!

"""
artifact_exists(name)
Return whether the artifact with the given name exists and is available to use.
"""
function artifact_exists(name)
# There seems to be no easy way to determine if an artifact exists from the name
# only...
return try
# We need to macroexpand because we only want to resolve @artifact_str when
# we call this function
@macroexpand Artifacts.@artifact_str(name)
true
catch error
false
end
end

"""
swap_space!(space_out::CC.Spaces.AbstractSpace, field_in::CC.Fields.Field)
Expand Down

0 comments on commit f5b8c7b

Please sign in to comment.