diff --git a/Project.toml b/Project.toml index 4e6fd611..35fd4590 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "ClimaSeaIce" uuid = "6ba0ff68-24e6-4315-936c-2e99227c95a4" authors = ["Climate Modeling Alliance and contributors"] -version = "0.4.6" +version = "0.4.7" [deps] Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" @@ -12,17 +12,11 @@ RootSolvers = "7181ea78-2dcb-4de3-ab41-2b8ab5a31e74" Roots = "f2b01f46-fcfa-551c-844a-d8ac1e96c665" SeawaterPolynomials = "d496a93d-167e-4197-9f49-d3af4ff8fe40" -[weakdeps] -NCDatasets = "85f8d34a-cbdd-5861-8df4-14fed0d494ab" - -[extensions] -ClimaSeaIceNCDatasetsExt = "NCDatasets" - [compat] Adapt = "3, 4" JLD2 = "0.6.2" KernelAbstractions = "0.9" -Oceananigans = "0.104.1, 0.105, 0.106" +Oceananigans = "0.106, 0.107" RootSolvers = "0.3, 0.4, 1.0" Roots = "2" SeawaterPolynomials = "0.3.4" @@ -30,6 +24,7 @@ julia = "1.10" [extras] MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195" +NCDatasets = "85f8d34a-cbdd-5861-8df4-14fed0d494ab" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] diff --git a/ext/ClimaSeaIceNCDatasetsExt.jl b/ext/ClimaSeaIceNCDatasetsExt.jl deleted file mode 100644 index 58d76c4e..00000000 --- a/ext/ClimaSeaIceNCDatasetsExt.jl +++ /dev/null @@ -1,44 +0,0 @@ -module ClimaSeaIceNCDatasetsExt - -using NCDatasets -using Oceananigans -using ClimaSeaIce - -##### -##### Variable attributes -##### - -default_horizontal_velocity_attributes(::RectilinearGrid) = Dict( - "u" => Dict("long_name" => "Velocity in the +x-direction.", "units" => "m/s"), - "v" => Dict("long_name" => "Velocity in the +y-direction.", "units" => "m/s")) - -default_horizontal_velocity_attributes(::LatitudeLongitudeGrid) = Dict( - "u" => Dict("long_name" => "Velocity in the zonal direction (+ = east).", "units" => "m/s"), - "v" => Dict("long_name" => "Velocity in the meridional direction (+ = north).", "units" => "m/s")) - -default_horizontal_velocity_attributes(::OrthogonalSphericalShellGrid) = Dict( - "u" => Dict("long_name" => "Velocity in the i-direction (+ = increasing i).", "units" => "m/s"), - "v" => Dict("long_name" => "Velocity in the j-direction (+ = increasing j).", "units" => "m/s") -) - -default_horizontal_velocity_attributes(ibg::ImmersedBoundaryGrid) = default_horizontal_velocity_attributes(ibg.underlying_grid) - -default_sea_ice_attributes() = Dict( - "h" => Dict("long_name" => "Sea ice thickness.", "units" => "m"), - "ℵ" => Dict("long_name" => "Sea ice concentration.", "units" => "-") -) - -function __init__() - OCNE = Base.get_extension(Oceananigans, :OceananigansNCDatasetsExt) - if !isnothing(OCNE) - @eval begin - function $OCNE.default_output_attributes(model::SeaIceModel) - velocity_attrs = default_horizontal_velocity_attributes(model.grid) - tracer_attrs = default_sea_ice_attributes() - return merge(velocity_attrs, tracer_attrs) - end - end - end -end - -end diff --git a/src/ClimaSeaIce.jl b/src/ClimaSeaIce.jl index 71fdd2ab..ba80b00a 100644 --- a/src/ClimaSeaIce.jl +++ b/src/ClimaSeaIce.jl @@ -69,4 +69,32 @@ end # No diffusion timescale for sea ice for now cell_diffusion_timescale(model::SeaIceModel) = Inf +##### +##### Default output attributes for NetCDF output +##### + +default_horizontal_velocity_attributes(::RectilinearGrid) = Dict( + "u" => Dict("long_name" => "Velocity in the +x-direction.", "units" => "m/s"), + "v" => Dict("long_name" => "Velocity in the +y-direction.", "units" => "m/s")) + +default_horizontal_velocity_attributes(::LatitudeLongitudeGrid) = Dict( + "u" => Dict("long_name" => "Velocity in the zonal direction (+ = east).", "units" => "m/s"), + "v" => Dict("long_name" => "Velocity in the meridional direction (+ = north).", "units" => "m/s")) + +default_horizontal_velocity_attributes(::OrthogonalSphericalShellGrid) = Dict( + "u" => Dict("long_name" => "Velocity in the i-direction (+ = increasing i).", "units" => "m/s"), + "v" => Dict("long_name" => "Velocity in the j-direction (+ = increasing j).", "units" => "m/s")) + +default_horizontal_velocity_attributes(ibg::ImmersedBoundaryGrid) = default_horizontal_velocity_attributes(ibg.underlying_grid) + +default_sea_ice_attributes() = Dict( + "h" => Dict("long_name" => "Sea ice thickness.", "units" => "m"), + "ℵ" => Dict("long_name" => "Sea ice concentration.", "units" => "-")) + +function Oceananigans.OutputWriters.default_output_attributes(model::SeaIceModel) + velocity_attrs = default_horizontal_velocity_attributes(model.grid) + tracer_attrs = default_sea_ice_attributes() + return merge(velocity_attrs, tracer_attrs) +end + end # module