From 2b42a2ca327de280eb90ed36239fff718bfeff0d Mon Sep 17 00:00:00 2001 From: "Navid C. Constantinou" Date: Tue, 24 Dec 2024 17:51:11 +1100 Subject: [PATCH 1/7] don't add / twice --- src/DataWrangling/ECCO/ECCO_metadata.jl | 28 ++++++++++++++++++------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/DataWrangling/ECCO/ECCO_metadata.jl b/src/DataWrangling/ECCO/ECCO_metadata.jl index 7e3a9d99..131aa4ff 100644 --- a/src/DataWrangling/ECCO/ECCO_metadata.jl +++ b/src/DataWrangling/ECCO/ECCO_metadata.jl @@ -197,24 +197,36 @@ ECCO_location = Dict( ) # URLs for the ECCO datasets specific to each version -urls(::ECCOMetadata{<:Any, <:ECCO2Monthly}) = "https://ecco.jpl.nasa.gov/drive/files/ECCO2/cube92_latlon_quart_90S90N/monthly/" -urls(::ECCOMetadata{<:Any, <:ECCO2Daily}) = "https://ecco.jpl.nasa.gov/drive/files/ECCO2/cube92_latlon_quart_90S90N/daily/" -urls(::ECCOMetadata{<:Any, <:ECCO4Monthly}) = "https://ecco.jpl.nasa.gov/drive/files/Version4/Release4/interp_monthly/" +urls(::ECCOMetadata{<:Any, <:ECCO2Monthly}) = "https://ecco.jpl.nasa.gov/drive/files/ECCO2/cube92_latlon_quart_90S90N/monthly" +urls(::ECCOMetadata{<:Any, <:ECCO2Daily}) = "https://ecco.jpl.nasa.gov/drive/files/ECCO2/cube92_latlon_quart_90S90N/daily" +urls(::ECCOMetadata{<:Any, <:ECCO4Monthly}) = "https://ecco.jpl.nasa.gov/drive/files/Version4/Release4/interp_monthly" """ download_dataset(metadata::ECCOMetadata; url = urls(metadata)) -Download the dataset specified by `ECCOMetadata`. If `ECCOMetadata.dates` is a single date, +Download the dataset specified by `ECCOMetadata`. If `ECCOMetadata.dates` is a single date, the dataset is downloaded directly. If `ECCOMetadata.dates` is a vector of dates, each date is downloaded individually. + The data download requires a username and password to be provided in the `ECCO_USERNAME` and `ECCO_PASSWORD` environment variables. This can be done by exporting the environment variables -in the shell before running the script, or by launching julia with +in the shell before running the script, or by launching julia with ``` -ECCO_USERNAME=myusername ECCO_PASSWORD=mypassword julia +ECCO_USERNAME=myusername ECCO_PASSWORD=mypassword julia +``` + +or by invoking + +```julia +julia> ENV["ECCO_USERNAME"] = "myusername" + +julia> ENV["ECCO_PASSWORD"] = "mypassword" ``` +within julia. + + Arguments ========= - `metadata::ECCOMetadata`: The metadata specifying the dataset to be downloaded. @@ -223,7 +235,7 @@ function download_dataset(metadata::ECCOMetadata; url = urls(metadata)) username = get(ENV, "ECCO_USERNAME", nothing) password = get(ENV, "ECCO_PASSWORD", nothing) dir = metadata.dir - + # Create a temporary directory to store the .netrc file # The directory will be deleted after the download is complete @root mktempdir(dir) do tmp @@ -254,6 +266,6 @@ function download_dataset(metadata::ECCOMetadata; url = urls(metadata)) end end end - + return nothing end From bd7663d9b456438fc65769db83a1c47b7ab34b1b Mon Sep 17 00:00:00 2001 From: "Navid C. Constantinou" Date: Tue, 24 Dec 2024 17:53:06 +1100 Subject: [PATCH 2/7] add missing deps + compats --- docs/Project.toml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/Project.toml b/docs/Project.toml index c860a46a..28003201 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -6,10 +6,12 @@ Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306" Oceananigans = "9e8cae18-63c1-5223-a75c-80ca9d6e9a09" OrthogonalSphericalShellGrids = "c2be9673-fb75-4747-82dc-aa2bb9f4aed0" +SeawaterPolynomials = "d496a93d-167e-4197-9f49-d3af4ff8fe40" [compat] CairoMakie = "0.10.12, 0.11, 0.12" DataDeps = "0.7" Documenter = "1" -Oceananigans = "0.95.2 - 0.99" -OrthogonalSphericalShellGrids = "0.2.0" +Oceananigans = "0.95.4 - 0.99" +OrthogonalSphericalShellGrids = "0.2.1" +SeawaterPolynomials = "0.3.4" From 81c8972b4ead2214b72e565282d49961d5a8bc9d Mon Sep 17 00:00:00 2001 From: "Navid C. Constantinou" Date: Tue, 24 Dec 2024 17:54:07 +1100 Subject: [PATCH 3/7] temporarily only leave the ECCO2 example on --- docs/make.jl | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/make.jl b/docs/make.jl index 4f9164d5..5f59d7a8 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -14,11 +14,11 @@ const OUTPUT_DIR = joinpath(@__DIR__, "src/literated") to_be_literated = [ "ecco_inspect_temperature_salinity.jl", - "generate_bathymetry.jl", - "generate_surface_fluxes.jl", - "single_column_os_papa_simulation.jl", + # "generate_bathymetry.jl", + # "generate_surface_fluxes.jl", + # "single_column_os_papa_simulation.jl", # "mediterranean_simulation_with_ecco_restoring.jl", - "near_global_ocean_simulation.jl" + # "near_global_ocean_simulation.jl" ] for file in to_be_literated @@ -42,11 +42,11 @@ pages = [ "Examples" => [ "Inspect ECCO2 data" => "literated/ecco_inspect_temperature_salinity.md", - "Generate bathymetry" => "literated/generate_bathymetry.md", - "Surface fluxes" => "literated/generate_surface_fluxes.md", - "Single-column simulation" => "literated/single_column_os_papa_simulation.md", + # "Generate bathymetry" => "literated/generate_bathymetry.md", + # "Surface fluxes" => "literated/generate_surface_fluxes.md", + # "Single-column simulation" => "literated/single_column_os_papa_simulation.md", # "Mediterranean simulation with ECCO restoring" => "literated/mediterranean_simulation_with_ecco_restoring.md", - "Near-global Ocean simulation" => "literated/near_global_ocean_simulation.md", + # "Near-global Ocean simulation" => "literated/near_global_ocean_simulation.md", ], "Library" => [ @@ -59,7 +59,7 @@ pages = [ makedocs(sitename = "ClimaOcean.jl"; format, - pages, + pages, modules = [ClimaOcean], doctest = true, clean = true, From 9ed1c2d01424d2aee286fa1a4870465d284ed577 Mon Sep 17 00:00:00 2001 From: "Navid C. Constantinou" Date: Tue, 24 Dec 2024 17:54:44 +1100 Subject: [PATCH 4/7] GLMakie -> CairoMakie; BuoyancyModels -> BuoyancyFormulations --- examples/ecco_inspect_temperature_salinity.jl | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/examples/ecco_inspect_temperature_salinity.jl b/examples/ecco_inspect_temperature_salinity.jl index 4fcaf1ed..458169cd 100644 --- a/examples/ecco_inspect_temperature_salinity.jl +++ b/examples/ecco_inspect_temperature_salinity.jl @@ -1,7 +1,7 @@ using Oceananigans using Oceananigans.ImmersedBoundaries: mask_immersed_field! -using GLMakie +using CairoMakie using Printf using ClimaOcean using ClimaOcean.DataWrangling.ECCO: ECCO_field, ECCOFieldTimeSeries @@ -32,7 +32,7 @@ T = CenterField(grid) S = CenterField(grid) using SeawaterPolynomials: TEOS10EquationOfState -using Oceananigans.BuoyancyModels: buoyancy +using Oceananigans.BuoyancyFormulations: buoyancy equation_of_state = TEOS10EquationOfState() sb = SeawaterBuoyancy(; equation_of_state) @@ -83,5 +83,4 @@ Colorbar(fig[1, 2], hmT, label="Temperature (ᵒC)") Colorbar(fig[2, 2], hmS, label="Salinity (g kg⁻¹)") Colorbar(fig[3, 2], hmb, label="Buoyancy difference (m s⁻²)") -display(fig) - +fig From 4fdff12dfcfa8737a1b0c0e29c91e4a1dfac4857 Mon Sep 17 00:00:00 2001 From: "Navid C. Constantinou" Date: Tue, 24 Dec 2024 17:55:52 +1100 Subject: [PATCH 5/7] update --- examples/ecco_mixed_layer_depth.jl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/ecco_mixed_layer_depth.jl b/examples/ecco_mixed_layer_depth.jl index ff3165e5..7eed00a5 100644 --- a/examples/ecco_mixed_layer_depth.jl +++ b/examples/ecco_mixed_layer_depth.jl @@ -2,7 +2,7 @@ using ClimaOcean using ClimaOcean.Diagnostics: MixedLayerDepthField using ClimaOcean.DataWrangling.ECCO: ECCO_field, ECCOFieldTimeSeries using Oceananigans -using GLMakie +using CairoMakie using Printf using CFTime using Dates @@ -23,7 +23,7 @@ grid = LatitudeLongitudeGrid(arch; z, latitude = (-80, 80), longitude = (0, 360)) -bottom_height = regrid_bathymetry(grid; +bottom_height = regrid_bathymetry(grid; minimum_depth = 10, interpolation_passes = 5, major_basins = 1) @@ -73,7 +73,9 @@ Label(fig[1, 1], str, tellwidth=false) hn = @lift ht[$n] hm = heatmap!(axh, hn, colorrange=(0, 500), colormap=:magma, nan_color=:lightgray) Colorbar(fig[2, 2], hm, label="Mixed layer depth (m)") -display(fig) +fig + +# And record a movie record(fig, "ecco_mld.mp4", 1:Nt-1, framerate=4) do nn @info "Drawing frame $nn of $Nt..." From b69d70c1b2a467628cadef97e7ef79f9f4e4eae3 Mon Sep 17 00:00:00 2001 From: "Navid C. Constantinou" Date: Tue, 24 Dec 2024 18:23:41 +1100 Subject: [PATCH 6/7] code alignment --- src/DataWrangling/JRA55.jl | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/DataWrangling/JRA55.jl b/src/DataWrangling/JRA55.jl index 96ee8f9e..78b162ba 100644 --- a/src/DataWrangling/JRA55.jl +++ b/src/DataWrangling/JRA55.jl @@ -639,20 +639,20 @@ JRA55PrescribedAtmosphere(arch::Distributed, time_indices=Colon(); kw...) = # TODO: allow the user to pass dates """ JRA55PrescribedAtmosphere(architecture::AA, time_indices=Colon(); - backend = nothing, - time_indexing = Cyclical(), - reference_height = 10, # meters - include_rivers_and_icebergs = false, - other_kw...) + backend = nothing, + time_indexing = Cyclical(), + reference_height = 10, # meters + include_rivers_and_icebergs = false, + other_kw...) Return a `PrescribedAtmosphere` representing JRA55 reanalysis data. """ function JRA55PrescribedAtmosphere(architecture::AA, time_indices=Colon(); - backend = nothing, - time_indexing = Cyclical(), - reference_height = 10, # meters - include_rivers_and_icebergs = false, - other_kw...) + backend = nothing, + time_indexing = Cyclical(), + reference_height = 10, # meters + include_rivers_and_icebergs = false, + other_kw...) if isnothing(backend) # apply a default Ni = try @@ -667,7 +667,7 @@ function JRA55PrescribedAtmosphere(architecture::AA, time_indices=Colon(); end kw = (; time_indices, time_indexing, backend, architecture) - kw = merge(kw, other_kw) + kw = merge(kw, other_kw) ua = JRA55_field_time_series(:eastward_velocity; kw...) va = JRA55_field_time_series(:northward_velocity; kw...) @@ -719,4 +719,3 @@ function JRA55PrescribedAtmosphere(architecture::AA, time_indices=Colon(); end end # module - From 5e8e04e6511af07da3f0fc137519a83284e4c676 Mon Sep 17 00:00:00 2001 From: "Navid C. Constantinou" Date: Tue, 24 Dec 2024 18:34:36 +1100 Subject: [PATCH 7/7] add docs/Manifest.toml --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 3c3ca28d..2a2faf59 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /Manifest.toml +docs/Manifest.toml # Files generated by invoking Julia with --code-coverage *.jl.cov