Skip to content

Commit

Permalink
Nuke Docs via GithubActions + add compat for CairoMakie v0.11, v0.12 (#…
Browse files Browse the repository at this point in the history
…156)

* disable docs previews

* add compat for CairoMakie 0.11, 0.12

* Delete .github/workflows/Documenter.yml

* Update make.jl

* Update near_global_ocean_simulation.jl

* import on_architecture

* land mask is now handled by OceananicansMakie extension

* enable previews

previews from the ClimaOceanDocs repo are now deleted every week

* simpler visualization of bathymetry + cleanup

* add Oceananigans

* Delete .github/workflows/DocPreviewCleanup.yml

* Update Project.toml

* Update Project.toml

* define Nt

* try shorter simulation

* Allow latitude, longitude to be points

* Improve single column simulation

* Add various show methods and clean up type definitions

* Move LatitudeDependentAlbedo to own file

* Make latitdue dependent albedo default

* Try to fix tabulated albedo but its still broken

* Make fluxes SCM friendly

* Allow ocean simulations that are already cleaned of calllbacks

* Update make and examples

* Update example

* Run simulation longer

* remove commented bit

* tweak

* tweak

* tweak

* tweak

* fix bug in summary

* add CFTime

* drop package from its docs Project

* Update make.jl

* update Oceananigans compat

* remove movie

* update ECCOMetadata

* fix show for OceanSeaIceModel

* some tweaks

* some tweaks

* remove movie

* fix hide

* remove current figures

* remove climaocean

* remove T and e

* remove debugging statement

* use interior for surface fields

* use interior for surface fields

* fix

* delete

* add ECCO

* minor fixes

* remove stray line

* fix name

* fixes

* cleanup

* fix docstring0

* tweaks

* fix name

* fix name

* fix makie

* tweaks

* fix

* remove surface fluxes

* cleaning

---------

Co-authored-by: Gregory L. Wagner <[email protected]>
  • Loading branch information
navidcy and glwagner authored Nov 2, 2024
1 parent 8796b45 commit 985244e
Show file tree
Hide file tree
Showing 32 changed files with 474 additions and 581 deletions.
1 change: 0 additions & 1 deletion .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,3 @@ steps:

- wait: ~
continue_on_failure: true

29 changes: 0 additions & 29 deletions .github/workflows/DocPreviewCleanup.yml

This file was deleted.

36 changes: 0 additions & 36 deletions .github/workflows/Documenter.yml

This file was deleted.

5 changes: 4 additions & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
[deps]
CFTime = "179af706-886a-5703-950a-314cd64e0468"
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
DataDeps = "124859b0-ceae-595e-8997-d05f6a7a8dfe"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
Oceananigans = "9e8cae18-63c1-5223-a75c-80ca9d6e9a09"
OrthogonalSphericalShellGrids = "c2be9673-fb75-4747-82dc-aa2bb9f4aed0"

[compat]
CairoMakie = "0.10.12"
CairoMakie = "0.10.12, 0.11, 0.12"
DataDeps = "0.7"
Documenter = "1"
Oceananigans = "0.93.1"
56 changes: 24 additions & 32 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
pushfirst!(LOAD_PATH, joinpath(@__DIR__, "..")) # add ClimaOcean to environment stack

using
ClimaOcean,
Documenter,
Literate,
ClimaOcean
Literate

ENV["DATADEPS_ALWAYS_ACCEPT"] = "true"

Expand All @@ -15,11 +13,11 @@ const EXAMPLES_DIR = joinpath(@__DIR__, "..", "examples")
const OUTPUT_DIR = joinpath(@__DIR__, "src/literated")

to_be_literated = [
# "inspect_ECCO_data.jl",
"inspect_ecco_data.jl",
"generate_bathymetry.jl",
"generate_surface_fluxes.jl",
# "single_column_simulation.jl",
# "mediterranean_simulation_with_ECCO_restoring.jl",
# "generate_surface_fluxes.jl",
"single_column_os_papa_simulation.jl",
# "mediterranean_simulation_with_ecco_restoring.jl",
"near_global_ocean_simulation.jl"
]

Expand All @@ -34,12 +32,10 @@ end
##### Build and deploy docs
#####

