NeurodataWithoutBorders / lindi

Linked Data Interface (LINDI) - cloud-friendly access to NWB data
BSD 3-Clause "New" or "Revised" License
1 stars 1 forks source link

Allow LindiH5pyFile.from_hdf5_file to accept remote URL for local file #66

Closed rly closed 2 months ago

rly commented 2 months ago

I would like to download a remote HDF5 file and create a lindi file with references to the remote location using the downloaded local HDF5 file. I think creating such a lindi file using a remote HDF5 file would take longer than downloading the file and creating such a lindi file using the downloaded local HDF5 file, but I am not sure.

LindiH5ZarrStore.from_file lets you create a store using a local file with references to the remote location: https://github.com/NeurodataWithoutBorders/lindi/blob/1fc62ef070b9cb545704f69a71dad26acbdb6f7f/lindi/LindiH5ZarrStore/LindiH5ZarrStore.py#L69

LindiH5pyFile.from_hdf5_file calls LindiH5ZarrStore.from_file but does not let the user set the remote location to a location different from the file location: https://github.com/NeurodataWithoutBorders/lindi/blob/1fc62ef070b9cb545704f69a71dad26acbdb6f7f/lindi/LindiH5pyFile/LindiH5pyFile.py#L61

This PR exposes the url keyword argument in LindiH5ZarrStore.from_file to LindiH5pyFile.from_hdf5_file to allow those two locations to be different. The docstring is copied from LindiH5ZarrStore.from_file and modified.

@magland please confirm that the last sentence of the docstring for url is still valid.

codecov-commenter commented 2 months ago

Codecov Report

Attention: Patch coverage is 50.00000% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 81.35%. Comparing base (1fc62ef) to head (e50931b).

Files Patch % Lines
lindi/LindiH5pyFile/LindiH5pyFile.py 50.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #66 +/- ## ======================================= Coverage 81.35% 81.35% ======================================= Files 30 30 Lines 2194 2194 ======================================= Hits 1785 1785 Misses 409 409 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.