-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
There seems to be an issue when working with a MTH5 file and a netcdf file in the same script. This minimal example
from mtpy import MTCollection
import numpy as np
mc = MTCollection()
mc.open_collection(r"/home/moorkamp/playground/MSH/eric/msh_edis/T1/tf_collection.h5")
mt =mc.to_mt_data()
mc.close_collection()
from netCDF4 import Dataset
nstat = 2
testdata = np.zeros(nstat)
data_fh = Dataset("test.nc", "w")
statdim = data_fh.createDimension("StationNumber", nstat)
vmeasx = data_fh.createVariable("MeasPosX","f8",("StationNumber"))
vmeasx.units = "m"
vmeasx[:] = testdata
data_fh.close()gives the error
Traceback (most recent call last):
File "/home/moorkamp/playground/MSH/eric/msh_edis/T1/./minimal.py", line 26, in
vmeasx[:] = testdata
~~~~~~^^^
File "src/netCDF4/_netCDF4.pyx", line 5630, in netCDF4._netCDF4.Variable.setitem
File "src/netCDF4/_netCDF4.pyx", line 5917, in netCDF4._netCDF4.Variable._put
File "src/netCDF4/_netCDF4.pyx", line 2164, in netCDF4._netCDF4._ensure_nc_success
RuntimeError: NetCDF: HDF error
When the order of dealing with the files is swapped (first opening and writing the netcdf file then working with mth5) it works on my system.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels