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

Load compression plugins for virtual datasets with h5wasm #1662

Merged
merged 1 commit into from
Jun 7, 2024

Conversation

axelboc
Copy link
Contributor

@axelboc axelboc commented Jun 5, 2024

To address silx-kit/vscode-h5web#43

Compression plugins required to read virtual datasets, which have compressed datasets as sources, are now loaded automatically in both H5WasmProvider and H5WasmLocalFileProvider.

h5wasm now exposes a virtual_sources array in the Metadata object, which I parse and store in our Dataset model. I then get the filters of every virtual source dataset located within the same file (file: '.') and load the corresponding compression plugins.

By storing the virtual sources in the Dataset model, we open the door to showing this information in the MetadataViewer in the future if the provider supports it.

image

Comment on lines 174 to 114
const plugin = PLUGINS_BY_FILTER_ID[filter.id];
if (!plugin) {
// eslint-disable-next-line no-console
console.warn(
`Compression filter ${filter.id} not supported (${filter.name})`,
);
continue;
}
const pluginsToLoad = allFilters
.map(({ id }) => PLUGINS_BY_FILTER_ID[id])
.filter(isDefined);

for await (const plugin of pluginsToLoad) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This just bring the code in line with H5WasmLocalFileProvider.

@axelboc axelboc requested a review from loichuder June 5, 2024 13:10
Base automatically changed from h5t_str to main June 5, 2024 14:18
@axelboc axelboc force-pushed the virtual-sources branch 2 times, most recently from bf4e056 to fbd0eef Compare June 6, 2024 07:13
@axelboc axelboc merged commit ead05b2 into main Jun 7, 2024
8 checks passed
@axelboc axelboc deleted the virtual-sources branch June 7, 2024 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants