aodn / python-aodntools

Repository for templates and code relating to generating standard NetCDF files for the Australia Ocean Data Network
GNU Lesser General Public License v3.0
10 stars 3 forks source link

Unhandled exceptions when input file is missing some global attributes #116

Closed mhidas closed 4 years ago

mhidas commented 4 years ago

For sites

Attributes assumed present but not checked for:

Traceback (most recent call last):
  ...
  File "/mnt/ebs/pipeline/lib/python3.5/site-packages/aodntools/timeseries_products/aggregated_timeseries.py", line 278, in main_aggregator
    files_to_agg = sort_files(files_to_agg, input_dir=input_dir)
  File "/mnt/ebs/pipeline/lib/python3.5/site-packages/aodntools/timeseries_products/aggregated_timeseries.py", line 31, in sort_files
    time_start.append(np.datetime64(ds.time_deployment_start.rstrip('Z')))
  File "netCDF4/_netCDF4.pyx", line 2942, in netCDF4._netCDF4.Dataset.__getattr__
  File "netCDF4/_netCDF4.pyx", line 2884, in netCDF4._netCDF4.Dataset.getncattr
  File "netCDF4/_netCDF4.pyx", line 1407, in netCDF4._netCDF4._get_att
  File "netCDF4/_netCDF4.pyx", line 1887, in netCDF4._netCDF4._ensure_nc_success
AttributeError: NetCDF: Attribute not found