JuliaIO/HDF5.jl
소개
Julia에서 HDF5 파일 형식으로 데이터를 저장하고 불러옵니다.
기타 프로젝트측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- +2
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
Original
HDF5 interface for the Julia language
HDF5 is a file format and library for storing and accessing data, commonly used for scientific data. HDF5 files can be created and read by numerous programming languages. This package provides an interface to the HDF5 library for the Julia language.
Changelog
Please see HISTORY.md and the release notes. Most changes have deprecation warnings and may not be listed in the HISTORY.md file.
Installation
julia>]
pkg> add HDF5
For custom build instructions please refer to the documentation.
Quickstart
using HDF5
To read and write a variable to a file, one approach is to use the filename:
A = collect(reshape(1:120, 15, 8))
h5write("/tmp/test2.h5", "mygroup2/A", A)
data = h5read("/tmp/test2.h5", "mygroup2/A", (2:3:15, 3:5))
where the last line reads back just A[2:3:15, 3:5] from the dataset.
More fine-grained control can be obtained using functional syntax:
h5open("mydata.h5", "w") do file
write(file, "A", A) # alternatively, say "@write file A"
end
c = h5open("mydata.h5", "r") do file
read(file, "A")
end
This allows you to add variables as they are generated to an open HDF5 file.
You don't have to use the do syntax (file = h5open("mydata.h5", "w") works
just fine), but an advantage is that it will automatically close the file (close(file))
for you, even in cases of error.
Julia's high-level wrapper, providing a dictionary-like interface, may also be of interest:
using HDF5
h5open("test.h5", "w") do file
g = create_group(file, "mygroup") # create a group
g["dset1"] = 3.2 # create a scalar dataset inside the group
attributes(g)["Description"] = "This group contains only a single dataset" # an attribute
end
Convenience functions for attributes attached to datasets are also provided:
A = Vector{Int}(1:10)
h5write("bar.h5", "foo", A)
h5writeattr("bar.h5", "foo", Dict("c"=>"value for metadata parameter c","d"=>"metadata d"))
h5readattr("bar.h5", "foo")
관련 프로젝트 살펴보기
불러오는 중…