Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add deflate, add other function calls from the api, fix tag naming #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

add deflate, add other function calls from the api, fix tag naming #2

wants to merge 2 commits into from

Conversation

ghost
Copy link

@ghost ghost commented May 31, 2017

I added some api calls relevant to creating compressed data sets. I also fixed the field name so it is extracted from the relevant part of the tag, rather than getting set to the full tag string.

Copy link
Member

@kortschak kortschak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to have some tests added.

h5d.go Outdated
@@ -177,11 +177,71 @@ func (s *Dataset) OpenAttribute(name string) (*Attribute, error) {
return openAttribute(s.id, name)
}

//H5_DLL hid_t H5Dget_space(hid_t dset_id);
func (s *Dataset) H5Dget_space() (*Dataspace, error) {
dspace_id := (C.H5Dget_space(s.id))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like there are residual conversion parens. Can you clean these up please.

@@ -177,11 +177,71 @@ func (s *Dataset) OpenAttribute(name string) (*Attribute, error) {
return openAttribute(s.id, name)
}

//H5_DLL hid_t H5Dget_space(hid_t dset_id);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are these comments for?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is the prototype of the function being mapped, from the c header.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, that's what it is, but why is it here? There should be user-facing documentation (possibly, but by no means guaranteed including such a line) - think about how godoc renders this.

@@ -261,6 +261,7 @@ var (

//
var h5t_VARIABLE int64 = C.H5T_VARIABLE
var H5S_UNLIMITED int64 = C.H5S_UNLIMITED
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lead with lower case please.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It needs to be exported. For instance, is passed to hdf5.CreateSimpleDataspace() to create an unlimited dataspace.

@@ -177,11 +177,69 @@ func (s *Dataset) OpenAttribute(name string) (*Attribute, error) {
return openAttribute(s.id, name)
}

//H5_DLL hid_t H5Dget_space(hid_t dset_id);
func (s *Dataset) H5Dget_space() (*Dataspace, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to namespace with H5D: it's already a method of Dataset.

func (s *Dataset) Datatype() (*Datatype, error) {
dtype_id := C.H5Dget_type(s.id)
if dtype_id < 0 {
return nil, fmt.Errorf("couldn't open Datatype from Dataset %q", s.Name())
}
return NewDatatype(dtype_id), nil
}

//H5_DLL hid_t H5Dget_create_plist(hid_t dset_id);
func (s *Dataset) H5Dget_create_plist() (C.hid_t, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto: no need to namespace with H5D.

}

//H5_DLL hid_t H5Dget_access_plist(hid_t dset_id);
func (s *Dataset) H5Dget_access_plist() (C.hid_t, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto: no need to namespace with H5D.

}

//H5_DLL hsize_t H5Dget_storage_size(hid_t dset_id);
func (s *Dataset) H5Dget_storage_size() (C.hsize_t, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto: no need to namespace with H5D.

}

//H5_DLL herr_t H5Dset_extent(hid_t dset_id, const hsize_t size[]);
func (s *Dataset) H5Dset_extent(dims []uint) error {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto: no need to namespace with H5D.

}

//H5_DLL herr_t H5Dflush(hid_t dset_id);
func (s *Dataset) H5Dflush() error {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto: no need to namespace with H5D.

/* Dataset creation property list (DCPL) routines */

//H5_DLL herr_t H5Pset_layout(hid_t plist_id, H5D_layout_t layout);
func (p *PropList) H5Pset_layout(layout_code uint) error {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto: no need to namespace with H5P.

}

//H5_DLL H5D_layout_t H5Pget_layout(hid_t plist_id);
func (p *PropList) H5Pget_layout() uint {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto: no need to namespace with H5P.

}

//H5_DLL herr_t H5Pset_chunk(hid_t plist_id, int ndims, const hsize_t dim[/*ndims*/]);
func (p *PropList) H5Pset_chunk(ndims uint, dims []uint) error {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto: no need to namespace with H5P.

}

//H5_DLL int H5Pget_chunk(hid_t plist_id, int max_ndims, hsize_t dim[]/*out*/);
func (p *PropList) H5Pget_chunk() uint {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto: no need to namespace with H5P.

func H5open() {
err := h5err(C.H5open())
if err != nil {
err_str := fmt.Sprintf("pb calling H5open(): %s", err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just lump the lines together:

panic(fmt.Errorf("error calling H5open: %v", err))

why is it required?
func init() already does this (and is automaticlly called when the package is imported)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants