-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c81ac41
commit 137cae1
Showing
3 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
Files here are small mock-files for testing. | ||
|
||
Each file should have a code-snippet that was used to create if applicable. | ||
|
||
# Nexus Files | ||
## small_coda.hdf | ||
|
||
```python | ||
# In a notebook cell. | ||
!cp 443503_00031010.hdf copied_coda.hdf | ||
import h5py | ||
|
||
with h5py.File('copied_coda.hdf', 'r+') as f: | ||
instrument_gr = f['entry/instrument'] | ||
keeping_names = ['name', '_publication'] | ||
for name in instrument_gr: | ||
if name not in keeping_names: | ||
del instrument_gr[name] | ||
|
||
# Copy the rest of the file | ||
with h5py.File('small_coda.hdf', 'w') as new_f: | ||
# copy everything | ||
f.copy('entry', new_f) | ||
|
||
``` | ||
|
||
## small_ymir.hdf | ||
|
||
```python | ||
# In a notebook cell. | ||
!cp 876380_00011465.hdf copied_ymir.hdf | ||
import h5py | ||
|
||
with h5py.File('copied_ymir.hdf', 'r+') as f: | ||
instrument_gr = f['entry/instrument'] | ||
keeping_names = ['name', '_publication'] | ||
for name in instrument_gr: | ||
if name not in keeping_names: | ||
del instrument_gr[name] | ||
|
||
# Copy the rest of the file | ||
with h5py.File('small_ymir.hdf', 'w') as new_f: | ||
# copy everything | ||
f.copy('entry', new_f) | ||
|
||
``` |
Binary file not shown.
Binary file not shown.