Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(0.96.0) Improve the NetCDFOutputWriter experience #4046

Open
wants to merge 40 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
0bcc0f5
Start refactoring `NetCDFOutputWriter` to make it more flexible
ali-ramadhan Jan 9, 2025
b445f0c
Refactor and update `NetCDFOutputWriter` tests
ali-ramadhan Jan 9, 2025
adeadc4
Fix tests
ali-ramadhan Jan 9, 2025
e63335b
Test and fix NetCDF + Lagrangian particles
ali-ramadhan Jan 9, 2025
daa2ace
Better file names and file management for NetCDF tests
ali-ramadhan Jan 9, 2025
869f418
Reorganize `netcdf_output_writer.jl`
ali-ramadhan Jan 9, 2025
28011c3
Integrate `dimension_name_generator` into `NetCDFOutputWriter`
ali-ramadhan Jan 9, 2025
6794267
Add option to output grid metrics to NetCDF
ali-ramadhan Jan 10, 2025
cedef31
Correct float type for time output
ali-ramadhan Jan 10, 2025
13907c6
Update and fix tests
ali-ramadhan Jan 10, 2025
4a5a875
Fix typos in rectilinear grid metric outputs
ali-ramadhan Jan 10, 2025
8f2b009
Add attributes to rectilinear grid metrics
ali-ramadhan Jan 10, 2025
be9b1c3
Fix output construction for grid metrics
ali-ramadhan Jan 10, 2025
1838122
Add big test for NetCDF grid metrics on rectilinear grid
ali-ramadhan Jan 10, 2025
dbf1c61
Fix and test NetCDF sliced output with grid metrics
ali-ramadhan Jan 10, 2025
78ceb70
Time should always be `Float64`
ali-ramadhan Jan 10, 2025
b86b032
Forgot to close and remove some files
ali-ramadhan Jan 11, 2025
3bab6f4
Fixes to support NetCDF output for flat grids
ali-ramadhan Jan 11, 2025
e408cc0
Testing NetCDF output with flat xy grids
ali-ramadhan Jan 11, 2025
bc0f450
Fixes to support NetCDF output for flat grids
ali-ramadhan Jan 11, 2025
84574b8
Test xz and yz flat grids
ali-ramadhan Jan 11, 2025
1b7c449
Fix time eltype tests
ali-ramadhan Jan 11, 2025
32279cd
Test NetCDF output for 1D column grids
ali-ramadhan Jan 11, 2025
295ea11
Output the immersed boundary with NetCDF
ali-ramadhan Jan 12, 2025
ec62a77
Test immersed boundaries with flat xz and yz grids
ali-ramadhan Jan 12, 2025
d3b975a
Support NetCDF output for lat-lon grids
ali-ramadhan Jan 13, 2025
5106dbb
Test NetCDF output of lat-lon grid metrics
ali-ramadhan Jan 14, 2025
ec80937
Test NetCDF output of bathymetry with `GridFittedBottom`
ali-ramadhan Jan 14, 2025
0a7a19f
Typo
ali-ramadhan Jan 14, 2025
1fc0b1a
Update default output attributes to be more correct
ali-ramadhan Jan 15, 2025
ce5ebf0
Gather grid metrics and allow overriding attributes
ali-ramadhan Jan 15, 2025
98b27fc
Test overriding NetCDF attributes
ali-ramadhan Jan 15, 2025
79a6691
Some fixes for `NetCDFOutputWriter`
ali-ramadhan Jan 15, 2025
254e625
Test NetCDF free surface output
ali-ramadhan Jan 15, 2025
c741de0
Write grid reconstruction data into a NetCDF group
ali-ramadhan Jan 15, 2025
5af72fc
Reorder properties and function signatures
ali-ramadhan Jan 15, 2025
ae6eacf
Remove mysterious `grid = model.grid` in NetCDF tests
ali-ramadhan Jan 15, 2025
31b99e3
Update `NetCDFOutputWriter` docstring
ali-ramadhan Jan 15, 2025
b352fb0
Merge branch 'main' into ali/netcdf-field-timeseries
ali-ramadhan Jan 16, 2025
88eeb25
Bump version 0.96.0
ali-ramadhan Jan 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Oceananigans"
uuid = "9e8cae18-63c1-5223-a75c-80ca9d6e9a09"
authors = ["Climate Modeling Alliance and contributors"]
version = "0.95.6"
version = "0.96.0"

[deps]
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
Expand Down
9 changes: 4 additions & 5 deletions src/Grids/grid_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ using LinearAlgebra: dot, cross
using OffsetArrays: IdOffsetRange

"""
_property(ξ, T, ℓ, N, with_halos=false)
_property(ξ, T, ℓ, N, with_halos)

Return the grid property `ξ`, either `with_halos` or without,
for topology `T`, (instantiated) location `ℓ`, and dimension length `N`.
Expand Down Expand Up @@ -298,13 +298,13 @@ end

function dimension_summary(topo, name, dom, z::AbstractVerticalCoordinate, pad_domain=0)
prefix = domain_summary(topo, name, dom)
padding = " "^(pad_domain+1)
padding = " "^(pad_domain+1)
return string(prefix, padding, coordinate_summary(topo, z.Δᵃᵃᶜ, name))
end

function dimension_summary(topo, name, dom, spacing, pad_domain=0)
prefix = domain_summary(topo, name, dom)
padding = " "^(pad_domain+1)
padding = " "^(pad_domain+1)
return string(prefix, padding, coordinate_summary(topo, spacing, name))
end

Expand Down Expand Up @@ -495,7 +495,7 @@ function add_halos(data, loc, topo, sz, halo_sz; warnings=true)

offset_array[1:nx, 1:ny, 1:nz] = data[1:nx, 1:ny, 1:nz]

# return to data's original architecture
# return to data's original architecture
map(a -> on_architecture(arch, a), offset_array)

return offset_array
Expand All @@ -505,4 +505,3 @@ function add_halos(data::AbstractArray{FT, 2} where FT, loc, topo, sz, halo_sz;
Nx, Ny = size(data)
return add_halos(reshape(data, (Nx, Ny, 1)), loc, topo, sz, halo_sz; warnings)
end

9 changes: 5 additions & 4 deletions src/OutputWriters/fetch_output.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,19 @@ end

convert_output(output, writer) = output

function convert_output(output::AbstractArray, writer)
function convert_output(output::AbstractArray, array_type)
if architecture(output) isa GPU
output_array = writer.array_type(undef, size(output)...)
output_array = array_type(undef, size(output)...)
copyto!(output_array, output)
else
output_array = convert(writer.array_type, output)
output_array = convert(array_type, output)
end

return output_array
end

convert_output(output::AbstractArray, writer::AbstractOutputWriter) = convert_output(output, writer.array_type)

# Need to broadcast manually because of https://github.com/JuliaLang/julia/issues/30836
convert_output(outputs::NamedTuple, writer) =
NamedTuple(name => convert_output(outputs[name], writer) for name in keys(outputs))
Expand All @@ -48,4 +50,3 @@ function fetch_and_convert_output(output, model, writer)
end

fetch_and_convert_output(output::ZeroField, model, writer) = zero(eltype(output))

Loading
Loading