File: test-h5link.py

package info (click to toggle)
r-cran-hdf5r 1.3.8%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 10,192 kB
  • sloc: ansic: 76,883; sh: 82; python: 32; makefile: 13
file content (23 lines) | stat: -rw-r--r-- 662 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import h5py
from numpy import array
import os

os.chdir('/Users/mario/CloudStation/Programming/workspace_h5/_pkg_h5/inst')

with h5py.File('test-h5link.h5', 'w') as f:
    grp = f.create_group("testgroup")
    grp["test"] = array([1, 2, 3])
    subgrp = grp.create_group("subgroup")
    subgrp["test-sub"] = array([4, 5, 6])
    
    # Create Hardlink
    grp2 = f.create_group("hardlink")
    grp2["test2"] = grp["test"]
    
    # Create Softlink
    grp3 = f.create_group("softlink")
    grp3["test3"] = h5py.SoftLink('/testgroup')
    
    # Create External link
    grp4 = f.create_group("extlink")
    grp4["test4"] = h5py.ExternalLink("test-f32.h5", "/")