io.net_cdf_io
Module¶
This module contains fileIO operations and file conversion for the image processing tool kit in the NSLS-II data analysis software package. The functions included in this module focus on reading and writing netCDF files. This is the file format used by Mark Rivers for x-ray computed microtomography data collected at Argonne National Laboratory, Sector 13BMD, GSECars.
-
skbeam.io.net_cdf_io.
load_netCDF
(file_name)¶ This function loads the specified netCDF file format data set (e.g.*.volume APS-Sector 13 GSECARS extension) file into a numpy array for further analysis.
Required Dependencies:
- netcdf4Python/numpy interface to the netCDF ver. 4 library
Package name: netcdf4-python Install from: https://github.com/Unidata/netcdf4-python
numpy
Cython – optional
- HDF5 C library version 1.8.8 or higher
Install from: ftp://ftp.hdfgroup.org/HDF5/current/src Be sure to build with ‘–enable-hl –enable-shared’.
- netCDF-4 C library
- Install from:
ftp://ftp.unidata.ucar.edu/pub/netcdf. Version 4.1.1 or higher
Be sure to build with ‘–enable-netcdf-4 –enable-shared’, and set CPPFLAGS=”-I $HDF5_DIR/include” and LDFLAGS=”-L $HDF5_DIR/lib”, where $HDF5_DIR is the directory where HDF5 was installed. If you want OPeNDAP support, add ‘–enable-dap’. If you want HDF4 SD support, add ‘–enable-hdf4’ and add the location of the HDF4 headers and library to CPPFLAGS and LDFLAGS.
- Parameters
- file_namestring
Complete path to the file to be loaded into memory
- Returns
- md_dictdict
Dictionary containing all metadata contained in the netCDF file. This metadata contains data collection, and experiment information as well as values and variables pertinent to the image data.
- datandarray
ndarray containing the image data contained in the netCDF file. The image data is scaled using the scale factor defined in the netCDF metadata, if a scale factor was recorded during data acquisition or reconstruction. If a scale factor is not present, then a default value of 1.0 is used.