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 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" diff --git a/docs/make.jl b/docs/make.jl index 317e81e6..3fbeb561 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -13,7 +13,7 @@ const EXAMPLES_DIR = joinpath(@__DIR__, "..", "examples") const OUTPUT_DIR = joinpath(@__DIR__, "src/literated") to_be_literated = [ - # "ecco_inspect_temperature_salinity.jl", + "ecco_inspect_temperature_salinity.jl", "generate_bathymetry.jl", "generate_surface_fluxes.jl", "single_column_os_papa_simulation.jl", @@ -41,7 +41,7 @@ pages = [ "Home" => "index.md", "Examples" => [ - # "Inspect ECCO2 data" => "literated/ecco_inspect_temperature_salinity.md", + "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", @@ -59,7 +59,7 @@ pages = [ makedocs(sitename = "ClimaOcean.jl"; format, - pages, + pages, modules = [ClimaOcean], doctest = true, clean = true, 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 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..." 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