format = Documenter.HTML(
collapselevel = 2,
size_threshold = nothing,
prettyurls = get(ENV, "CI", nothing) == "true",
canonical = "https://clima.github.io/ClimaOceanDocumentation/dev/",
)
format = Documenter.HTML(collapselevel = 2,
size_threshold = nothing,
prettyurls = get(ENV, "CI", nothing) == "true",
canonical = "https://clima.github.io/ClimaOceanDocumentation/dev/")

pages = [
"Home" => "index.md",
Expand All @@ -52,25 +48,21 @@ pages = [
],

"Examples" => [
# "Inspect ECCO2 data" => "literated/inspect_ECCO_data.md",
"Inspect ECCO2 data" => "literated/inspect_ecco_data.md",
"Generate bathymetry" => "literated/generate_bathymetry.md",
"Surface fluxes" => "literated/generate_surface_fluxes.md",
# "Single column simulation" => "literated/single_column_simulation.md",
# "Mediterranean simulation with ECCO restoring" => "literated/mediterranean_simulation_with_ECCO_restoring.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",
]
]

makedocs(
sitename = "ClimaOcean.jl",
modules = [ClimaOcean],
format = format,
pages = pages,
doctest = true,
clean = true,
warnonly = [:cross_references, :missing_docs],
checkdocs = :exports
)
makedocs(sitename = "ClimaOcean.jl"; format, pages,
modules = [ClimaOcean],
doctest = true,
clean = true,
warnonly = [:cross_references, :missing_docs],
checkdocs = :exports)

@info "Clean up temporary .jld2 and .nc output created by doctests or literated examples..."

Expand All @@ -95,8 +87,8 @@ end

withenv("GITHUB_REPOSITORY" => "github.com/CliMA/ClimaOceanDocumentation.git") do
deploydocs(repo = "github.com/CliMA/ClimaOceanDocumentation.git",
versions = ["stable" => "v^", "v#.#.#", "dev" => "dev"],
forcepush = true,
devbranch = "main",
push_preview = true)
versions = ["stable" => "v^", "dev" => "dev", "v#.#.#"],
forcepush = true,
devbranch = "main",
push_preview = true)
end
69 changes: 0 additions & 69 deletions docs/make_without_examples.jl

This file was deleted.

1 change: 0 additions & 1 deletion examples/generate_atmos_dataset.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ T = Array(interior(Tt[1], 1:4:Nx, 1:4:Ny, 1))
p = Array(interior(pt[1], 1:4:Nx, 1:4:Ny, 1))

@save "atmospheric_state.jld2" q T p

13 changes: 7 additions & 6 deletions examples/generate_bathymetry.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# # Generate bathymetry data for the Mediterranean Sea
#
# This script shows how to configure an Immersed boundary grid with realistic bathymetry using ClimaOcean.jl
# by generating the bathymetry data for the Mediterranean Sea.
# This example shows how to configure an Immersed boundary grid with realistic bathymetry
# using ClimaOcean.jl by generating the bathymetry data for the Mediterranean Sea.
#
# For this example, we need Oceananigans for the LatitudeLongitudeGrid and Field utilities,
# ClimaOcean to donwload and regrid the bathymetry, and CairoMakie to visualize the grid.
Expand All @@ -25,15 +25,16 @@ Nλ = 25 * (longitude_range[2] - longitude_range[1])
grid = LatitudeLongitudeGrid(size = (Nλ, Nφ, 1),
latitude = latitude_range,
longitude = longitude_range,
z = (0, 1))
z = (0, 1),
halo = (7, 7, 1))

