sidescanpy.io.hdf5.survey_dir#
Helpers for reading and rewriting directories of .ss.h5 files.
read_survey_dir()– one frequency channel of a directory of files, lazily concatenated alongping.concat_survey_frequency(),available_frequencies(),load_channel_dataset()– lower-level pieces of the same multi-file convention (a file or a directory both work for the latter two).read_survey_pings()– every frequency channel of a file or directory, cut to one ping range and loaded.check_disk_space(),atomic_write_survey()– safe in-place rewrite support.
2026 rshomberg@uri.edu
Contents
Lazily concatenate |
|
Read a directory of |
|
Every frequency key present at |
|
One frequency channel's dataset from |
|
Every frequency channel at |
|
True if there's plausibly enough free space to safely rewrite |
|
Write |
- sidescanpy.io.hdf5.survey_dir.concat_survey_frequency(files, freq_key, chunks)#
Lazily concatenate
freq_key’s channel across every file infiles(sorted, so typically time order) into one dask-backed dataset spanning the whole survey – no per-file restart.Most callers want
read_survey_dir()orload_channel_dataset()instead, which wrap this.Returns
(concatenated_ds, file_start_ping)wherefile_start_ping[path]is that file’s own first ping’s position in the concatenated dataset’s global ping axis (0 for the first file).concatenated_dsisNoneif no file has this frequency at all.
- sidescanpy.io.hdf5.survey_dir.read_survey_dir(path, *, freq_key, chunks=None)#
Read a directory of
.ss.h5files as one lazily concatenated dataset offreq_key.Files are taken in sorted filename order. Thin wrapper over
concat_survey_frequency()that drops the per-file start-ping map.Raises
FileNotFoundErrorifpathhas no.ss.h5files andValueErrorif none of them carriesfreq_key.
- sidescanpy.io.hdf5.survey_dir.available_frequencies(input_path, chunks=None)#
Every frequency key present at
input_path– a single.ss.h5file (its own.frequencies) or a directory of them (the union across every file – not every file need carry every key, same asconcat_survey_frequency()’s own per-file tolerance).Raises
FileNotFoundErrorifinput_pathis a directory with no.ss.h5files in it.
- sidescanpy.io.hdf5.survey_dir.load_channel_dataset(input_path, freq_key, chunks=None)#
One frequency channel’s dataset from
input_path.input_pathmay be a single.ss.h5file (original behavior, byte-identical – callsread_surveyexactly as every caller already did directly) or a directory of them, lazily dask-concatenated in filename/acquisition order viaconcat_survey_frequency()– the same multi-file conventionsidescan-export’s own--ss-h5-diralready uses. This lets a survey that was never concatenated into one file at conversion time (e.g. for memory safety) still be analyzed as one logical survey.Raises
FileNotFoundError/ValueErroriffreq_keyisn’t present anywhere atinput_path– never returnsNone, unlikeconcat_survey_frequency()itself, so every caller here can treat this as a normal “the dataset I asked for” return.
- sidescanpy.io.hdf5.survey_dir.read_survey_pings(input_path, start=0, stop=None, *, chunks=None)#
Every frequency channel at
input_pathcut to pings[start, stop), loaded.input_pathis a.ss.h5file or a directory of them (seeload_channel_dataset()). Every channel is cut to the same ping range, so channels must share one ping axis. Only the channel datasets are carried; aux records are not. For a directory, the survey is named after the directory,source_formatis"ss_h5"andsource_fileslists the.ss.h5files.
- sidescanpy.io.hdf5.survey_dir.check_disk_space(path, multiplier)#
True if there’s plausibly enough free space to safely rewrite
pathin place (conservative flat multiplier of its current size).
- sidescanpy.io.hdf5.survey_dir.atomic_write_survey(survey, path)#
Write
surveyto a temp file next topath, then replacepathonly on full success (a failed write leavespathintact).