Giter Club home page Giter Club logo

pack5's Introduction

pack5

python utility script to bundle multiple npz files into one hdf5

Usage

This small script assumes that you have something like this:

$ ls tests/*{json,npy}
tests/data_000000.npy  tests/data_000007.npy  tests/pars000004.json
tests/data_000001.npy  tests/data_000008.npy  tests/pars000005.json
tests/data_000002.npy  tests/data_000009.npy  tests/pars000006.json
tests/data_000003.npy  tests/pars000000.json  tests/pars000007.json
tests/data_000004.npy  tests/pars000001.json  tests/pars000008.json
tests/data_000005.npy  tests/pars000002.json  tests/pars000009.json
tests/data_000006.npy  tests/pars000003.json

The json files go as metadata with the .npy files. As mentioned it's the goal of this small script to pack the .npy files into a hdf5 compliant format. This can be done in 2 ways:

  • by using a wildcard expression
$ python3 ./pack5.py --output cli.h5 --numpy-wc "./tests/data*.npy" --json-wc "./tests/pars*.json"

This will store are contents of the 10 .npy files inside cli.h5 and attach the contents of the respective pars*.json as attributes (for more details, see dataset attributes.

  • by providing a list of files
$ python3 ./pack5.py --output cli.h5 --numpy-list numpy.list --json-list json.list

which in turn contain the full paths.

The tool is written such that it can store only chunks of the data inside a series of hdf5 files:

$ python3 ./pack5.py --output cli.h5 --numpy-wc "./tests/data*.npy" --json-wc "./tests/pars*.json" --files-per-chunk 2
Wrote 5/5 .h5 files from 10 inputs

This has created 5 .h5 files with 2 npy/json datasets inside each.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.