# Next, we generate the bathymetry data for the Mediterranean Sea using the
# `regrid_bathymetry` function from ClimaOcean. The function downloads the bathymetry
# data from the ETOPO1 dataset, regrids it to the provided grid, and returns the
# bathymetry field. The three different regidding procedures below demonstrate the effect
# of different parameters on the generated bathymetry:
#
# - `h_rough` shows the output of the function with default parameters, which means only
# - `h_rough` shows the output of the function with default parameters, which means only
# one interpolation passes and no restrictions on connected regions.
# - `h_smooth` shows the output of the function with 40 interpolation passes, which results
# in a smoother bathymetry.
Expand All @@ -44,7 +45,7 @@ grid = LatitudeLongitudeGrid(size = (Nλ, Nφ, 1),
h_rough = regrid_bathymetry(grid)
h_smooth = regrid_bathymetry(grid; interpolation_passes = 40)
h_one_basin = regrid_bathymetry(grid; major_basins = 1)
nothing # hide
nothing #hide

# Finally, we visualize the generated bathymetry data for the Mediterranean Sea using CairoMakie.

Expand All @@ -59,7 +60,7 @@ interior(h_rough)[land_rough] .= NaN
land_one_basin = interior(h_one_basin) .>= 0
interior(h_one_basin)[land_one_basin] .= NaN

fig = Figure(resolution=(850, 1150))
fig = Figure(size=(850, 1150))

ax = Axis(fig[1, 1], title = "Rough bathymetry", xlabel = "Longitude", ylabel = "Latitude")
hm = heatmap!(ax, λ, φ, - interior(h_rough, :, :, 1), nan_color=:white, colormap = Reverse(:deep))
Expand Down
7 changes: 3 additions & 4 deletions examples/generate_surface_fluxes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# ClimaOcean uses bulk formulae to estimate the surface exchange of momentum,
# heat, and water vapor between the atmosphere and the ocean.
#
# This script demonstrates an example of the turbulent surface flux calculations performed in ClimaOcean
# This example demonstrates an example of the turbulent surface flux calculations performed in ClimaOcean
# using ECCO2 data for the ocean and JRA55 data for the atmosphere.
#
# For this example, we need ClimaOcean with its DataWrangling modules: ECCO2 and JRA55.
Expand All @@ -28,7 +28,7 @@ grid = ImmersedBoundaryGrid(grid, GridFittedBoundary(mask))
fig = Figure()
ax = Axis(fig[1, 1])
heatmap!(ax, interior(grid.immersed_boundary.mask, :, :, grid.Nz))
save("ECCO_continents.png", fig) # hide
save("ECCO_continents.png", fig) #hide

# ![](ECCO_continents.png)

Expand All @@ -47,7 +47,7 @@ save("ECCO_continents.png", fig) # hide
# We invoke the constructor with only the first two time indices, corresponding to
# January 1st (at 00:00 AM and 03:00 AM).

atmosphere = JRA55_prescribed_atmosphere(1:2; backend = InMemory())
atmosphere = JRA55_prescribed_atmosphere(1:2; backend = InMemory())
ocean = ocean_simulation(grid)

# Now that we have an atmosphere and ocean, we `set!` the ocean temperature and salinity
Expand Down Expand Up @@ -92,4 +92,3 @@ heatmap!(ax, Mv; colormap = :bwr)

save("fluxes.png", fig)
# ![](fluxes.png)

10 changes: 4 additions & 6 deletions examples/inspect_ecco_data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
# ClimaOcean can download and utilize data from the "ECCO" state estimate,
# which stands for "Estimating the Circulation and Climate of the Ocean" --- two!
#
# This script shows how to download three-dimensional temperature and salinity fields
# This example shows how to download three-dimensional temperature and salinity fields
# from ECCO, and makes a short animation to showcase the fields' content.
#
# For this example we need Oceananigans for Field utilities, CairoMakie for plotting
# For this example we need Oceananigans for Field utilities, CairoMakie for plotting,
# Printf for nice labeling, and of course ClimaOcean to actually download and construct
# the ECCO fields.

Expand All @@ -16,8 +16,8 @@ using Printf

using ClimaOcean.DataWrangling.ECCO: ECCO_field

# The function `ECCO_field` provided by `ClimaOcean.DataWrangling.ECCO` will automatically
# download ECCO data if it doesn't already exist at the default location.
# The function `ECCO_field` provided by `ClimaOcean.DataWrangling.ECCO` automatically
# downloads ECCO data if that doesn't already exist at the default location.

T = ECCO_field(:temperature)
S = ECCO_field(:salinity)
Expand All @@ -40,8 +40,6 @@ fig = Figure(size=(1200, 1400))
axT = Axis(fig[1, 1])
axS = Axis(fig[2, 1])

λ, φ, z = nodes(T)

# To make an animation that scrolls through the 3D temperature
# and salinity fields, we make an Observable for the vertical index,
# and then construct slices of T, S using the Observable, `k`.
Expand Down
Loading

0 comments on commit 985244e

Please sign in to comment.