Skip to content

Commit

Permalink
More JLD2 shenanigans for reconstructing FieldTimeSeries (#4020)
Browse files Browse the repository at this point in the history
* More JLD2 shenanigans for reconstructing FieldTimeSeries

* Delete reconstructed_grid_type for now
  • Loading branch information
glwagner authored Dec 20, 2024
1 parent 325866b commit da6ee87
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion src/OutputReaders/field_time_series.jl
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,31 @@ end
isreconstructed(grid::JLD2.ReconstructedStatic) = true
isreconstructed(grid::AbstractGrid) = false
isreconstructed(grid::ImmersedBoundaryGrid) = isreconstructed(grid.underlying_grid)
reconstructed_name(::JLD2.ReconstructedStatic{N}) where N = string(N)

function reconstructed_topology(grid::JLD2.ReconstructedStatic)
name = reconstructed_name(grid)
firstcurly = findfirst('{', name)
grid_type = name[1:firstcurly-1]

type_parameters = name[firstcurly+1:end-1]
parameter_list = split(type_parameters, ',')

FTstr = parameter_list[1]
TXstr = parameter_list[2]
TYstr = parameter_list[3]
TZstr = parameter_list[4]

TXsym = Symbol(TXstr)
TYsym = Symbol(TYstr)
TZsym = Symbol(TZstr)

TX = eval(:($(TXsym)))
TY = eval(:($(TYsym)))
TZ = eval(:($(TZsym)))

return (TX, TY, TZ)
end

"""
FieldTimeSeries{LX, LY, LZ}(grid::AbstractGrid [, times=()]; kwargs...)
Expand Down Expand Up @@ -509,7 +534,13 @@ function FieldTimeSeries(path::String, name::String;
Hz = file["$address/Hz"]
zᵃᵃᶠ = file["$address/zᵃᵃᶠ"]
z = file["$address/Δzᵃᵃᶠ"] isa Number ? (zᵃᵃᶠ[1], zᵃᵃᶠ[Nz+1]) : zᵃᵃᶠ[1:Nz+1]
topo = topology(grid)

if isibg
topo = topology(grid)
else
topo = reconstructed_topology(grid)
end

size = (Nx, Ny, Nz)
halo = (Hx, Hy, Hz)

Expand Down

4 comments on commit da6ee87

@glwagner
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/121755

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.95.5 -m "<description of version>" da6ee8745fda308d75a7d8388a47992ebb7f1cc7
git push origin v0.95.5

Also, note the warning: Version 0.95.5 skips over 0.95.4
This can be safely ignored. However, if you want to fix this you can do so. Call register() again after making the fix. This will update the Pull request.

@glwagner
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request updated: JuliaRegistries/General/121755

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.95.5 -m "<description of version>" da6ee8745fda308d75a7d8388a47992ebb7f1cc7
git push origin v0.95.5

Please sign in to comment.