[h5py] 145/455: More documentation updates; additions to h5p
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Thu Jul 2 18:19:27 UTC 2015
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to annotated tag 1.3.0
in repository h5py.
commit fa51be9adc9357144a7bf7badb0a6ed7f1453e6f
Author: andrewcollette <andrew.collette at gmail.com>
Date: Fri Oct 24 01:24:19 2008 +0000
More documentation updates; additions to h5p
---
docs_api/source/automod.py | 68 ++++-
docs_api/source/low/h5f.rst | 19 +-
docs_api/source/low/h5o.rst | 29 ++
docs_api/source/low/h5p.rst | 42 ++-
docs_api/source/low/h5z.rst | 5 +
h5py/defs.pxd | 117 +++++---
h5py/h5a.pyx | 37 ++-
h5py/h5g.pyx | 28 +-
h5py/h5p.pxd | 44 ++-
h5py/h5p.pyx | 709 +++++++-------------------------------------
h5py/h5p_dcid.pxi | 345 +++++++++++++++++++++
h5py/h5p_faid.pxi | 189 ++++++++++++
h5py/h5p_fcid.pxi | 121 ++++++++
h5py/h5p_gcid.pxi | 17 ++
h5py/h5p_laid.pxi | 75 +++++
h5py/h5p_lcid.pxi | 19 ++
setup.py | 9 +-
17 files changed, 1159 insertions(+), 714 deletions(-)
diff --git a/docs_api/source/automod.py b/docs_api/source/automod.py
index 3723458..1956eb1 100644
--- a/docs_api/source/automod.py
+++ b/docs_api/source/automod.py
@@ -14,10 +14,10 @@ class_types = { "ObjectID": "h5py.h5.ObjectID",
"FileID": "h5py.h5f.FileID",
"DatasetID": "h5py.h5d.DatasetID",
"TypeID": "h5py.h5t.TypeID",
- "dataset creation property list": "h5py.h5p.PropDCID",
- "dataset access property list": "h5py.h5p.PropDAID",
- "file creation property list": "h5py.h5p.PropFCID",
- "file access property list": "h5py.h5p.PropFAID"}
+ "[Dd]ataset creation property list": "h5py.h5p.PropDCID",
+ "[Dd]ataset access property list": "h5py.h5p.PropDAID",
+ "[Ff]ile creation property list": "h5py.h5p.PropFCID",
+ "[Ff]ile access property list": "h5py.h5p.PropFAID"}
def mkclass(ipt, cls):
@@ -39,12 +39,14 @@ def replaceall(instring, rdict):
const_only = r"(?:h5[a-z]{0,2}\.)?[A-Z_][A-Z0-9_]+"
# Constant name embeddded in context (whitespace, parens, etc.)
-const_pattern = r"(?:^|\s+)\W?%s[\):\.,]?\.?(?:$|\s+)" % const_only
+const_pattern = r"(?:^|\s+)\W?%s\*?\W?\.?(?:$|\s+)" % const_only
+
+const_category = r"%s\*" % const_only
# These match the regexp but are not valid constants
const_exclude = r"HDF5|API|H5|H5A|H5D|H5F|H5P|H5Z|" + \
r"INT\s|UINT|STRING|LONG|PHIL|GIL|TUPLE|LIST|FORTRAN|" +\
- r"BOOL|NULL|\sNOT\s"
+ r"BOOL|NULL|\sNOT\s|\sSZIP\s"
def replace_constant(instring, mod, match):
""" Callback for re.sub, to generate the ReST for a constant in-place """
@@ -54,20 +56,57 @@ def replace_constant(instring, mod, match):
if re.search(const_exclude, matchstring):
return matchstring
- display = re.findall(const_only, matchstring)[0]
+ if re.search(const_category, matchstring):
+ display = re.findall(const_category, matchstring)[0]
+ target = display[0:-2]
+ target = 'ref.'+target if 'h5' in target else 'ref.%s.%s' % (mod.split('.')[-1], target)
+ rpl = ':ref:`%s <%s>`' % (display, target)
+ #print rpl
+ return re.sub(const_category, rpl, matchstring)
+ else:
+ display = re.findall(const_only, matchstring)[0]
+ target = display
+ target = 'h5py.'+target if 'h5' in target else '%s.%s' % (mod, target)
+ rpl = ':data:`%s <%s>`' % (display, target)
+ return re.sub(const_only, rpl, matchstring)
+
+
+# --- Resolve inline references to modules ---
+
+mod_pattern = re.compile(r"\s+(?!h5py)(?P<name>h5[a-z]{1,2})\W?(?:$|\s+)"
+
+module_pattern = r"\s+h5[a-z]{1,2}\W?(?:$|\s+)"
+module_only = r"h5[a-z]{1,2}"
+module_exclude = r"h5py"
+
+def replace_module(instring, match):
+
+ matchstring = instring[match.start():match.end()]
+
+ if re.search(module_exclude, matchstring):
+ return matchstring
+
+ display = re.findall(module_only, matchstring)[0]
target = display
- if 'h5' in target:
- target = 'h5py.%s' % target
- else:
- target = '%s.%s' % (mod, target)
- rpl = ':data:`%s <%s>`' % (display, target)
+ rpl = ':mod:`%s <%s>`' % (display, 'h5py.'+target)
#print rpl
- return re.sub(const_only, rpl, matchstring)
+ return re.sub(module_only, rpl, matchstring)
+
+# --- Resolve parameter lists
+
+param_pattern = re.compile(r"^\s*\+\s+(?P<desc>[^\s\(].*[^\s\)])(?:\s+\((?P<default>[^\s\(].*[^\s\)])\))?$")
+def replace_param(instring, match):
+
+ desc, default = match.group('desc'), match.group('default')
+ default = ' (%s) ' % default if default is not None else ''
+
+ return ":param %s:%s" % (desc, default)
# --- Sphinx extension code ---
+
def setup(spx):
def proc_doc(app, what, name, obj, options, lines):
@@ -94,7 +133,10 @@ def setup(spx):
else:
mod = ".".join(name.split('.')[0:2]) # i.e. "h5py.h5z"
lines[:] = [re.sub(const_pattern, partial(replace_constant, x, mod), x) for x in final_lines]
+ lines[:] = [re.sub(module_pattern, partial(replace_module, x), x) for x in lines]
+ lines[:] = [re.sub(param_pattern, partial(replace_param, x), x) for x in lines]
lines[:] = [replaceall(x, replacements) for x in lines]
+ #print "\n".join(lines)
def proc_sig(app, what, name, obj, options, signature, return_annotation):
""" Auto-generate function signatures from docstrings """
diff --git a/docs_api/source/low/h5f.rst b/docs_api/source/low/h5f.rst
index d76aee4..e2ee031 100644
--- a/docs_api/source/low/h5f.rst
+++ b/docs_api/source/low/h5f.rst
@@ -25,6 +25,8 @@ File objects
Module constants
----------------
+.. _ref.h5f.ACC:
+
File access flags
~~~~~~~~~~~~~~~~~
@@ -44,17 +46,30 @@ File access flags
Open in read-only mode
-Other constants
-~~~~~~~~~~~~~~~
+
+.. _ref.h5f.CLOSE:
+
+File close strength
+~~~~~~~~~~~~~~~~~~~
.. data:: CLOSE_WEAK
.. data:: CLOSE_SEMI
.. data:: CLOSE_STRONG
.. data:: CLOSE_DEFAULT
+.. _ref.h5f.SCOPE:
+
+File scope
+~~~~~~~~~~
+
.. data:: SCOPE_LOCAL
.. data:: SCOPE_GLOBAL
+.. _ref.h5f.OBJ:
+
+Object types
+~~~~~~~~~~~~
+
.. data:: OBJ_FILE
.. data:: OBJ_DATASET
.. data:: OBJ_GROUP
diff --git a/docs_api/source/low/h5o.rst b/docs_api/source/low/h5o.rst
index 8b0e44f..bd92550 100644
--- a/docs_api/source/low/h5o.rst
+++ b/docs_api/source/low/h5o.rst
@@ -5,3 +5,32 @@ This module is only available when compiled against HDF5 1.8.0 and higher.
.. automodule:: h5py.h5o
:members:
+
+Module constants
+----------------
+
+.. _ref.h5o.COPY:
+
+Copy flags
+~~~~~~~~~~
+
+.. data:: COPY_SHALLOW_HIERARCHY_FLAG
+
+ Copy only immediate members of a group.
+
+.. data:: COPY_EXPAND_SOFT_LINK_FLAG
+
+ Expand soft links into new objects.
+
+.. data:: COPY_EXPAND_EXT_LINK_FLAG
+
+ Expand external link into new objects.
+
+.. data:: COPY_EXPAND_REFERENCE_FLAG
+
+ Copy objects that are pointed to by references.
+
+.. data:: COPY_WITHOUT_ATTR_FLAG
+
+ Copy object without copying attributes.
+
diff --git a/docs_api/source/low/h5p.rst b/docs_api/source/low/h5p.rst
index 002e166..68c39e1 100644
--- a/docs_api/source/low/h5p.rst
+++ b/docs_api/source/low/h5p.rst
@@ -23,6 +23,14 @@ Base classes
:show-inheritance:
:members:
+.. autoclass:: PropCreateID
+ :show-inheritance:
+ :members:
+
+.. autoclass:: PropCopyID
+ :show-inheritance:
+ :members:
+
File creation
-------------
@@ -44,11 +52,36 @@ Dataset creation
:show-inheritance:
:members:
+
+Link creation (1.8 only)
+------------------------
+
+.. autoclass:: PropLCID
+ :show-inheritance:
+ :members:
+
+
+Link access (1.8 only)
+----------------------
+
+.. autoclass:: PropLAID
+ :show-inheritance:
+ :members:
+
+
+Group creation (1.8 only)
+-------------------------
+
+.. autoclass:: PropGCID
+ :show-inheritance:
+ :members:
+
+
Module constants
----------------
-Predfined classes (all versions)
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Predefined classes (all versions)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. data:: DEFAULT
.. data:: FILE_CREATE
@@ -60,7 +93,10 @@ Predfined classes (all versions)
Predefined classes (HDF5 1.8.X only)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-(none yet)
+.. data:: OBJECT_COPY
+.. data:: LINK_CREATE
+.. data:: LINK_ACCESS
+.. data:: GROUP_CREATE
diff --git a/docs_api/source/low/h5z.rst b/docs_api/source/low/h5z.rst
index d33b72b..9397f27 100644
--- a/docs_api/source/low/h5z.rst
+++ b/docs_api/source/low/h5z.rst
@@ -7,6 +7,8 @@ Module H5Z
Module constants
----------------
+.. _ref.h5z.FILTER:
+
Predefined filters
~~~~~~~~~~~~~~~~~~
@@ -17,6 +19,7 @@ Predefined filters
.. data:: FILTER_FLETCHER32
.. data:: FILTER_SZIP
+.. _ref.h5z.FLAG:
Filter flags
~~~~~~~~~~~~
@@ -28,6 +31,8 @@ Filter flags
.. data:: FLAG_REVERSE
.. data:: FLAG_SKIP_EDC
+.. _ref.h5z.SZIP:
+
SZIP-specific options
~~~~~~~~~~~~~~~~~~~~~
diff --git a/h5py/defs.pxd b/h5py/defs.pxd
index 8e3a4e3..ee00992 100644
--- a/h5py/defs.pxd
+++ b/h5py/defs.pxd
@@ -30,6 +30,7 @@ cdef extern from "stdlib.h":
void free(void *ptr)
cdef extern from "string.h":
+ size_t strlen(char* s)
char *strchr(char *s, int c)
char *strcpy(char *dest, char *src)
char *strncpy(char *dest, char *src, size_t n)
@@ -88,7 +89,7 @@ cdef extern from "hdf5.h":
herr_t H5close() except *
herr_t H5get_libversion(unsigned *majnum, unsigned *minnum,
- unsigned *relnum ) except *
+ unsigned *relnum) except *
# New in 1.8.X
IF H5PY_18API:
@@ -231,7 +232,7 @@ cdef extern from "hdf5.h":
herr_t H5Dextend(hid_t dataset_id, hsize_t *size) except *
herr_t H5Dfill(void *fill, hid_t fill_type_id, void *buf,
- hid_t buf_type_id, hid_t space_id ) except *
+ hid_t buf_type_id, hid_t space_id ) except *
herr_t H5Dvlen_get_buf_size(hid_t dset_id, hid_t type_id,
hid_t space_id, hsize_t *size) except *
herr_t H5Dvlen_reclaim(hid_t type_id, hid_t space_id,
@@ -287,7 +288,7 @@ cdef extern from "hdf5.h":
herr_t H5Fmount(hid_t loc_id, char *name, hid_t child_id, hid_t plist_id) except *
herr_t H5Funmount(hid_t loc_id, char *name) except *
herr_t H5Fget_filesize(hid_t file_id, hsize_t *size) except *
- hid_t H5Fget_create_plist(hid_t file_id ) except *
+ hid_t H5Fget_create_plist(hid_t file_id ) except *
hid_t H5Fget_access_plist(hid_t file_id) except *
hssize_t H5Fget_freespace(hid_t file_id) except *
ssize_t H5Fget_name(hid_t obj_id, char *name, size_t size) except *
@@ -379,26 +380,26 @@ cdef extern from "hdf5.h":
size_t linklen
#H5O_stat_t ohdr # Object header information. New in HDF5 1.6
- hid_t H5Gcreate(hid_t loc_id, char *name, size_t size_hint ) except *
- hid_t H5Gopen(hid_t loc_id, char *name ) except *
+ hid_t H5Gcreate(hid_t loc_id, char *name, size_t size_hint) except *
+ hid_t H5Gopen(hid_t loc_id, char *name) except *
herr_t H5Gclose(hid_t group_id) except *
herr_t H5Glink2( hid_t curr_loc_id, char *current_name,
- H5G_link_t link_type, hid_t new_loc_id, char *new_name ) except *
+ H5G_link_t link_type, hid_t new_loc_id, char *new_name) except *
herr_t H5Gunlink (hid_t file_id, char *name) except *
herr_t H5Gmove2(hid_t src_loc_id, char *src_name,
- hid_t dst_loc_id, char *dst_name ) except *
+ hid_t dst_loc_id, char *dst_name) except *
herr_t H5Gget_num_objs(hid_t loc_id, hsize_t* num_obj) except *
- int H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name, size_t size ) except *
- int H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx ) except *
+ int H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name, size_t size) except *
+ int H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx) except *
ctypedef herr_t (*H5G_iterate_t)(hid_t group, char *name, void* op_data) except 2
herr_t H5Giterate(hid_t loc_id, char *name, int *idx, H5G_iterate_t operator, void* data) except *
herr_t H5Gget_objinfo(hid_t loc_id, char* name, int follow_link, H5G_stat_t *statbuf) except *
herr_t H5Gget_linkval(hid_t loc_id, char *name, size_t size, char *value) except *
- herr_t H5Gset_comment(hid_t loc_id, char *name, char *comment ) except *
- int H5Gget_comment(hid_t loc_id, char *name, size_t bufsize, char *comment ) except *
+ herr_t H5Gset_comment(hid_t loc_id, char *name, char *comment) except *
+ int H5Gget_comment(hid_t loc_id, char *name, size_t bufsize, char *comment) except *
# New extensions in 1.8.X
IF H5PY_18API:
@@ -727,13 +728,19 @@ cdef extern from "hdf5.h":
hid_t H5P_FILE_ACCESS
hid_t H5P_DATASET_CREATE
hid_t H5P_DATASET_XFER
+ IF H5PY_18API:
+ hid_t H5P_OBJECT_CREATE
+ hid_t H5P_OBJECT_COPY
+ hid_t H5P_LINK_CREATE
+ hid_t H5P_LINK_ACCESS
+ hid_t H5P_GROUP_CREATE
# General operations
hid_t H5Pcreate(hid_t plist_id) except *
hid_t H5Pcopy(hid_t plist_id) except *
int H5Pget_class(hid_t plist_id) except *
herr_t H5Pclose(hid_t plist_id) except *
- htri_t H5Pequal( hid_t id1, hid_t id2 ) except *
+ htri_t H5Pequal( hid_t id1, hid_t id2 ) except *
herr_t H5Pclose_class(hid_t id) except *
# File creation properties
@@ -753,8 +760,8 @@ cdef extern from "hdf5.h":
herr_t H5Pget_fclose_degree(hid_t fapl_id, H5F_close_degree_t *fc_degree) except *
herr_t H5Pset_fapl_core( hid_t fapl_id, size_t increment, hbool_t backing_store) except *
herr_t H5Pget_fapl_core( hid_t fapl_id, size_t *increment, hbool_t *backing_store) except *
- herr_t H5Pset_fapl_family ( hid_t fapl_id, hsize_t memb_size, hid_t memb_fapl_id ) except *
- herr_t H5Pget_fapl_family ( hid_t fapl_id, hsize_t *memb_size, hid_t *memb_fapl_id ) except *
+ herr_t H5Pset_fapl_family ( hid_t fapl_id, hsize_t memb_size, hid_t memb_fapl_id ) except *
+ herr_t H5Pget_fapl_family ( hid_t fapl_id, hsize_t *memb_size, hid_t *memb_fapl_id ) except *
herr_t H5Pset_family_offset ( hid_t fapl_id, hsize_t offset) except *
herr_t H5Pget_family_offset ( hid_t fapl_id, hsize_t *offset) except *
herr_t H5Pset_fapl_log(hid_t fapl_id, char *logfile, unsigned int flags, size_t buf_size) except *
@@ -772,28 +779,28 @@ cdef extern from "hdf5.h":
herr_t H5Pset_layout(hid_t plist, int layout) except *
H5D_layout_t H5Pget_layout(hid_t plist) except *
herr_t H5Pset_chunk(hid_t plist, int ndims, hsize_t * dim) except *
- int H5Pget_chunk(hid_t plist, int max_ndims, hsize_t * dims ) except *
+ int H5Pget_chunk(hid_t plist, int max_ndims, hsize_t * dims ) except *
herr_t H5Pset_deflate( hid_t plist, int level) except *
- herr_t H5Pset_fill_value(hid_t plist_id, hid_t type_id, void *value ) except *
- herr_t H5Pget_fill_value(hid_t plist_id, hid_t type_id, void *value ) except *
- herr_t H5Pfill_value_defined(hid_t plist_id, H5D_fill_value_t *status ) except *
- herr_t H5Pset_fill_time(hid_t plist_id, H5D_fill_time_t fill_time ) except *
- herr_t H5Pget_fill_time(hid_t plist_id, H5D_fill_time_t *fill_time ) except *
- herr_t H5Pset_alloc_time(hid_t plist_id, H5D_alloc_time_t alloc_time ) except *
- herr_t H5Pget_alloc_time(hid_t plist_id, H5D_alloc_time_t *alloc_time ) except *
+ herr_t H5Pset_fill_value(hid_t plist_id, hid_t type_id, void *value ) except *
+ herr_t H5Pget_fill_value(hid_t plist_id, hid_t type_id, void *value ) except *
+ herr_t H5Pfill_value_defined(hid_t plist_id, H5D_fill_value_t *status ) except *
+ herr_t H5Pset_fill_time(hid_t plist_id, H5D_fill_time_t fill_time ) except *
+ herr_t H5Pget_fill_time(hid_t plist_id, H5D_fill_time_t *fill_time ) except *
+ herr_t H5Pset_alloc_time(hid_t plist_id, H5D_alloc_time_t alloc_time ) except *
+ herr_t H5Pget_alloc_time(hid_t plist_id, H5D_alloc_time_t *alloc_time ) except *
herr_t H5Pset_filter(hid_t plist, H5Z_filter_t filter, unsigned int flags,
- size_t cd_nelmts, unsigned int cd_values[] ) except *
+ size_t cd_nelmts, unsigned int cd_values[] ) except *
htri_t H5Pall_filters_avail(hid_t dcpl_id) except *
int H5Pget_nfilters(hid_t plist) except *
H5Z_filter_t H5Pget_filter(hid_t plist, unsigned int filter_number,
unsigned int *flags, size_t *cd_nelmts,
- unsigned int *cd_values, size_t namelen, char name[] ) except *
+ unsigned int *cd_values, size_t namelen, char name[] ) except *
herr_t H5Pget_filter_by_id( hid_t plist_id, H5Z_filter_t filter,
unsigned int *flags, size_t *cd_nelmts,
unsigned int cd_values[], size_t namelen, char name[]) except *
herr_t H5Pmodify_filter(hid_t plist, H5Z_filter_t filter, unsigned int flags,
- size_t cd_nelmts, unsigned int cd_values[] ) except *
- herr_t H5Premove_filter(hid_t plist, H5Z_filter_t filter ) except *
+ size_t cd_nelmts, unsigned int cd_values[] ) except *
+ herr_t H5Premove_filter(hid_t plist, H5Z_filter_t filter ) except *
herr_t H5Pset_fletcher32(hid_t plist) except *
herr_t H5Pset_shuffle(hid_t plist_id) except *
herr_t H5Pset_szip(hid_t plist, unsigned int options_mask, unsigned int pixels_per_block) except *
@@ -808,6 +815,32 @@ cdef extern from "hdf5.h":
herr_t H5Pset_fapl_log(hid_t fapl_id, char *logfile,
unsigned int flags, size_t buf_size) except *
+ # New in 1.8
+ IF H5PY_18API:
+
+ herr_t H5Pset_nlinks(hid_t plist_id, size_t nlinks) except *
+ herr_t H5Pget_nlinks(hid_t plist_id, size_t *nlinks) except *
+ herr_t H5Pset_elink_prefix(hid_t plist_id, char *prefix) except *
+ ssize_t H5Pget_elink_prefix(hid_t plist_id, char *prefix, size_t size) except *
+
+ herr_t H5Pset_create_intermediate_group(hid_t plist_id, unsigned crt_intmd) except *
+ herr_t H5Pget_create_intermediate_group(hid_t plist_id, unsigned *crt_intmd) except *
+
+ herr_t H5Pset_copy_object(hid_t plist_id, unsigned crt_intmd) except *
+ herr_t H5Pget_copy_object(hid_t plist_id, unsigned *crt_intmd) except *
+
+ herr_t H5Pset_char_encoding(hid_t plist_id, H5T_cset_t encoding) except *
+ herr_t H5Pget_char_encoding(hid_t plist_id, H5T_cset_t *encoding) except *
+
+ herr_t H5Pset_local_heap_size_hint(hid_t plist_id, size_t size_hint) except *
+ herr_t H5Pget_local_heap_size_hint(hid_t plist_id, size_t *size_hint) except *
+ herr_t H5Pset_link_phase_change(hid_t plist_id, unsigned max_compact, unsigned min_dense) except *
+ herr_t H5Pget_link_phase_change(hid_t plist_id, unsigned *max_compact , unsigned *min_dense) except *
+ herr_t H5Pset_est_link_info(hid_t plist_id, unsigned est_num_entries, unsigned est_name_len) except *
+ herr_t H5Pget_est_link_info(hid_t plist_id, unsigned *est_num_entries , unsigned *est_name_len) except *
+ herr_t H5Pset_link_creation_order(hid_t plist_id, unsigned crt_order_flags) except *
+ herr_t H5Pget_link_creation_order(hid_t plist_id, unsigned *crt_order_flags) except *
+
# === H5R - Reference API =====================================================
@@ -871,13 +904,13 @@ cdef extern from "hdf5.h":
# Basic operations
hid_t H5Screate(H5S_class_t type) except *
- hid_t H5Scopy(hid_t space_id ) except *
+ hid_t H5Scopy(hid_t space_id ) except *
herr_t H5Sclose(hid_t space_id) except *
# Simple dataspace operations
hid_t H5Screate_simple(int rank, hsize_t dims[], hsize_t maxdims[]) except *
htri_t H5Sis_simple(hid_t space_id) except *
- herr_t H5Soffset_simple(hid_t space_id, hssize_t *offset ) except *
+ herr_t H5Soffset_simple(hid_t space_id, hssize_t *offset ) except *
int H5Sget_simple_extent_ndims(hid_t space_id) except *
int H5Sget_simple_extent_dims(hid_t space_id, hsize_t dims[], hsize_t maxdims[]) except *
@@ -885,9 +918,9 @@ cdef extern from "hdf5.h":
H5S_class_t H5Sget_simple_extent_type(hid_t space_id) except *
# Extents
- herr_t H5Sextent_copy(hid_t dest_space_id, hid_t source_space_id ) except *
+ herr_t H5Sextent_copy(hid_t dest_space_id, hid_t source_space_id ) except *
herr_t H5Sset_extent_simple(hid_t space_id, int rank,
- hsize_t *current_size, hsize_t *maximum_size ) except *
+ hsize_t *current_size, hsize_t *maximum_size ) except *
herr_t H5Sset_extent_none(hid_t space_id) except *
# Dataspace selection
@@ -905,9 +938,9 @@ cdef extern from "hdf5.h":
herr_t H5Sselect_elements(hid_t space_id, H5S_seloper_t op,
size_t num_elements, hsize_t **coord) except *
- hssize_t H5Sget_select_hyper_nblocks(hid_t space_id ) except *
+ hssize_t H5Sget_select_hyper_nblocks(hid_t space_id ) except *
herr_t H5Sget_select_hyper_blocklist(hid_t space_id,
- hsize_t startblock, hsize_t numblocks, hsize_t *buf ) except *
+ hsize_t startblock, hsize_t numblocks, hsize_t *buf ) except *
herr_t H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op,
hsize_t start[], hsize_t _stride[],
hsize_t count[], hsize_t _block[]) except *
@@ -1069,7 +1102,7 @@ cdef extern from "hdf5.h":
herr_t H5Tcommit(hid_t loc_id, char* name, hid_t type) except *
htri_t H5Tcommitted(hid_t type) except *
hid_t H5Tcopy(hid_t type_id) except *
- htri_t H5Tequal(hid_t type_id1, hid_t type_id2 ) except *
+ htri_t H5Tequal(hid_t type_id1, hid_t type_id2 ) except *
herr_t H5Tlock(hid_t type_id) except *
H5T_class_t H5Tget_class(hid_t type_id) except *
size_t H5Tget_size(hid_t type_id) except? 0
@@ -1094,16 +1127,16 @@ cdef extern from "hdf5.h":
int H5Tget_offset(hid_t type_id) except *
herr_t H5Tset_offset(hid_t type_id, size_t offset) except *
- herr_t H5Tget_pad(hid_t type_id, H5T_pad_t * lsb, H5T_pad_t * msb ) except *
- herr_t H5Tset_pad(hid_t type_id, H5T_pad_t lsb, H5T_pad_t msb ) except *
+ herr_t H5Tget_pad(hid_t type_id, H5T_pad_t * lsb, H5T_pad_t * msb ) except *
+ herr_t H5Tset_pad(hid_t type_id, H5T_pad_t lsb, H5T_pad_t msb ) except *
H5T_sign_t H5Tget_sign(hid_t type_id) except *
herr_t H5Tset_sign(hid_t type_id, H5T_sign_t sign) except *
herr_t H5Tget_fields(hid_t type_id, size_t *spos, size_t *epos,
- size_t *esize, size_t *mpos, size_t *msize ) except *
+ size_t *esize, size_t *mpos, size_t *msize ) except *
herr_t H5Tset_fields(hid_t type_id, size_t spos, size_t epos,
- size_t esize, size_t mpos, size_t msize ) except *
+ size_t esize, size_t mpos, size_t msize ) except *
size_t H5Tget_ebias(hid_t type_id) except? 0
herr_t H5Tset_ebias(hid_t type_id, size_t ebias) except *
@@ -1134,9 +1167,9 @@ cdef extern from "hdf5.h":
# Enumerated types
hid_t H5Tenum_create(hid_t base_id) except *
herr_t H5Tenum_insert(hid_t type, char *name, void *value) except *
- herr_t H5Tenum_nameof( hid_t type, void *value, char *name, size_t size ) except *
- herr_t H5Tenum_valueof( hid_t type, char *name, void *value ) except *
- herr_t H5Tget_member_value(hid_t type, unsigned int memb_no, void *value ) except *
+ herr_t H5Tenum_nameof( hid_t type, void *value, char *name, size_t size ) except *
+ herr_t H5Tenum_valueof( hid_t type, char *name, void *value ) except *
+ herr_t H5Tget_member_value(hid_t type, unsigned int memb_no, void *value ) except *
# Array data types
hid_t H5Tarray_create(hid_t base_id, int ndims, hsize_t dims[], int perm[]) except *
@@ -1151,6 +1184,8 @@ cdef extern from "hdf5.h":
hid_t H5Tdecode(unsigned char *buf) except *
herr_t H5Tencode(hid_t obj_id, unsigned char *buf, size_t *nalloc) except *
+ herr_t H5Tcommit2(hid_t loc_id, char *name, hid_t dtype_id, hid_t lcpl_id,
+ hid_t tcpl_id, hid_t tapl_id)
# === H5Z - Filters ===========================================================
@@ -1207,7 +1242,7 @@ cdef extern from "hdf5.h":
herr_t H5Adelete(hid_t loc_id, char *name) except *
herr_t H5Aread(hid_t attr_id, hid_t mem_type_id, void *buf) except *
- herr_t H5Awrite(hid_t attr_id, hid_t mem_type_id, void *buf ) except *
+ herr_t H5Awrite(hid_t attr_id, hid_t mem_type_id, void *buf ) except *
int H5Aget_num_attrs(hid_t loc_id) except *
ssize_t H5Aget_name(hid_t attr_id, size_t buf_size, char *buf) except *
diff --git a/h5py/h5a.pyx b/h5py/h5a.pyx
index a2a6db2..f57b826 100644
--- a/h5py/h5a.pyx
+++ b/h5py/h5a.pyx
@@ -42,12 +42,12 @@ IF H5PY_18API:
SpaceID space not None, *, char* obj_name='.', PropID lapl=None):
"""(ObjectID loc, STRING name, TypeID tid, SpaceID space, **kwds) => AttrID
- Create a new attribute, attached to an existing object. Keywords:
+ Create a new attribute, attached to an existing object.
- STRING obj_name (".")
+ + STRING obj_name (".")
Attach attribute to this group member instead
- PropID lapl (None)
+ + PropID lapl
Link access property list for obj_name
"""
@@ -181,15 +181,15 @@ IF H5PY_18API:
Remove an attribute from an object. Specify exactly one of "name"
or "index". Keyword-only arguments:
- STRING obj_name (".")
+ + STRING obj_name (".")
Attribute is attached to this group member
- PropID lapl (None)
+ + PropID lapl (None)
Link access property list for obj_name
- INT index_type (h5.INDEX_NAME)
+ + INT index_type (h5.INDEX_NAME)
- INT order (h5.ITER_NATIVE)
+ + INT order (h5.ITER_NATIVE)
"""
if name != NULL and index < 0:
H5Adelete_by_name(loc.id, obj_name, name, pdefault(lapl))
@@ -254,18 +254,16 @@ IF H5PY_18API:
2. If you have the parent object, supply it and exactly one of
either name or index.
- Keyword-only arguments:
-
- STRING obj_name (".")
+ + STRING obj_name (".")
Use this group member instead
- PropID lapl (None)
+ + PropID lapl (None)
Link access property list for obj_name
- INT index_type (h5.INDEX_NAME)
+ + INT index_type (h5.INDEX_NAME)
Which index to use
- INT order (h5.ITER_NATIVE)
+ + INT order (h5.ITER_NATIVE)
What order the index is in
"""
cdef AttrInfo info = AttrInfo()
@@ -523,13 +521,14 @@ cdef class AttrID(ObjectID):
"""
return typewrap(H5Aget_type(self.id))
- @sync
- def get_storage_size(self):
- """() => INT
+ IF H5PY_18API:
+ @sync
+ def get_storage_size(self):
+ """() => INT
- Get the amount of storage required for this attribute.
- """
- return H5Aget_storage_size(self.id)
+ Get the amount of storage required for this attribute.
+ """
+ return H5Aget_storage_size(self.id)
diff --git a/h5py/h5g.pyx b/h5py/h5g.pyx
index b1d9763..c110c7b 100644
--- a/h5py/h5g.pyx
+++ b/h5py/h5g.pyx
@@ -117,36 +117,26 @@ cdef class GroupIter:
# === Basic group management ==================================================
-IF H5PY_18API:
- @sync
- def open(ObjectID loc not None, char* name, PropID gapl=None):
- """(ObjectID loc, STRING name, PropGAID gapl=None)
-
- Open an existing HDF5 group, attached to some other group.
- """
- return GroupID(H5Gopen2(loc.id, name, pdefault(gapl)))
-ELSE:
- @sync
- def open(ObjectID loc not None, char* name):
- """(ObjectID loc, STRING name) => GroupID
-
- Open an existing HDF5 group, attached to some other group.
- """
- return GroupID(H5Gopen(loc.id, name))
+ at sync
+def open(ObjectID loc not None, char* name):
+ """(ObjectID loc, STRING name) => GroupID
+ Open an existing HDF5 group, attached to some other group.
+ """
+ return GroupID(H5Gopen(loc.id, name))
IF H5PY_18API:
@sync
def create(ObjectID loc not None, char* name, PropID lcpl=None,
PropID gcpl=None, PropID gapl=None):
- """(ObjectID loc, STRING name, PropLCID lcpl=None, PropGCID gcpl=None,
- PropGAID gapl=None) => GroupID
+ """(ObjectID loc, STRING name, PropLCID lcpl=None, PropGCID gcpl=None)
+ => GroupID
Create a new group, under a given parent group.
"""
return GroupID(H5Gcreate2(loc.id, name, pdefault(lcpl),
pdefault(gcpl),
- pdefault(gapl)))
+ H5P_DEFAULT))
ELSE:
@sync
def create(ObjectID loc not None, char* name):
diff --git a/h5py/h5p.pxd b/h5py/h5p.pxd
index 44da86e..a77f5a0 100644
--- a/h5py/h5p.pxd
+++ b/h5py/h5p.pxd
@@ -18,6 +18,8 @@ include "defs.pxd"
from h5 cimport ObjectID
+# --- Base classes ---
+
cdef class PropID(ObjectID):
""" Base class for all property lists """
pass
@@ -34,22 +36,54 @@ cdef class PropInstanceID(PropID):
"""
pass
-cdef class PropDCID(PropInstanceID):
- """ Dataset creation property list """
+cdef class PropCreateID(PropInstanceID):
+ """ Base class for all object creation lists.
+
+ Also includes string character set methods.
+ """
pass
-cdef class PropDXID(PropInstanceID):
- """ Dataset transfer property list """
+cdef class PropCopyID(PropInstanceID):
+ """ Property list for copying objects (as in h5o.copy) """
+
+# --- Object creation ---
+
+cdef class PropDCID(PropCreateID):
+ """ Dataset creation property list """
pass
-cdef class PropFCID(PropInstanceID):
+cdef class PropFCID(PropCreateID):
""" File creation property list """
pass
+
+# --- Object access ---
+
cdef class PropFAID(PropInstanceID):
""" File access property list """
pass
+cdef class PropDXID(PropInstanceID):
+ """ Dataset transfer property list """
+ pass
+
+
+# --- New in 1.8 ---
+
+IF H5PY_18API:
+
+ cdef class PropLCID(PropCreateID):
+ """ Link creation property list """
+ pass
+
+ cdef class PropLAID(PropInstanceID):
+ """ Link access property list """
+ cdef char* _buf
+
+ cdef class PropGCID(PropCreateID):
+ """ Group creation property list """
+ pass
+
cdef hid_t pdefault(PropID pid)
cdef object propwrap(hid_t id_in)
diff --git a/h5py/h5p.pyx b/h5py/h5p.pyx
index 3dc7c26..10ad730 100644
--- a/h5py/h5p.pyx
+++ b/h5py/h5p.pyx
@@ -51,7 +51,19 @@ cdef object propwrap(hid_t id_in):
elif H5Pequal(clsid, H5P_DATASET_XFER):
pcls = PropDXID
else:
- raise ValueError("No class found for ID %d" % id_in)
+ IF H5PY_18API:
+ if H5Pequal(clsid, H5P_OBJECT_COPY):
+ pcls = PropCopyID
+ elif H5Pequal(clsid, H5P_LINK_CREATE):
+ pcls = PropLCID
+ elif H5Pequal(clsid, H5P_LINK_ACCESS):
+ pcls = PropLAID
+ elif H5Pequal(clsid, H5P_GROUP_CREATE):
+ pcls = PropGCID
+ else:
+ raise ValueError("No class found for ID %d" % id_in)
+ ELSE:
+ raise ValueError("No class found for ID %d" % id_in)
return pcls(id_in)
finally:
@@ -73,7 +85,12 @@ FILE_CREATE = lockcls(H5P_FILE_CREATE)
FILE_ACCESS = lockcls(H5P_FILE_ACCESS)
DATASET_CREATE = lockcls(H5P_DATASET_CREATE)
DATASET_XFER = lockcls(H5P_DATASET_XFER)
-# MOUNT renamed in 1.8.X; removed for now
+
+IF H5PY_18API:
+ OBJECT_COPY = lockcls(H5P_OBJECT_COPY)
+ LINK_CREATE = lockcls(H5P_LINK_CREATE)
+ LINK_ACCESS = lockcls(H5P_LINK_ACCESS)
+ GROUP_CREATE = lockcls(H5P_GROUP_CREATE)
DEFAULT = None # In the HDF5 header files this is actually 0, which is an
# invalid identifier. The new strategy for default options
@@ -83,20 +100,40 @@ DEFAULT = None # In the HDF5 header files this is actually 0, which is an
# === Property list functional API ============================================
- at sync
-def create(PropClassID cls not None):
- """(PropClassID cls) => PropID
-
- Create a new property list as an instance of a class; classes are:
+IF H5PY_18API:
+ @sync
+ def create(PropClassID cls not None):
+ """(PropClassID cls) => PropID
+
+ Create a new property list as an instance of a class; classes are:
+
+ - FILE_CREATE
+ - FILE_ACCESS
+ - DATASET_CREATE
+ - DATASET_XFER
+ - LINK_CREATE
+ - LINK_ACCESS
+ - GROUP_CREATE
+ - OBJECT_COPY
+ """
+ cdef hid_t newid
+ newid = H5Pcreate(cls.id)
+ return propwrap(newid)
+ELSE:
+ @sync
+ def create(PropClassID cls not None):
+ """(PropClassID cls) => PropID
+
+ Create a new property list as an instance of a class; classes are:
- - FILE_CREATE
- - FILE_ACCESS
- - DATASET_CREATE
- - DATASET_XFER
- """
- cdef hid_t newid
- newid = H5Pcreate(cls.id)
- return propwrap(newid)
+ - FILE_CREATE
+ - FILE_ACCESS
+ - DATASET_CREATE
+ - DATASET_XFER
+ """
+ cdef hid_t newid
+ newid = H5Pcreate(cls.id)
+ return propwrap(newid)
# === Class API ===============================================================
@@ -182,631 +219,87 @@ cdef class PropInstanceID(PropID):
"""
return PropClassID(H5Pget_class(self.id))
+cdef class PropCreateID(PropInstanceID):
-# === File creation ===========================================================
-
-cdef class PropFCID(PropInstanceID):
-
- """
- File creation property list.
"""
+ Generic object creation property list.
- @sync
- def get_version(self):
- """() => TUPLE version_info
-
- Determine version information of various file attributes.
- Elements are:
-
- 0. UINT Super block version number
- 1. UINT Freelist version number
- 2. UINT Symbol table version number
- 3. UINT Shared object header version number
- """
- cdef herr_t retval
- cdef unsigned int super_
- cdef unsigned int freelist
- cdef unsigned int stab
- cdef unsigned int shhdr
-
- H5Pget_version(self.id, &super_, &freelist, &stab, &shhdr)
-
- return (super_, freelist, stab, shhdr)
-
- @sync
- def set_userblock(self, hsize_t size):
- """(INT/LONG size)
-
- Set the file user block size, in bytes.
- Must be a power of 2, and at least 512.
- """
- H5Pset_userblock(self.id, size)
-
- @sync
- def get_userblock(self):
- """() => LONG size
-
- Determine the user block size, in bytes.
- """
- cdef hsize_t size
- H5Pget_userblock(self.id, &size)
- return size
-
- @sync
- def set_sizes(self, size_t addr, size_t size):
- """(UINT addr, UINT size)
-
- Set the addressing offsets and lengths for objects
- in an HDF5 file, in bytes.
- """
- H5Pset_sizes(self.id, addr, size)
-
- @sync
- def get_sizes(self):
- """() => TUPLE sizes
-
- Determine addressing offsets and lengths for objects in an
- HDF5 file, in bytes. Return value is a 2-tuple with values:
-
- 0. UINT Address offsets
- 1. UINT Lengths
- """
- cdef size_t addr
- cdef size_t size
- H5Pget_sizes(self.id, &addr, &size)
- return (addr, size)
-
- @sync
- def set_sym_k(self, unsigned int ik, unsigned int lk):
- """(INT ik, INT lk)
-
- Symbol table node settings. See the HDF5 docs for H5Pset_sym_k.
- """
- H5Pset_sym_k(self.id, ik, lk)
-
- @sync
- def get_sym_k(self):
- """() => TUPLE settings
-
- Determine symbol table node settings. See the HDF5 docs for
- H5Pget_sym_k. Return is a 2-tuple (ik, lk).
- """
- cdef unsigned int ik
- cdef unsigned int lk
- H5Pget_sym_k(self.id, &ik, &lk)
- return (ik, lk)
-
- @sync
- def set_istore_k(self, unsigned int ik):
- """(UINT ik)
-
- See hdf5 docs for H5Pset_istore_k.
- """
- H5Pset_istore_k(self.id, ik)
-
- @sync
- def get_istore_k(self):
- """() => UINT ik
-
- See HDF5 docs for H5Pget_istore_k
- """
- cdef unsigned int ik
- H5Pget_istore_k(self.id, &ik)
- return ik
-
-# === Dataset creation properties =============================================
-
-cdef class PropDCID(PropInstanceID):
-
- """
- Dataset creation property list.
+ Has no methods unless HDF5 1.8.X is available.
"""
-
- @sync
- def set_layout(self, int layout_code):
- """(INT layout_code)
-
- Set dataset storage strategy; legal values are:
-
- - h5d.COMPACT
- - h5d.CONTIGUOUS
- - h5d.CHUNKED
- """
- H5Pset_layout(self.id, layout_code)
- @sync
- def get_layout(self):
- """() => INT layout_code
-
- Determine the storage strategy of a dataset; legal values are:
-
- - h5d.COMPACT
- - h5d.CONTIGUOUS
- - h5d.CHUNKED
- """
- return <int>H5Pget_layout(self.id)
-
- @sync
- def set_chunk(self, object chunksize):
- """(TUPLE chunksize)
-
- Set the dataset chunk size. It's up to you to provide
- values which are compatible with your dataset.
- """
- cdef int rank
- cdef hsize_t* dims
- dims = NULL
-
- require_tuple(chunksize, 0, -1, "chunksize")
- rank = len(chunksize)
-
- dims = <hsize_t*>emalloc(sizeof(hsize_t)*rank)
- try:
- convert_tuple(chunksize, dims, rank)
- H5Pset_chunk(self.id, rank, dims)
- finally:
- efree(dims)
-
- @sync
- def get_chunk(self):
- """() => TUPLE chunk_dimensions
-
- Obtain the dataset chunk size, as a tuple.
- """
- cdef int rank
- cdef hsize_t *dims
-
- rank = H5Pget_chunk(self.id, 0, NULL)
- assert rank >= 0
- dims = <hsize_t*>emalloc(sizeof(hsize_t)*rank)
-
- try:
- H5Pget_chunk(self.id, rank, dims)
- tpl = convert_dims(dims, rank)
- return tpl
- finally:
- efree(dims)
-
- @sync
- def set_fill_value(self, ndarray value not None):
- """(NDARRAY value)
-
- Set the dataset fill value. The object provided should be an
- 0-dimensional NumPy array; otherwise, the value will be read from
- the first element.
- """
- cdef TypeID tid
-
- check_numpy_read(value, -1)
- tid = py_create(value.dtype)
- H5Pset_fill_value(self.id, tid.id, value.data)
-
- @sync
- def get_fill_value(self, ndarray value not None):
- """(NDARRAY value)
-
- Read the dataset fill value into a NumPy array. It will be
- converted to match the array dtype. If the array has nonzero
- rank, only the first element will contain the value.
- """
- cdef TypeID tid
-
- check_numpy_write(value, -1)
- tid = py_create(value.dtype)
- H5Pget_fill_value(self.id, tid.id, value.data)
-
- @sync
- def set_fill_time(self, int fill_time):
- """(INT fill_time)
-
- Define when fill values are written to the dataset. Legal
- values (defined in module h5d) are:
-
- - h5d.FILL_TIME_ALLOC
- - h5d.FILL_TIME_NEVER
- - h5d.FILL_TIME_IFSET
- """
- H5Pset_fill_time(self.id, <H5D_fill_time_t>fill_time)
-
- @sync
- def get_fill_time(self):
- """ () => INT
-
- Determine when fill values are written to the dataset. Legal
- values (defined in module h5d) are:
-
- - h5d.FILL_TIME_ALLOC
- - h5d.FILL_TIME_NEVER
- - h5d.FILL_TIME_IFSET
- """
- cdef H5D_fill_time_t fill_time
- H5Pget_fill_time(self.id, &fill_time)
- return <int>fill_time
-
-
- # === Filter functions ====================================================
-
- @sync
- def set_deflate(self, unsigned int level=5):
- """(UINT level=5)
-
- Enable deflate (gzip) compression, at the given level.
- Valid levels are 0-9, default is 5.
- """
- H5Pset_deflate(self.id, level)
-
- @sync
- def set_fletcher32(self):
- """()
-
- Enable Fletcher32 error correction on this list.
- """
- H5Pset_fletcher32(self.id)
-
- @sync
- def set_shuffle(self):
- """()
-
- Enable to use of the shuffle filter. Use this immediately before
- the deflate filter to increase the compression ratio.
- """
- H5Pset_shuffle(self.id)
-
- @sync
- def set_szip(self, unsigned int options, unsigned int pixels_per_block):
- """(UINT options, UINT pixels_per_block)
-
- Enable SZIP compression. See the HDF5 docs for argument meanings,
- and general restrictions on use of the SZIP format.
- """
- H5Pset_szip(self.id, options, pixels_per_block)
-
- @sync
- def get_nfilters(self):
- """() => INT
-
- Determine the number of filters in the pipeline.
- """
- return H5Pget_nfilters(self.id)
-
- @sync
- def set_filter(self, int filter_code, unsigned int flags=0, object values=None):
- """(INT filter_code, UINT flags=0, TUPLE values=None)
-
- Set a filter in the pipeline. Params are:
-
- filter_code
- One of the following:
-
- - h5z.FILTER_DEFLATE
- - h5z.FILTER_SHUFFLE
- - h5z.FILTER_FLETCHER32
- - h5z.FILTER_SZIP
-
- flags
- Bit flags (h5z.FLAG_*) setting filter properties
-
- values
- TUPLE of UINTs giving auxiliary data for the filter
- """
- cdef size_t nelements
- cdef unsigned int *cd_values
- cdef int i
- cd_values = NULL
-
- require_tuple(values, 1, -1, "values")
-
- try:
- if values is None or len(values) == 0:
- nelements = 0
- cd_values = NULL
- else:
- nelements = len(values)
- cd_values = <unsigned int*>emalloc(sizeof(unsigned int)*nelements)
-
- for i from 0<=i<nelements:
- cd_values[i] = int(values[i])
-
- H5Pset_filter(self.id, <H5Z_filter_t>filter_code, flags, nelements, cd_values)
- finally:
- efree(cd_values)
-
- @sync
- def all_filters_avail(self):
- """() => BOOL
-
- Determine if all the filters in the pipelist are available to
- the library.
- """
- return <bint>(H5Pall_filters_avail(self.id))
-
- @sync
- def get_filter(self, int filter_idx):
- """(UINT filter_idx) => TUPLE filter_info
-
- Get information about a filter, identified by its index. Tuple
- elements are:
-
- 0. INT filter code (h5z.FILTER_*)
- 1. UINT flags (h5z.FLAG_*)
- 2. TUPLE of UINT values; filter aux data (16 values max)
- 3. STRING name of filter (256 chars max)
- """
- cdef list vlist
- cdef int filter_code
- cdef unsigned int flags
- cdef size_t nelements
- cdef unsigned int cd_values[16]
- cdef char name[257]
- cdef int i
- nelements = 16 # HDF5 library actually complains if this is too big.
-
- if filter_idx < 0:
- raise ValueError("Filter index must be a non-negative integer")
-
- filter_code = <int>H5Pget_filter(self.id, filter_idx, &flags,
- &nelements, cd_values, 256, name)
- name[256] = c'\0' # in case it's > 256 chars
-
- vlist = []
- for i from 0<=i<nelements:
- vlist.append(cd_values[i])
-
- return (filter_code, flags, tuple(vlist), name)
-
- @sync
- def _has_filter(self, int filter_code):
- """(INT filter_code)
-
- Slow & stupid method to determine if a filter is used in this
- property list. Used because the HDF5 function H5Pget_filter_by_id
- is broken.
- """
- cdef int nfilters
- nfilters = self.get_nfilters()
- for i from 0<=i<nfilters:
- if self.get_filter(i)[0] == filter_code:
- return True
- return False
-
- @sync
- def get_filter_by_id(self, int filter_code):
- """(INT filter_code) => TUPLE filter_info or None
-
- Get information about a filter, identified by its code (one
- of h5z.FILTER_*). If the filter doesn't exist, returns None.
- Tuple elements are:
-
- 0. UINT flags (h5z.FLAG_*)
- 1. TUPLE of UINT values; filter aux data (16 values max)
- 2. STRING name of filter (256 chars max)
- """
- cdef list vlist
- cdef unsigned int flags
- cdef size_t nelements
- cdef unsigned int cd_values[16]
- cdef char name[257]
- cdef herr_t retval
- cdef int i
- nelements = 16 # HDF5 library actually complains if this is too big.
-
- if not self._has_filter(filter_code):
- # Avoid library segfault
- return None
-
- retval = H5Pget_filter_by_id(self.id, <H5Z_filter_t>filter_code,
- &flags, &nelements, cd_values, 256, name)
- assert nelements <= 16
-
- name[256] = c'\0' # In case HDF5 doesn't terminate it properly
+ IF H5PY_18API:
+ pass
- vlist = []
- for i from 0<=i<nelements:
- vlist.append(cd_values[i])
-
- return (flags, tuple(vlist), name)
-
- @sync
- def remove_filter(self, int filter_class):
- """(INT filter_class)
-
- Remove a filter from the pipeline. The class code is one of
- h5z.FILTER_*.
- """
- H5Premove_filter(self.id, <H5Z_filter_t>filter_class)
-
- @sync
- def fill_value_defined(self):
- """() => INT fill_status
-
- Determine the status of the dataset fill value. Return values are:
-
- - h5d.FILL_VALUE_UNDEFINED
- - h5d.FILL_VALUE_DEFAULT
- - h5d.FILL_VALUE_USER_DEFINED
- """
- cdef H5D_fill_value_t val
- H5Pfill_value_defined(self.id, &val)
- return <int>val
-
-
-# === File access =============================================================
-
-cdef class PropFAID(PropInstanceID):
+cdef class PropCopyID(PropInstanceID):
"""
- File access property list
- """
-
- @sync
- def set_fclose_degree(self, int close_degree):
- """(INT close_degree)
-
- Set the file-close degree, which determines library behavior when
- a file is closed when objects are still open. Legal values:
-
- * h5f.CLOSE_WEAK
- * h5f.CLOSE_SEMI
- * h5f.CLOSE_STRONG
- * h5f.CLOSE_DEFAULT
- """
- H5Pset_fclose_degree(self.id, <H5F_close_degree_t>close_degree)
-
- @sync
- def get_fclose_degree(self):
- """() => INT close_degree
- - h5fd.
- Get the file-close degree, which determines library behavior when
- a file is closed when objects are still open. Legal values:
-
- * h5f.CLOSE_WEAK
- * h5f.CLOSE_SEMI
- * h5f.CLOSE_STRONG
- * h5f.CLOSE_DEFAULT
- """
- cdef H5F_close_degree_t deg
- H5Pget_fclose_degree(self.id, °)
- return deg
-
- @sync
- def set_fapl_core(self, size_t increment=1024*1024, hbool_t backing_store=0):
- """(UINT increment=1M, BOOL backing_store=False)
-
- Use the h5fd.CORE (memory-resident) file driver.
-
- increment
- Chunk size for new memory requests (default 1 meg)
+ Generic object copy property list
- backing_store
- If True, write the memory contents to disk when
- the file is closed.
- """
- H5Pset_fapl_core(self.id, increment, backing_store)
+ Has no methods unless HDF5 1.8.X is available
+ """
- @sync
- def get_fapl_core(self):
- """() => TUPLE core_settings
+ IF H5PY_18API:
- Determine settings for the h5fd.CORE (memory-resident) file driver.
- Tuple elements are:
+ @sync
+ def set_copy_object(self, unsigned int flags):
+ """(UINT flags)
- 0. UINT "increment": Chunk size for new memory requests
- 1. BOOL "backing_store": If True, write the memory contents to
- disk when the file is closed.
- """
- cdef size_t increment
- cdef hbool_t backing_store
- H5Pget_fapl_core(self.id, &increment, &backing_store)
- return (increment, <bint>(backing_store))
+ Set flags for object copying process. Legal flags are
+ from the h5o.COPY_* family:
- @sync
- def set_fapl_family(self, hsize_t memb_size, PropID memb_fapl=None):
- """(UINT memb_size, PropFAID memb_fapl=None)
+ h5o.COPY_SHALLOW_HIERARCHY_FLAG
+ Copy only immediate members of a group.
- Set up the family driver.
+ h5o.COPY_EXPAND_SOFT_LINK_FLAG
+ Expand soft links into new objects.
- memb_size
- Member file size
+ h5o.COPY_EXPAND_EXT_LINK_FLAG
+ Expand external link into new objects.
- memb_fapl
- File access property list for each member access
- """
- cdef hid_t plist_id
- plist_id = pdefault(memb_fapl)
- H5Pset_fapl_family(self.id, memb_size, plist_id)
+ h5o.COPY_EXPAND_REFERENCE_FLAG
+ Copy objects that are pointed to by references.
- @sync
- def get_fapl_family(self):
- """() => TUPLE info
+ h5o.COPY_WITHOUT_ATTR_FLAG
+ Copy object without copying attributes.
+ """
+ H5Pset_copy_object(self.id, flags)
- Determine family driver settings. Tuple values are:
+ @sync
+ def get_copy_object(self):
+ """() => UINT flags
- 0. UINT memb_size
- 1. PropFAID memb_fapl or None
- """
- cdef hid_t mfapl_id
- cdef hsize_t msize
- cdef PropFAID plist
- plist = None
+ Get copy process flags. Legal flags are h5o.COPY_*.
+ """
+ cdef unsigned int flags
+ H5Pget_copy_object(self.id, &flags)
+ return flags
- H5Pget_fapl_family(self.id, &msize, &mfapl_id)
- if mfapl_id > 0:
- plist = PropFAID(mfapl_id)
+# === Concrete list implementations ===========================================
- return (msize, plist)
+# File creation
+include "h5p_fcid.pxi"
- @sync
- def set_fapl_log(self, char* logfile, unsigned int flags, size_t buf_size):
- """(STRING logfile, UINT flags, UINT buf_size)
+# Dataset creation
+include "h5p_dcid.pxi"
- Enable the use of the logging driver. See the HDF5 documentation
- for details. Flag constants are stored in module h5fd.
- """
- H5Pset_fapl_log(self.id, logfile, flags, buf_size)
+# File access
+include "h5p_faid.pxi"
- @sync
- def set_fapl_sec2(self):
- """()
+IF H5PY_18API:
- Select the "section-2" driver (h5fd.SEC2).
- """
- H5Pset_fapl_sec2(self.id)
+ # Link creation
+ include "h5p_lcid.pxi"
- @sync
- def set_fapl_stdio(self):
- """()
-
- Select the "stdio" driver (h5fd.STDIO)
- """
- H5Pset_fapl_stdio(self.id)
-
- @sync
- def get_driver(self):
- """() => INT driver code
-
- Return an integer identifier for the driver used by this list.
- Although HDF5 implements these as full-fledged objects, they are
- treated as integers by Python. Built-in drivers identifiers are
- listed in module h5fd; they are:
-
- - h5fd.CORE
- - h5fd.FAMILY
- - h5fd.LOG
- - h5fd.MPIO
- - h5fd.MULTI
- - h5fd.SEC2
- - h5fd.STDIO
- """
- return H5Pget_driver(self.id)
-
- @sync
- def set_cache(self, int mdc, int rdcc, size_t rdcc_nbytes, double rdcc_w0):
- """(INT mdc, INT rdcc, UINT rdcc_nbytes, DOUBLE rdcc_w0)
+ # Link access
+ include "h5p_laid.pxi"
- Set the metadata (mdc) and raw data chunk (rdcc) cache properties.
- See the HDF5 docs for a full explanation.
- """
- H5Pset_cache(self.id, mdc, rdcc, rdcc_nbytes, rdcc_w0)
+ # Group creation
+ include "h5p_gcid.pxi"
- @sync
- def get_cache(self):
- """() => TUPLE cache info
- Get the metadata and raw data chunk cache settings. See the HDF5
- docs for element definitions. Return is a 4-tuple with entries:
- 1. INT mdc: Number of metadata objects
- 2. INT rdcc: Number of raw data chunks
- 3. UINT rdcc_nbytes: Size of raw data cache
- 4. DOUBLE rdcc_w0: Preemption policy for data cache.
- """
- cdef int mdc, rdcc
- cdef size_t rdcc_nbytes
- cdef double w0
- H5Pget_cache(self.id, &mdc, &rdcc, &rdcc_nbytes, &w0)
- return (mdc, rdcc, rdcc_nbytes, w0)
diff --git a/h5py/h5p_dcid.pxi b/h5py/h5p_dcid.pxi
new file mode 100644
index 0000000..1255ea8
--- /dev/null
+++ b/h5py/h5p_dcid.pxi
@@ -0,0 +1,345 @@
+#+
+#
+# This file is part of h5py, a low-level Python interface to the HDF5 library.
+#
+# Copyright (C) 2008 Andrew Collette
+# http://h5py.alfven.org
+# License: BSD (See LICENSE.txt for full license)
+#
+# $Date$
+#
+#-
+
+cdef class PropDCID(PropCreateID):
+
+ """
+ Dataset creation property list.
+ """
+
+ @sync
+ def set_layout(self, int layout_code):
+ """(INT layout_code)
+
+ Set dataset storage strategy; legal values are:
+
+ - h5d.COMPACT
+ - h5d.CONTIGUOUS
+ - h5d.CHUNKED
+ """
+ H5Pset_layout(self.id, layout_code)
+
+ @sync
+ def get_layout(self):
+ """() => INT layout_code
+
+ Determine the storage strategy of a dataset; legal values are:
+
+ - h5d.COMPACT
+ - h5d.CONTIGUOUS
+ - h5d.CHUNKED
+ """
+ return <int>H5Pget_layout(self.id)
+
+ @sync
+ def set_chunk(self, object chunksize):
+ """(TUPLE chunksize)
+
+ Set the dataset chunk size. It's up to you to provide
+ values which are compatible with your dataset.
+ """
+ cdef int rank
+ cdef hsize_t* dims
+ dims = NULL
+
+ require_tuple(chunksize, 0, -1, "chunksize")
+ rank = len(chunksize)
+
+ dims = <hsize_t*>emalloc(sizeof(hsize_t)*rank)
+ try:
+ convert_tuple(chunksize, dims, rank)
+ H5Pset_chunk(self.id, rank, dims)
+ finally:
+ efree(dims)
+
+ @sync
+ def get_chunk(self):
+ """() => TUPLE chunk_dimensions
+
+ Obtain the dataset chunk size, as a tuple.
+ """
+ cdef int rank
+ cdef hsize_t *dims
+
+ rank = H5Pget_chunk(self.id, 0, NULL)
+ assert rank >= 0
+ dims = <hsize_t*>emalloc(sizeof(hsize_t)*rank)
+
+ try:
+ H5Pget_chunk(self.id, rank, dims)
+ tpl = convert_dims(dims, rank)
+ return tpl
+ finally:
+ efree(dims)
+
+ @sync
+ def set_fill_value(self, ndarray value not None):
+ """(NDARRAY value)
+
+ Set the dataset fill value. The object provided should be an
+ 0-dimensional NumPy array; otherwise, the value will be read from
+ the first element.
+ """
+ cdef TypeID tid
+
+ check_numpy_read(value, -1)
+ tid = py_create(value.dtype)
+ H5Pset_fill_value(self.id, tid.id, value.data)
+
+ @sync
+ def get_fill_value(self, ndarray value not None):
+ """(NDARRAY value)
+
+ Read the dataset fill value into a NumPy array. It will be
+ converted to match the array dtype. If the array has nonzero
+ rank, only the first element will contain the value.
+ """
+ cdef TypeID tid
+
+ check_numpy_write(value, -1)
+ tid = py_create(value.dtype)
+ H5Pget_fill_value(self.id, tid.id, value.data)
+
+ @sync
+ def set_fill_time(self, int fill_time):
+ """(INT fill_time)
+
+ Define when fill values are written to the dataset. Legal
+ values (defined in module h5d) are:
+
+ - h5d.FILL_TIME_ALLOC
+ - h5d.FILL_TIME_NEVER
+ - h5d.FILL_TIME_IFSET
+ """
+ H5Pset_fill_time(self.id, <H5D_fill_time_t>fill_time)
+
+ @sync
+ def get_fill_time(self):
+ """ () => INT
+
+ Determine when fill values are written to the dataset. Legal
+ values (defined in module h5d) are:
+
+ - h5d.FILL_TIME_ALLOC
+ - h5d.FILL_TIME_NEVER
+ - h5d.FILL_TIME_IFSET
+ """
+ cdef H5D_fill_time_t fill_time
+ H5Pget_fill_time(self.id, &fill_time)
+ return <int>fill_time
+
+
+ # === Filter functions ====================================================
+
+ @sync
+ def set_deflate(self, unsigned int level=5):
+ """(UINT level=5)
+
+ Enable deflate (gzip) compression, at the given level.
+ Valid levels are 0-9, default is 5.
+ """
+ H5Pset_deflate(self.id, level)
+
+ @sync
+ def set_fletcher32(self):
+ """()
+
+ Enable Fletcher32 error correction on this list.
+ """
+ H5Pset_fletcher32(self.id)
+
+ @sync
+ def set_shuffle(self):
+ """()
+
+ Enable to use of the shuffle filter. Use this immediately before
+ the deflate filter to increase the compression ratio.
+ """
+ H5Pset_shuffle(self.id)
+
+ @sync
+ def set_szip(self, unsigned int options, unsigned int pixels_per_block):
+ """(UINT options, UINT pixels_per_block)
+
+ Enable SZIP compression. See the HDF5 docs for argument meanings,
+ and general restrictions on use of the SZIP format.
+ """
+ H5Pset_szip(self.id, options, pixels_per_block)
+
+ @sync
+ def get_nfilters(self):
+ """() => INT
+
+ Determine the number of filters in the pipeline.
+ """
+ return H5Pget_nfilters(self.id)
+
+ @sync
+ def set_filter(self, int filter_code, unsigned int flags=0, object values=None):
+ """(INT filter_code, UINT flags=0, TUPLE values=None)
+
+ Set a filter in the pipeline. Params are:
+
+ filter_code
+ One of the following:
+
+ - h5z.FILTER_DEFLATE
+ - h5z.FILTER_SHUFFLE
+ - h5z.FILTER_FLETCHER32
+ - h5z.FILTER_SZIP
+
+ flags
+ Bit flags (h5z.FLAG_*) setting filter properties
+
+ values
+ TUPLE of UINTs giving auxiliary data for the filter
+ """
+ cdef size_t nelements
+ cdef unsigned int *cd_values
+ cdef int i
+ cd_values = NULL
+
+ require_tuple(values, 1, -1, "values")
+
+ try:
+ if values is None or len(values) == 0:
+ nelements = 0
+ cd_values = NULL
+ else:
+ nelements = len(values)
+ cd_values = <unsigned int*>emalloc(sizeof(unsigned int)*nelements)
+
+ for i from 0<=i<nelements:
+ cd_values[i] = int(values[i])
+
+ H5Pset_filter(self.id, <H5Z_filter_t>filter_code, flags, nelements, cd_values)
+ finally:
+ efree(cd_values)
+
+ @sync
+ def all_filters_avail(self):
+ """() => BOOL
+
+ Determine if all the filters in the pipelist are available to
+ the library.
+ """
+ return <bint>(H5Pall_filters_avail(self.id))
+
+ @sync
+ def get_filter(self, int filter_idx):
+ """(UINT filter_idx) => TUPLE filter_info
+
+ Get information about a filter, identified by its index. Tuple
+ elements are:
+
+ 0. INT filter code (h5z.FILTER_*)
+ 1. UINT flags (h5z.FLAG_*)
+ 2. TUPLE of UINT values; filter aux data (16 values max)
+ 3. STRING name of filter (256 chars max)
+ """
+ cdef list vlist
+ cdef int filter_code
+ cdef unsigned int flags
+ cdef size_t nelements
+ cdef unsigned int cd_values[16]
+ cdef char name[257]
+ cdef int i
+ nelements = 16 # HDF5 library actually complains if this is too big.
+
+ if filter_idx < 0:
+ raise ValueError("Filter index must be a non-negative integer")
+
+ filter_code = <int>H5Pget_filter(self.id, filter_idx, &flags,
+ &nelements, cd_values, 256, name)
+ name[256] = c'\0' # in case it's > 256 chars
+
+ vlist = []
+ for i from 0<=i<nelements:
+ vlist.append(cd_values[i])
+
+ return (filter_code, flags, tuple(vlist), name)
+
+ @sync
+ def _has_filter(self, int filter_code):
+ """(INT filter_code)
+
+ Slow & stupid method to determine if a filter is used in this
+ property list. Used because the HDF5 function H5Pget_filter_by_id
+ is broken.
+ """
+ cdef int nfilters
+ nfilters = self.get_nfilters()
+ for i from 0<=i<nfilters:
+ if self.get_filter(i)[0] == filter_code:
+ return True
+ return False
+
+ @sync
+ def get_filter_by_id(self, int filter_code):
+ """(INT filter_code) => TUPLE filter_info or None
+
+ Get information about a filter, identified by its code (one
+ of h5z.FILTER_*). If the filter doesn't exist, returns None.
+ Tuple elements are:
+
+ 0. UINT flags (h5z.FLAG_*)
+ 1. TUPLE of UINT values; filter aux data (16 values max)
+ 2. STRING name of filter (256 chars max)
+ """
+ cdef list vlist
+ cdef unsigned int flags
+ cdef size_t nelements
+ cdef unsigned int cd_values[16]
+ cdef char name[257]
+ cdef herr_t retval
+ cdef int i
+ nelements = 16 # HDF5 library actually complains if this is too big.
+
+ if not self._has_filter(filter_code):
+ # Avoid library segfault
+ return None
+
+ retval = H5Pget_filter_by_id(self.id, <H5Z_filter_t>filter_code,
+ &flags, &nelements, cd_values, 256, name)
+ assert nelements <= 16
+
+ name[256] = c'\0' # In case HDF5 doesn't terminate it properly
+
+ vlist = []
+ for i from 0<=i<nelements:
+ vlist.append(cd_values[i])
+
+ return (flags, tuple(vlist), name)
+
+ @sync
+ def remove_filter(self, int filter_class):
+ """(INT filter_class)
+
+ Remove a filter from the pipeline. The class code is one of
+ h5z.FILTER_*.
+ """
+ H5Premove_filter(self.id, <H5Z_filter_t>filter_class)
+
+ @sync
+ def fill_value_defined(self):
+ """() => INT fill_status
+
+ Determine the status of the dataset fill value. Return values are:
+
+ - h5d.FILL_VALUE_UNDEFINED
+ - h5d.FILL_VALUE_DEFAULT
+ - h5d.FILL_VALUE_USER_DEFINED
+ """
+ cdef H5D_fill_value_t val
+ H5Pfill_value_defined(self.id, &val)
+ return <int>val
+
diff --git a/h5py/h5p_faid.pxi b/h5py/h5p_faid.pxi
new file mode 100644
index 0000000..f07552d
--- /dev/null
+++ b/h5py/h5p_faid.pxi
@@ -0,0 +1,189 @@
+#+
+#
+# This file is part of h5py, a low-level Python interface to the HDF5 library.
+#
+# Copyright (C) 2008 Andrew Collette
+# http://h5py.alfven.org
+# License: BSD (See LICENSE.txt for full license)
+#
+# $Date$
+#
+#-
+
+cdef class PropFAID(PropInstanceID):
+
+ """
+ File access property list
+ """
+
+ @sync
+ def set_fclose_degree(self, int close_degree):
+ """(INT close_degree)
+
+ Set the file-close degree, which determines library behavior when
+ a file is closed when objects are still open. Legal values:
+
+ * h5f.CLOSE_WEAK
+ * h5f.CLOSE_SEMI
+ * h5f.CLOSE_STRONG
+ * h5f.CLOSE_DEFAULT
+ """
+ H5Pset_fclose_degree(self.id, <H5F_close_degree_t>close_degree)
+
+ @sync
+ def get_fclose_degree(self):
+ """() => INT close_degree
+ - h5fd.
+ Get the file-close degree, which determines library behavior when
+ a file is closed when objects are still open. Legal values:
+
+ * h5f.CLOSE_WEAK
+ * h5f.CLOSE_SEMI
+ * h5f.CLOSE_STRONG
+ * h5f.CLOSE_DEFAULT
+ """
+ cdef H5F_close_degree_t deg
+ H5Pget_fclose_degree(self.id, °)
+ return deg
+
+ @sync
+ def set_fapl_core(self, size_t increment=1024*1024, hbool_t backing_store=0):
+ """(UINT increment=1M, BOOL backing_store=False)
+
+ Use the h5fd.CORE (memory-resident) file driver.
+
+ increment
+ Chunk size for new memory requests (default 1 meg)
+
+ backing_store
+ If True, write the memory contents to disk when
+ the file is closed.
+ """
+ H5Pset_fapl_core(self.id, increment, backing_store)
+
+ @sync
+ def get_fapl_core(self):
+ """() => TUPLE core_settings
+
+ Determine settings for the h5fd.CORE (memory-resident) file driver.
+ Tuple elements are:
+
+ 0. UINT "increment": Chunk size for new memory requests
+ 1. BOOL "backing_store": If True, write the memory contents to
+ disk when the file is closed.
+ """
+ cdef size_t increment
+ cdef hbool_t backing_store
+ H5Pget_fapl_core(self.id, &increment, &backing_store)
+ return (increment, <bint>(backing_store))
+
+ @sync
+ def set_fapl_family(self, hsize_t memb_size, PropID memb_fapl=None):
+ """(UINT memb_size, PropFAID memb_fapl=None)
+
+ Set up the family driver.
+
+ memb_size
+ Member file size
+
+ memb_fapl
+ File access property list for each member access
+ """
+ cdef hid_t plist_id
+ plist_id = pdefault(memb_fapl)
+ H5Pset_fapl_family(self.id, memb_size, plist_id)
+
+ @sync
+ def get_fapl_family(self):
+ """() => TUPLE info
+
+ Determine family driver settings. Tuple values are:
+
+ 0. UINT memb_size
+ 1. PropFAID memb_fapl or None
+ """
+ cdef hid_t mfapl_id
+ cdef hsize_t msize
+ cdef PropFAID plist
+ plist = None
+
+ H5Pget_fapl_family(self.id, &msize, &mfapl_id)
+
+ if mfapl_id > 0:
+ plist = PropFAID(mfapl_id)
+
+ return (msize, plist)
+
+ @sync
+ def set_fapl_log(self, char* logfile, unsigned int flags, size_t buf_size):
+ """(STRING logfile, UINT flags, UINT buf_size)
+
+ Enable the use of the logging driver. See the HDF5 documentation
+ for details. Flag constants are stored in module h5fd.
+ """
+ H5Pset_fapl_log(self.id, logfile, flags, buf_size)
+
+ @sync
+ def set_fapl_sec2(self):
+ """()
+
+ Select the "section-2" driver (h5fd.SEC2).
+ """
+ H5Pset_fapl_sec2(self.id)
+
+ @sync
+ def set_fapl_stdio(self):
+ """()
+
+ Select the "stdio" driver (h5fd.STDIO)
+ """
+ H5Pset_fapl_stdio(self.id)
+
+ @sync
+ def get_driver(self):
+ """() => INT driver code
+
+ Return an integer identifier for the driver used by this list.
+ Although HDF5 implements these as full-fledged objects, they are
+ treated as integers by Python. Built-in drivers identifiers are
+ listed in module h5fd; they are:
+
+ - h5fd.CORE
+ - h5fd.FAMILY
+ - h5fd.LOG
+ - h5fd.MPIO
+ - h5fd.MULTI
+ - h5fd.SEC2
+ - h5fd.STDIO
+ """
+ return H5Pget_driver(self.id)
+
+ @sync
+ def set_cache(self, int mdc, int rdcc, size_t rdcc_nbytes, double rdcc_w0):
+ """(INT mdc, INT rdcc, UINT rdcc_nbytes, DOUBLE rdcc_w0)
+
+ Set the metadata (mdc) and raw data chunk (rdcc) cache properties.
+ See the HDF5 docs for a full explanation.
+ """
+ H5Pset_cache(self.id, mdc, rdcc, rdcc_nbytes, rdcc_w0)
+
+ @sync
+ def get_cache(self):
+ """() => TUPLE cache info
+
+ Get the metadata and raw data chunk cache settings. See the HDF5
+ docs for element definitions. Return is a 4-tuple with entries:
+
+ 1. INT mdc: Number of metadata objects
+ 2. INT rdcc: Number of raw data chunks
+ 3. UINT rdcc_nbytes: Size of raw data cache
+ 4. DOUBLE rdcc_w0: Preemption policy for data cache.
+ """
+ cdef int mdc, rdcc
+ cdef size_t rdcc_nbytes
+ cdef double w0
+
+ H5Pget_cache(self.id, &mdc, &rdcc, &rdcc_nbytes, &w0)
+ return (mdc, rdcc, rdcc_nbytes, w0)
+
+
diff --git a/h5py/h5p_fcid.pxi b/h5py/h5p_fcid.pxi
new file mode 100644
index 0000000..0a7df58
--- /dev/null
+++ b/h5py/h5p_fcid.pxi
@@ -0,0 +1,121 @@
+#+
+#
+# This file is part of h5py, a low-level Python interface to the HDF5 library.
+#
+# Copyright (C) 2008 Andrew Collette
+# http://h5py.alfven.org
+# License: BSD (See LICENSE.txt for full license)
+#
+# $Date$
+#
+#-
+
+cdef class PropFCID(PropCreateID):
+
+ """
+ File creation property list.
+ """
+
+ @sync
+ def get_version(self):
+ """() => TUPLE version_info
+
+ Determine version information of various file attributes.
+ Elements are:
+
+ 0. UINT Super block version number
+ 1. UINT Freelist version number
+ 2. UINT Symbol table version number
+ 3. UINT Shared object header version number
+ """
+ cdef herr_t retval
+ cdef unsigned int super_
+ cdef unsigned int freelist
+ cdef unsigned int stab
+ cdef unsigned int shhdr
+
+ H5Pget_version(self.id, &super_, &freelist, &stab, &shhdr)
+
+ return (super_, freelist, stab, shhdr)
+
+ @sync
+ def set_userblock(self, hsize_t size):
+ """(INT/LONG size)
+
+ Set the file user block size, in bytes.
+ Must be a power of 2, and at least 512.
+ """
+ H5Pset_userblock(self.id, size)
+
+ @sync
+ def get_userblock(self):
+ """() => LONG size
+
+ Determine the user block size, in bytes.
+ """
+ cdef hsize_t size
+ H5Pget_userblock(self.id, &size)
+ return size
+
+ @sync
+ def set_sizes(self, size_t addr, size_t size):
+ """(UINT addr, UINT size)
+
+ Set the addressing offsets and lengths for objects
+ in an HDF5 file, in bytes.
+ """
+ H5Pset_sizes(self.id, addr, size)
+
+ @sync
+ def get_sizes(self):
+ """() => TUPLE sizes
+
+ Determine addressing offsets and lengths for objects in an
+ HDF5 file, in bytes. Return value is a 2-tuple with values:
+
+ 0. UINT Address offsets
+ 1. UINT Lengths
+ """
+ cdef size_t addr
+ cdef size_t size
+ H5Pget_sizes(self.id, &addr, &size)
+ return (addr, size)
+
+ @sync
+ def set_sym_k(self, unsigned int ik, unsigned int lk):
+ """(INT ik, INT lk)
+
+ Symbol table node settings. See the HDF5 docs for H5Pset_sym_k.
+ """
+ H5Pset_sym_k(self.id, ik, lk)
+
+ @sync
+ def get_sym_k(self):
+ """() => TUPLE settings
+
+ Determine symbol table node settings. See the HDF5 docs for
+ H5Pget_sym_k. Return is a 2-tuple (ik, lk).
+ """
+ cdef unsigned int ik
+ cdef unsigned int lk
+ H5Pget_sym_k(self.id, &ik, &lk)
+ return (ik, lk)
+
+ @sync
+ def set_istore_k(self, unsigned int ik):
+ """(UINT ik)
+
+ See hdf5 docs for H5Pset_istore_k.
+ """
+ H5Pset_istore_k(self.id, ik)
+
+ @sync
+ def get_istore_k(self):
+ """() => UINT ik
+
+ See HDF5 docs for H5Pget_istore_k
+ """
+ cdef unsigned int ik
+ H5Pget_istore_k(self.id, &ik)
+ return ik
+
diff --git a/h5py/h5p_gcid.pxi b/h5py/h5p_gcid.pxi
new file mode 100644
index 0000000..caff108
--- /dev/null
+++ b/h5py/h5p_gcid.pxi
@@ -0,0 +1,17 @@
+#+
+#
+# This file is part of h5py, a low-level Python interface to the HDF5 library.
+#
+# Copyright (C) 2008 Andrew Collette
+# http://h5py.alfven.org
+# License: BSD (See LICENSE.txt for full license)
+#
+# $Date$
+#
+#-
+
+cdef class PropGCID(PropCreateID):
+
+ """ Group creation property list """
+ pass
+
diff --git a/h5py/h5p_laid.pxi b/h5py/h5p_laid.pxi
new file mode 100644
index 0000000..8cbee69
--- /dev/null
+++ b/h5py/h5p_laid.pxi
@@ -0,0 +1,75 @@
+#+
+#
+# This file is part of h5py, a low-level Python interface to the HDF5 library.
+#
+# Copyright (C) 2008 Andrew Collette
+# http://h5py.alfven.org
+# License: BSD (See LICENSE.txt for full license)
+#
+# $Date$
+#
+#-
+
+cdef class PropLAID(PropInstanceID):
+
+ """ Link access property list """
+
+ def __cinit__(self, *args):
+ self._buf = NULL
+
+ def __dealloc__(self):
+ efree(self._buf)
+
+ @sync
+ def set_nlinks(self, size_t nlinks):
+ """(UINT nlinks)
+
+ Set the maximum traversal depth for soft links
+ """
+ H5Pset_nlinks(self.id, nlinks)
+
+ @sync
+ def get_nlinks(self):
+ """() => UINT
+
+ Get the maximum traversal depth for soft links
+ """
+ cdef size_t nlinks
+ H5Pget_nlinks(self.id, &nlinks)
+ return nlinks
+
+ @sync
+ def set_elink_prefix(self, char* prefix):
+ """(STRING prefix)
+
+ Set the external link prefix.
+ """
+ cdef size_t size
+
+ # HDF5 requires that we hang on to this buffer
+ efree(self._buf)
+ size = strlen(prefix)
+ self._buf = <char*>emalloc(size+1)
+ strcpy(self._buf, prefix)
+
+ H5Pset_elink_prefix(self.id, self._buf)
+
+ @sync
+ def get_elink_prefix(self):
+ """() => STRING prefix
+
+ Get the external link prefix
+ """
+ cdef char* buf = NULL
+ cdef ssize_t size
+
+ size = H5Pget_elink_prefix(self.id, NULL, 0)
+ buf = <char*>emalloc(size+1)
+ try:
+ H5Pget_elink_prefix(self.id, buf, size+1)
+ pstr = buf
+ finally:
+ efree(buf)
+
+ return pstr
+
diff --git a/h5py/h5p_lcid.pxi b/h5py/h5p_lcid.pxi
new file mode 100644
index 0000000..c9150d9
--- /dev/null
+++ b/h5py/h5p_lcid.pxi
@@ -0,0 +1,19 @@
+#+
+#
+# This file is part of h5py, a low-level Python interface to the HDF5 library.
+#
+# Copyright (C) 2008 Andrew Collette
+# http://h5py.alfven.org
+# License: BSD (See LICENSE.txt for full license)
+#
+# $Date$
+#
+#-
+
+cdef class PropLCID(PropCreateID):
+
+ """ Link creation property list """
+
+ pass
+
+
diff --git a/setup.py b/setup.py
index 84c8e47..5212d98 100644
--- a/setup.py
+++ b/setup.py
@@ -207,7 +207,7 @@ class cybuild(build):
if self.api not in (16,18):
raise Exception
except Exception:
- fatal('Illegal option %s to --api= (legal values are %s)' % (self.api, ','.join(str(x) for x in KNOWN_API)))
+ fatal('Illegal option %s to --api= (legal values are 16,18)' % self.api)
def run(self):
@@ -220,10 +220,11 @@ class cybuild(build):
print "=> Creating new build configuration"
# Try to guess the installed HDF5 version
- self.api = self.get_hdf5_version()
if self.api is None:
- warn("Can't determine HDF5 version, assuming 1.6 (use --api= to override)")
- self.api = 16
+ self.api = self.get_hdf5_version()
+ if self.api is None:
+ warn("Can't determine HDF5 version, assuming 1.6 (use --api= to override)")
+ self.api = 16
modules = MODULES[self.api]
creator = ExtensionCreator(self.hdf5)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/h5py.git
More information about the debian-science-commits
mailing list