Skip to content

cmor-fixer failure case: when trying to fix an open netcdf (e.g. with ncview) #33

@treerink

Description

@treerink

There is a failure case for cmor-fixer which might be hard to debug:

If cmor-fixer tries to fix a file which is opened and assessed by another program it fails. A known case is that a file is opened by ncview. If you try to fix a netcdf file with cmor-fixer while you have it open with ncview, cmor-fixer will fail.

The error might look like this:

Traceback (most recent call last):
  File "./cmor-fixer.py", line 255, in process_file
    modified = fix_file(path, write, keepid, forceid, metadata, add_attributes)
  File "./cmor-fixer.py", line 78, in fix_file
    ds = netCDF4.Dataset(path, "r+" if write else "r")
  File "netCDF4/_netCDF4.pyx", line 2321, in netCDF4._netCDF4.Dataset.__init__
  File "netCDF4/_netCDF4.pyx", line 1885, in netCDF4._netCDF4._ensure_nc_success
OSError: [Errno -101] NetCDF: HDF error: b'test-data/ORCA025-grid-files-test-1/tos_Omon_EC-Earth3P-HR_hist-1950_r1i1p2f1_gn_200601-200612.nc'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./cmor-fixer.py", line 369, in <module>
    main()
  File "./cmor-fixer.py", line 342, in main
    worker(fullpath)
  File "./cmor-fixer.py", line 262, in process_file
    log.error("An IO error for file %s occurred: %s" % (path, io_err.message))
AttributeError: 'OSError' object has no attribute 'message'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions