{"action":"created","issue":{"url":"https://api.github.com/repos/h5py/h5py/issues/691","repository_url":"https://api.github.com/repos/h5py/h5py","labels_url":"https://api.github.com/repos/h5py/h5py/issues/691/labels{/name}","comments_url":"https://api.github.com/repos/h5py/h5py/issues/691/comments","events_url":"https://api.github.com/repos/h5py/h5py/issues/691/events","html_url":"https://github.com/h5py/h5py/pull/691","id":141233945,"number":691,"title":"Direct Chunk Write Functionality Added","user":{"login":"simongregorebner","id":4639537,"avatar_url":"https://avatars.githubusercontent.com/u/4639537?v=3","gravatar_id":"","url":"https://api.github.com/users/simongregorebner","html_url":"https://github.com/simongregorebner","followers_url":"https://api.github.com/users/simongregorebner/followers","following_url":"https://api.github.com/users/simongregorebner/following{/other_user}","gists_url":"https://api.github.com/users/simongregorebner/gists{/gist_id}","starred_url":"https://api.github.com/users/simongregorebner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simongregorebner/subscriptions","organizations_url":"https://api.github.com/users/simongregorebner/orgs","repos_url":"https://api.github.com/users/simongregorebner/repos","events_url":"https://api.github.com/users/simongregorebner/events{/privacy}","received_events_url":"https://api.github.com/users/simongregorebner/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-03-16T10:41:01Z","updated_at":"2016-03-17T10:54:49Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/h5py/h5py/pulls/691","html_url":"https://github.com/h5py/h5py/pull/691","diff_url":"https://github.com/h5py/h5py/pull/691.diff","patch_url":"https://github.com/h5py/h5py/pull/691.patch"},"body":"This pull request adds direct chunk writing to h5py. It is fixing issue #690 \r\n\r\nTo address the issue that direct chunk writing is potentially dangerous for non experts, I did not made this functionality directly available through the dataset api but only if going through dataset.id .\r\n\r\nExample of directly writing pre-compressed data using bitshuffle (https://github.com/kiyo-masui/bitshuffle):\r\n\r\n```\r\nimport h5py\r\nimport numpy\r\nimport bitshuffle\r\nimport bitshuffle.h5\r\nimport struct\r\n\r\nfilename = \"direct_chunk.hdf\"\r\nfilehandle = h5py.File(filename, \"w\")\r\n\r\nblock_size = 2048\r\ndataset = filehandle.create_dataset(\"data\", (100, 100, 100), maxshape=(None, 100, 100), compression=32008, compression_opts=(block_size, bitshuffle.h5.H5_COMPRESS_LZ4), chunks=(1,100,100), dtype='float32')\r\n\r\narray = numpy.random.rand(100, 100)\r\narray = array.astype('float32')\r\n\r\ncompressed = bitshuffle.compress_lz4(array, block_size)\r\n\r\n# Adding header information according to HDF5 plugin specification\r\nbytes_number_of_elements = struct.pack('>q', (100*100*4))\r\nbytes_block_size = struct.pack('>i', block_size*4)\r\nbyte_array = bytes_number_of_elements + bytes_block_size + compressed.tobytes()\r\n\r\nindex = 0\r\ndataset.id.write_direct_chunk((index, 0, 0), byte_array)\r\n\r\nfilehandle.close()\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/h5py/h5py/issues/comments/197818359","html_url":"https://github.com/h5py/h5py/pull/691#issuecomment-197818359","issue_url":"https://api.github.com/repos/h5py/h5py/issues/691","id":197818359,"user":{"login":"simongregorebner","id":4639537,"avatar_url":"https://avatars.githubusercontent.com/u/4639537?v=3","gravatar_id":"","url":"https://api.github.com/users/simongregorebner","html_url":"https://github.com/simongregorebner","followers_url":"https://api.github.com/users/simongregorebner/followers","following_url":"https://api.github.com/users/simongregorebner/following{/other_user}","gists_url":"https://api.github.com/users/simongregorebner/gists{/gist_id}","starred_url":"https://api.github.com/users/simongregorebner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simongregorebner/subscriptions","organizations_url":"https://api.github.com/users/simongregorebner/orgs","repos_url":"https://api.github.com/users/simongregorebner/repos","events_url":"https://api.github.com/users/simongregorebner/events{/privacy}","received_events_url":"https://api.github.com/users/simongregorebner/received_events","type":"User","site_admin":false},"created_at":"2016-03-17T10:54:49Z","updated_at":"2016-03-17T10:54:49Z","body":"I updated the pull request based on your feedback ..."}}