Skip to content

Commit 5170414

Browse files
authored
Add ClimaOceanCopernicusMarineExt (#661)
* add ClimaOceanCopernicusMarineExt * tests use CopernicusMarine * nuke ClimaOceanPythonCallExt * Bump version from 0.8.6 to 0.8.7 * Update citation for ClimaOcean version to v0.8.7 * use CopernicusMarine.pylist * Update Project.toml * drop PythonCall/CondaPkg * nuke CondaPkg * global_barrier -> barrier
1 parent 8231f47 commit 5170414

File tree

7 files changed

+20
-43
lines changed

7 files changed

+20
-43
lines changed

Project.toml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name = "ClimaOcean"
22
uuid = "0376089a-ecfe-4b0e-a64f-9c555d74d754"
33
license = "MIT"
44
authors = ["Climate Modeling Alliance and contributors"]
5-
version = "0.8.6"
5+
version = "0.8.7"
66

77
[deps]
88
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
@@ -33,20 +33,19 @@ Thermodynamics = "b60c26fb-14c3-4610-9d3e-2d17fe7ff00c"
3333
ZipFile = "a5390f91-8eb1-5f08-bee0-b1d1ffed6cea"
3434

3535
[weakdeps]
36-
CondaPkg = "992eb4ea-22a4-4c89-a5bb-47a3300528ab"
37-
PythonCall = "6099a3de-0909-46bc-b1f4-468b9a2dfc0d"
36+
CopernicusMarine = "cd43e856-93a3-40c8-bc9e-6146cdce14fa"
3837
Reactant = "3c362404-f566-11ee-1572-e11a4b42c853"
3938

4039
[extensions]
41-
ClimaOceanPythonCallExt = ["PythonCall", "CondaPkg"]
40+
ClimaOceanCopernicusMarineExt = "CopernicusMarine"
4241
ClimaOceanReactantExt = "Reactant"
4342

4443
[compat]
4544
Adapt = "4"
4645
CFTime = "0.1, 0.2"
4746
CUDA = "4, 5"
4847
ClimaSeaIce = "0.3.9"
49-
CondaPkg = "0.2.28"
48+
CopernicusMarine = "0.1.1"
5049
CubicSplines = "0.2"
5150
DataDeps = "0.7"
5251
DocStringExtensions = "0.9"
@@ -58,10 +57,9 @@ KernelAbstractions = "0.9"
5857
MPI = "0.20"
5958
MeshArrays = "0.3"
6059
NCDatasets = "0.12, 0.13, 0.14"
61-
Oceananigans = "0.100.3"
60+
Oceananigans = "0.100.4"
6261
OffsetArrays = "1.14"
6362
PrecompileTools = "1"
64-
PythonCall = "0.9"
6563
Reactant = "0.2.45"
6664
Scratch = "1"
6765
SeawaterPolynomials = "0.3.5"
@@ -78,4 +76,4 @@ MPIPreferences = "3da0fdf6-3ccc-4f1b-acd9-58baa6c99267"
7876
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
7977

8078
[targets]
81-
test = ["Coverage", "Test", "MPIPreferences", "CUDA_Runtime_jll", "Reactant", "PythonCall", "CondaPkg"]
79+
test = ["Coverage", "Test", "MPIPreferences", "CUDA_Runtime_jll", "Reactant", "CopernicusMarine"]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ Note that though ClimaOcean is currently focused on hydrostatic modeling with `O
105105
If you use ClimaOcean for your research, teaching, or fun 🤩, everyone in our community will be grateful
106106
if you give credit by citing the corresponding Zenodo record, e.g.,
107107

108-
> Wagner, G. L. et al. (2025). CliMA/ClimaOcean.jl: v0.8.1 (v0.8.1). Zenodo. https://doi.org/10.5281/zenodo.7677442
108+
> Wagner, G. L. et al. (2025). CliMA/ClimaOcean.jl: v0.8.7 (v0.8.7). Zenodo. https://doi.org/10.5281/zenodo.7677442
109109
110110
and also the recent [preprint submitted to the Journal of Advances in Modeling Earth Systems](https://arxiv.org/abs/2502.14148) that presents an overview of all the things that make Oceananigans unique:
111111

examples/download_glorys_data.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using ClimaOcean
22
using Oceananigans
3-
using PythonCall
3+
using CopernicusMarine
44

55
arch = CPU()
66
Nx = 20 * 12

ext/ClimaOceanPythonCallExt.jl renamed to ext/ClimaOceanCopernicusMarineExt.jl

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
module ClimaOceanPythonCallExt
1+
module ClimaOceanCopernicusMarineExt
22

33
using ClimaOcean
4-
using CondaPkg
5-
using PythonCall
4+
using CopernicusMarine
5+
66
using Oceananigans
77
using Oceananigans.DistributedComputations: @root
88

@@ -11,19 +11,6 @@ using ClimaOcean.DataWrangling.Copernicus: CopernicusMetadata, CopernicusMetadat
1111

1212
import ClimaOcean.DataWrangling: download_dataset
1313

14-
"""
15-
install_copernicusmarine()
16-
17-
Install the Copernicus Marine CLI using CondaPkg.
18-
Returns a NamedTuple containing package information if successful.
19-
"""
20-
function install_copernicusmarine()
21-
@info "Installing the copernicusmarine CLI..."
22-
CondaPkg.add("copernicusmarine"; channel = "conda-forge")
23-
cli = CondaPkg.which("copernicusmarine")
24-
@info "... the copernicusmarine CLI has been installed at $(cli)."
25-
return cli
26-
end
2714

2815
# Download each date individually, instead of downloading the entire dataset at once.
2916
# This is useful for a possible extension of the temporal horizon of the dataset.
@@ -35,8 +22,8 @@ function download_dataset(metadata::CopernicusMetadata; kwargs...)
3522
return paths
3623
end
3724

38-
function download_dataset(meta::CopernicusMetadatum;
39-
skip_existing=true,
25+
function download_dataset(meta::CopernicusMetadatum;
26+
skip_existing=true,
4027
username=get(ENV, "COPERNICUS_USERNAME", nothing),
4128
password=get(ENV, "COPERNICUS_PASSWORD", nothing),
4229
additional_kw...)
@@ -46,15 +33,10 @@ function download_dataset(meta::CopernicusMetadatum;
4633
output_path = joinpath(output_directory, output_filename)
4734
isfile(output_path) && return output_path
4835

49-
toolbox = try
50-
pyimport("copernicusmarine")
51-
catch
52-
install_copernicusmarine()
53-
pyimport("copernicusmarine")
54-
end
36+
toolbox = CopernicusMarine.copernicusmarine
5537

5638
variable_name = ClimaOcean.DataWrangling.Copernicus.copernicus_dataset_variable_names[meta.name]
57-
variables = PythonCall.pylist([variable_name])
39+
variables = CopernicusMarine.pylist([variable_name])
5840

5941
dataset_id = ClimaOcean.DataWrangling.Copernicus.copernicusmarine_dataset_id(meta.dataset)
6042
datetime_kw = if meta.dataset isa ClimaOcean.DataWrangling.Copernicus.GLORYSStatic
@@ -79,8 +61,8 @@ function download_dataset(meta::CopernicusMetadatum;
7961
if !isnothing(username) && !isnothing(password)
8062
kw = merge(kw, (; username, password))
8163
else
82-
@warn "No Copernicus credentials found. \\
83-
Set the COPERNICUS_USERNAME and COPERNICUS_PASSWORD environment variables to download data from the Copernicus Marine Service. \\
64+
@warn "No Copernicus credentials found.
65+
Set the COPERNICUS_USERNAME and COPERNICUS_PASSWORD environment variables to download data from the Copernicus Marine Service.
8466
You can sign up for free at: https://data.marine.copernicus.eu/register."
8567
end
8668

@@ -120,4 +102,4 @@ function depth_bounds_kw(z)
120102
return (; minimum_depth, maximum_depth)
121103
end
122104

123-
end # module ClimaOceanPythonCallExt
105+
end # module ClimaOceanCopernicusMarineExt

src/Bathymetry.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ function regrid_bathymetry(target_grid::DistributedGrid, metadata;
176176
end
177177

178178
# Synchronize
179-
Oceananigans.DistributedComputations.global_barrier(arch.communicator)
179+
Oceananigans.DistributedComputations.barrier(arch.communicator)
180180

181181
# Share the result (can we share SubArrays?)
182182
bottom_height = all_reduce(+, bottom_height, arch)

test/runtests.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
include("runtests_setup.jl")
33

44
using CUDA
5-
using PythonCall
6-
using CondaPkg
75
using Scratch
86

97
test_group = get(ENV, "TEST_GROUP", :all)

test/test_copernicus_downloading.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
include("runtests_setup.jl")
22

3-
using PythonCall
4-
using CondaPkg
3+
using CopernicusMarine
54

65
@testset "Downloading Copernicus data" begin
76
variables = (:temperature, :salinity, :u_velocity, :v_velocity)

0 commit comments

Comments
 (0)