Skip to content

When an attribute is missing, error message does not always say which one #57

@corviday

Description

@corviday

While indexing a file:

2018-11-16 13:20:15 INFO: Processing file: /storage/data/projects/comp_support/climate_explorer_data_prep/climatological_means/return_periods/pr_RP20_BCCAQ2_PRISM_CanESM2_rcp85_r1i1p1_2041-2070.nc
2018-11-16 13:20:15 ERROR: Traceback (most recent call last):
  File "/home/lzeman/Code/modelmeta-newdb/modelmeta/mm_cataloguer/index_netcdf.py", line 1354, in index_netcdf_file
    data_file = find_update_or_insert_cf_file(session, cf)
  File "/home/lzeman/Code/modelmeta-newdb/modelmeta/mm_cataloguer/index_netcdf.py", line 1244, in find_update_or_insert_cf_file
    find_data_file_by_id_hash_filename(sesh, cf)
  File "/home/lzeman/Code/modelmeta-newdb/modelmeta/mm_cataloguer/index_netcdf.py", line 1085, in find_data_file_by_id_hash_filename
    q = sesh.query(DataFile).filter(DataFile.unique_id == cf.unique_id)
  File "netCDF4/_netCDF4.pyx", line 2450, in netCDF4._netCDF4.Dataset.__getattr__
  File "netCDF4/_netCDF4.pyx", line 2396, in netCDF4._netCDF4.Dataset.getncattr
  File "netCDF4/_netCDF4.pyx", line 1110, in netCDF4._netCDF4._get_att
  File "netCDF4/_netCDF4.pyx", line 1556, in netCDF4._netCDF4._ensure_nc_success
AttributeError: NetCDF: Attribute not found

Error seems to be somewhere in the unique_id generation, but it's very difficult to trace. An error message that just told me which attribute was missing without me having to dig through code and make wild guesses would be nice.

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