2021년 1월 7일 목요일

Lists the contents of a file in HDF5 with h5py

- h5ls is applied to a file containing a couple of datasets and a group: 
$ h5ls demo.hdf5
comp                     Dataset {1024}


- prints extended information and also recursively enters groups:
$ h5ls -vlr demo.hdf5
15                       Group
Opened "weather.hdf5" with sec2 driver.
/                        Group
    Location:  1:96
    Links:     1
/15                      Group
    Location:  1:1072
    Links:     1
/15/temperature          Dataset {1024/1024}
    Attribute: dt scalar
        Type:      native double
        Data:  10
    Attribute: start_time scalar
        Type:      native long
        Data:  1375204299
    Location:  1:800
    Links:     1
    Storage:   8192 logical bytes, 8192 allocated bytes, 100.00% utilization
    Type:      native double
/15/wind                 Dataset {2048/2048}
    Attribute: dt scalar
        Type:      native double
        Data:  5
    Location:  1:10896
    Links:     1
    Storage:   16384 logical bytes, 16384 allocated bytes, 100.00% utilization
    Type:      native double
/comp                    Dataset {1024/1024}
    Location:  1:11168
    Links:     1
    Chunks:    {1024} 4096 bytes
    Storage:   4096 logical bytes, 1456 allocated bytes, 281.32% utilization
    Filter-0:  deflate-1 OPT {4}
    Type:      native int


- h5ls is great for inspecting metadata like this. There’s also a program called h5dump,
which prints data as well, although in a more verbose format:
$ h5dump demo.hdf5
HDF5 "demo.hdf5" {
    GROUP "/" {
        DATASET "array" {
            DATATYPE H5T_STD_I32LE
            DATASPACE SIMPLE { ( 10 ) / ( 10 ) 
        }
        DATA {
            (0): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
        }
    }
    GROUP "group" {
        DATASET "subarray" {
            DATATYPE H5T_STD_I32LE
            DATASPACE SIMPLE { ( 2, 2 ) / ( 2, 2 ) 
        }
        DATA {
            (0,0): 2, 2,
            (1,0): 2, 2
        }
    }
}
    DATASET "scalar" {
        DATATYPE H5T_STD_I32LE
        16 | Chapter 2: Getting Started
        DATASPACE SCALAR
        DATA {
            (0): 42
        }
    }
}

댓글 없음:

댓글 쓰기