From 62b835ccf8a9aad57368d3f147bad86b79b93a1e Mon Sep 17 00:00:00 2001 From: Grzegorz Kowal Date: Fri, 1 May 2020 15:34:33 -0300 Subject: [PATCH] README: Add brief info how to read data. Signed-off-by: Grzegorz Kowal --- README.md | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 4e80d43..0b49a21 100644 --- a/README.md +++ b/README.md @@ -60,17 +60,17 @@ Requirements runs, tested with version 1.8 or newer. * Optional [HDF5 libraries](https://www.hdfgroup.org/solutions/hdf5/), tested with version 1.10 or newer. The code now uses the new XML-binary snapshot - format. However, if you still wants to use older HDF5 snapshot format, you + format. However, if you still want to use older HDF5 snapshot format, you will need these libraries. Environment Variables ===================== -If the HDF5 libraries are not installed in the default location, i.e. in the -system directory **/usr**, make sure that the environment variable _HDF5DIR_ is -set in your **~/.bashrc** (or **~/.cshrc**) and pointing to the location where -the HDF5 libraries have been installed. +If you need to use the HDF5 libraries and they are not installed in the default +location, i.e. in the system directory **/usr**, make sure that the environment +variable _HDF5DIR_ is set in your **~/.bashrc** (or **~/.cshrc**) and pointing +to the location where the HDF5 libraries have been installed. Compilation @@ -109,3 +109,28 @@ In order to run parallel version (after compiling the code with MPI support), type in your terminal: `mpirun -n N ./amun.x -i ./params.in`, where N is the number of processors to use. + + +Reading data +============ + +By default, the code uses new XML+binary snapshot data format. It can also be +forced by setting parameter **snapshot_format** to **xml**. + +In order to read produced data in this format, you will need to install the +provided Python module. Simply change to **python/** directory and run + `python setup.py install --user` +to install the module in your home directory. + +Import the module in your python script using + `from amunpy import *`, +and then initiate the interface using + `snapshot = AmunXML()` +and read desired variable using + `var = snapshot.dataset()`. + +The function **dataset()** returns rescaled uniform mesh variable as NumPy +array. + +If you want to read data from HDF5 snapshot, just use + `var = amun_dataset(, )`.