iranroman / SpatialScaper

Creative Commons Attribution 4.0 International
25 stars 4 forks source link

Error in running example_generation file #73

Closed sakshamsingh1 closed 4 months ago

sakshamsingh1 commented 4 months ago

Hi, Thanks for the really useful library.

I followed all the steps in readme but I am getting this error while running the example_generation.py file.

  File "src/netCDF4/_netCDF4.pyx", line 2107, in netCDF4._netCDF4._ensure_nc_success
OSError: [Errno -101] NetCDF: HDF error: 'datasets/rir_datasets/spatialscaper_RIRs/bomb_shelter_mic.sofa'

Here is the entire traceback:

Traceback (most recent call last):
  File "example_generation.py", line 68, in <module>
    generate_soundscape(iscape)
  File "example_generation.py", line 57, in generate_soundscape
    ssc.add_event()  # randomly choosing and spatializing an FSD50K sound event
  File "/dlbimg/misc/SpatialScaper/spatialscaper/core.py", line 334, in add_event
    event_position_ = self.define_trajectory(
  File "/dlbimg/misc/SpatialScaper/spatialscaper/core.py", line 523, in define_trajectory
    xyz_min, xyz_max = self._get_room_min_max()
  File "/dlbimg/misc/SpatialScaper/spatialscaper/core.py", line 439, in _get_room_min_max
    all_xyz = self.get_room_irs_xyz()
  File "/dlbimg/misc/SpatialScaper/spatialscaper/core.py", line 559, in get_room_irs_xyz
    return load_pos(room_sofa_path, doas=False)
  File "/dlbimg/misc/SpatialScaper/spatialscaper/sofa_utils.py", line 269, in load_pos
    sofa = pysofa.SOFAFile(filepath, "r")
  File "/home/skush/.conda/envs/ssenv/lib/python3.8/site-packages/pysofaconventions/SOFAFile.py", line 65, in __init__
    self.ncfile = SOFANetCDFFile(path,mode)
  File "/home/skush/.conda/envs/ssenv/lib/python3.8/site-packages/pysofaconventions/SOFANcFile.py", line 44, in __init__
    self.file = netCDF4.Dataset(path,mode)
  File "src/netCDF4/_netCDF4.pyx", line 2470, in netCDF4._netCDF4.Dataset.__init__
  File "src/netCDF4/_netCDF4.pyx", line 2107, in netCDF4._netCDF4._ensure_nc_success
OSError: [Errno -101] NetCDF: HDF error: 'datasets/rir_datasets/spatialscaper_RIRs/bomb_shelter_mic.sofa'

Please let me know, how can I fix this error?

karinnacvijanovich commented 4 months ago

Hi @sakshamsingh1 I believe that error can be fixed by including "from netCDF4 import Dataset" It may need to be placed before all other imports, or at least near the top.

iranroman commented 4 months ago

@sakshamsingh1 were you able to solve your problem? Could you tell us what was the fix in your case?

sakshamsingh1 commented 4 months ago

Hi @iranroman, using "from netCDF4 import Dataset" on the top of the example_generation.py script fixed the error.