ISSM Python interface discussion

Documenting issues users might face with the Python interface of ISSM below

1 Like

Python netCDF4 might be linked and compiled to the wrong HDF5 library (should be brew installed), multiple issues can stem from this. Switching formats in the code only shuffles the symptom.

You need to reinstall netCDF4 so that it finds a working HDF5 on your Mac. For example, if you’re using Homebrew, first install HDF5 and netCDF4:

brew install hdf5 netcdf
Then, rebuild the Python binding so it links to the new HDF5:
pip uninstall netCDF4
now force a source install against your brew‑installed HDF5,

HDF5_DIR=$(brew --prefix hdf5) \
pip install --no-binary netCDF4 netCDF4

In Python, now test:
from netCDF4 import Dataset
Dataset
<class ‘netCDF4._netCDF4.Dataset’>`

After that something like:
NCData = Dataset(filename, 'w', format='NETCDF4')
will succeed and you’ll be able to write out the file.