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

outputinfo(filename) for inspecting output without loading data #3859

Open
glwagner opened this issue Oct 23, 2024 · 7 comments
Open

outputinfo(filename) for inspecting output without loading data #3859

glwagner opened this issue Oct 23, 2024 · 7 comments

Comments

@glwagner
Copy link
Member

glwagner commented Oct 23, 2024

Another utility that I believe is needed is a function that displays the information in an output file. For example something like

julia> outputinfo(filename)

which displays things like

  • the names of the fields
  • information about the fields? location, indices, size
  • the grid
  • the number of output snapshots
  • the output times

anything else?

Originally posted by @glwagner in #3793 (comment)

@glwagner
Copy link
Member Author

@ali-ramadhan you mentioned that the show method for FieldDataset has something similar. What does this look like?

@navidcy
Copy link
Collaborator

navidcy commented Oct 23, 2024

Suggestion: If the filename loaded is, e.g., a _part1.jld2 then it would be of interest to detail that and whether this is part1 out of X?

@glwagner
Copy link
Member Author

Yes though I don't completely understand --- if the user writes "part 1", would they not know its part 1?

Maybe this should work if "part1" is not provided? It would also be nice, separately, if FieldTimeSeries could construct a continuous time series.

@navidcy
Copy link
Collaborator

navidcy commented Oct 23, 2024

Hm... true. Perhaps this is a different discussion, but probably we want an output without any _partX ending in the series of output files with splitting? (It's definitely a different discussion and when that's settled we can revisit the outputinfo(filename)! -- What you suggested above sounds good!)

@ali-ramadhan
Copy link
Member

@glwagner It's this show method:

function Base.show(io::IO, fds::FieldDataset)
s = "FieldDataset with $(length(fds.fields)) fields and $(length(fds.metadata)) metadata entries:\n"
n_fields = length(fds.fields)
for (i, (name, fts)) in enumerate(pairs(fds.fields))
prefix = i == n_fields ? "└── " : "├── "
s *= prefix * "$name: " * summary(fts) * '\n'
end
return print(io, s)
end

and looks something like this:

FieldDataset with 9 fields and 0 metadata entries:
├── v: 865×421×1×5761 FieldTimeSeries{OnDisk} located at (Center, Face, Center) of v at /home/alir/test/simulation_surface_slices.jld2
├── S: 865×420×1×5761 FieldTimeSeries{OnDisk} located at (Center, Center, Center) of S at /home/alir/test/simulation_surface_slices.jld2
├── w: 865×420×1×5761 FieldTimeSeries{OnDisk} located at (Center, Center, Face) of w at /home/alir/test/simulation_surface_slices.jld2
├── T: 865×420×1×5761 FieldTimeSeries{OnDisk} located at (Center, Center, Center) of T at /home/alir/test/simulation_surface_slices.jld2
├── Alk: 865×420×1×5761 FieldTimeSeries{OnDisk} located at (Center, Center, Center) of Alk at /home/alir/test/simulation_surface_slices.jld2
├── DIC: 865×420×1×5761 FieldTimeSeries{OnDisk} located at (Center, Center, Center) of DIC at /home/alir/test/simulation_surface_slices.jld2
├── u: 866×420×1×5761 FieldTimeSeries{OnDisk} located at (Face, Center, Center) of u at /home/alir/test/simulation_surface_slices.jld2
├── pCO₂: 865×420×1×5761 FieldTimeSeries{OnDisk} located at (Center, Center, Center) of pCO₂ at /home/alir/test/simulation_surface_slices.jld2
└── CO₂_surface_flux: 865×420×1×5761 FieldTimeSeries{OnDisk} located at (Center, Center, ⋅) of CO₂_surface_flux at /home/alir/test/simulation_surface_slices.jld2

so it's missing the the output times and perhaps more grid information. But in general it could be improved. I just ended up calling summary(fts) for each FieldTimeseries.

@glwagner
Copy link
Member Author

glwagner commented Oct 24, 2024

Is FieldDataset designed so that every field should have the same times, grid, etc? (I guess we can ask the same question for a JLD2 file.) It'd be nice to be able to assume this.

@ali-ramadhan
Copy link
Member

ali-ramadhan commented Oct 24, 2024

It was indeed designed just to provide convenient access to all FieldTimeSeries from one JLD2 file.

This assumption could of course be relaxed as FieldDataset doesn't rely on grid or times, but this is how I've been using it. Same with JLD2 files for me. Surface fields get one file, 3D fields another, zonal slices another, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants