You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The write(::HDF5Writer, ::Fields.Field, ::AbstractString) method does not work for Fields with a PointSpace because
the method expects the input field's space to have a grid and topology. Similarly, read_field cannot recreate the space of a Field with a PointSpace
To Reproduce
using Test
import ClimaCore
using ClimaComms
const comms_ctx = ClimaComms.context(ClimaComms.CPUSingleThreaded())
@testset"HDF5 write/read test for 0d PointSpace"begin
FT = Float32
# instead of directly constructing a PointSpace, we construct Field with a ColumnSpace,# and call the level function to get a Field with a PointSpace
column_space = ClimaCore.CommonSpaces.ColumnSpace(;
z_min =FT(0),
z_max =FT(100),
z_elem =10,
staggering = ClimaCore.Grids.CellCenter(),
)
field_1d = ClimaCore.Fields.local_geometry_field(column_space)
field_0d = ClimaCore.Fields.level(field_1d, 5)
filename =tempname()
writer = ClimaCore.InputOutput.HDF5Writer(filename, comms_ctx)
ClimaCore.InputOutput.write!(writer, field_0d, "field_0d")
close(writer)
reader = ClimaCore.InputOutput.HDF5Reader(filename, comms_ctx)
restart_field_0d = ClimaCore.InputOutput.read_field(reader, "field_0d")
close(reader)
@test restart_field_0d == field_0d
end
Describe the bug
The
write(::HDF5Writer, ::Fields.Field, ::AbstractString)
method does not work for Fields with a PointSpace becausethe method expects the input field's space to have a grid and topology. Similarly,
read_field
cannot recreate the space of a Field with a PointSpaceTo Reproduce
Related issues / PRs
Needed to close : PR
The text was updated successfully, but these errors were encountered: