Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
| hdf5 [2011/08/30 13:17] – [Utilisation] admin | hdf5 [2018/02/01 19:57] (Version actuelle) – [Links] admin | ||
|---|---|---|---|
| Ligne 2: | Ligne 2: | ||
| **HDF5** is a data model, library, and file format for storing and managing data. It supports an unlimited variety of datatypes, and is designed for flexible and efficient I/O and for high volume and complex data. HDF5 is portable and is extensible, allowing applications to evolve in their use of HDF5. The HDF5 Technology suite includes tools and applications for managing, manipulating, | **HDF5** is a data model, library, and file format for storing and managing data. It supports an unlimited variety of datatypes, and is designed for flexible and efficient I/O and for high volume and complex data. HDF5 is portable and is extensible, allowing applications to evolve in their use of HDF5. The HDF5 Technology suite includes tools and applications for managing, manipulating, | ||
| - | ====== | + | ====== |
| - | * 1.9.63 (version | + | * Use module avail lib/hdf5 to view installed |
| + | ====== How to? ====== | ||
| - | ====== Utilisation ====== | + | |
| - | + | ||
| - | | + | |
| <code bash> | <code bash> | ||
| - | $ module load hdf5 | + | $ module load lib/hdf5 |
| </ | </ | ||
| - | * Compiler votre application | + | ===== Manipulate data from your code ===== |
| + | |||
| + | **Example : Create Dataset** | ||
| + | |||
| + | <file C dataSet.c> | ||
| + | |||
| + | /* | ||
| + | | ||
| + | */ | ||
| + | |||
| + | #include " | ||
| + | #define FILE " | ||
| + | int main() { | ||
| + | |||
| + | | ||
| + | | ||
| + | | ||
| + | |||
| + | /* Create a new file using default properties. */ | ||
| + | |||
| + | | ||
| + | |||
| + | /* Create the data space for the dataset. */ | ||
| + | |||
| + | | ||
| + | | ||
| + | | ||
| + | |||
| + | /* Create the dataset. */ | ||
| + | |||
| + | | ||
| + | |||
| + | H5P_DEFAULT, | ||
| + | |||
| + | /* End access to the dataset and release resources used by it. */ | ||
| + | |||
| + | | ||
| + | |||
| + | /* Terminate access to the data space. */ | ||
| + | |||
| + | | ||
| + | |||
| + | /* Close the file. */ | ||
| + | | ||
| + | } | ||
| + | |||
| + | |||
| + | </ | ||
| + | | ||
| <code bash> | <code bash> | ||
| - | $ [icc|ifort] myApplication.c -o myProgram.exe -L$(HDF5_HOME)/ | + | $ [icc|ifort|gcc|mpicc] myApplication.c -o myProgram.exe -L$(HDF5_HOME)/ |
| </ | </ | ||
| - | | + | ===Python example=== |
| + | We need to load python first <code bash>$ module load lang/ | ||
| + | **Wrire HDF5** | ||
| + | <code python> | ||
| + | # | ||
| + | import h5py | ||
| + | |||
| + | # Create random data | ||
| + | import numpy as np | ||
| + | data_matrix = np.random.uniform(-1, | ||
| + | |||
| + | # Write data to HDF5 | ||
| + | data_file = h5py.File(' | ||
| + | data_file.create_dataset(' | ||
| + | data_file.close() | ||
| + | </ | ||
| + | |||
| + | **Read HDF5** | ||
| + | <code python> | ||
| + | |||
| + | import h5py | ||
| + | filename = ' | ||
| + | f = h5py.File(filename, | ||
| + | |||
| + | # List all groups | ||
| + | print(" | ||
| + | a_group_key = list(f.keys())[0] | ||
| + | |||
| + | # Get the data | ||
| + | data = list(f[a_group_key]) | ||
| + | |||
| + | </ | ||
| + | ===== Using H5 tools ===== | ||
| + | |||
| + | |||
| + | Commands are located [[http:// | ||
| + | |||
| + | /** | ||
| + | ===== Visualiser les fichiers HDF ===== | ||
| + | |||
| + | Vous pouvez visualiser les fichiers HDF en utilisant l' | ||
| + | |||
| + | <code bash> | ||
| + | $ module load tools/ | ||
| + | $ hdvfiew | ||
| + | </ | ||
| - | La liste des commandes est disponible [[http://www.hdfgroup.org/HDF5/ | + | {{ :hdfview.png? |}} |
| - | ====== | + | */ |
| + | ====== | ||
| - | http:// | + | * http:// |
| + | * https:// | ||