Skip to content

Error parsing file: AttributeError: 'numpy.float64' object has no attribute 'strip' #23

@AJamesPhillips

Description

@AJamesPhillips

With the following 1.2 Gb file (sorry I haven't reduced it in size yet but happy to try to do that to narrow down the problem) "Download the global GEBCO_2019 SID Grid" from https://www.gebco.net/data_and_products/gridded_bathymetry_data/

The following code errors:

import cf

f = cf.read("GEBCO_2019_SID.nc")
print(f)

$ python process.py
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/cfunits/units.py", line 678, in init
units = units.strip()
AttributeError: 'numpy.float64' object has no attribute 'strip'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "process.py", line 3, in
f = cf.read("GEBCO_2019_SID.nc")
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/cf/read_write/read.py", line 514, in read
chunk=chunk)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/cf/read_write/read.py", line 710, in _read_a_file
extra_read_vars=extra_read_vars)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/cfdm/read_write/netcdf/netcdfread.py", line 854, in read
all_fields[ncvar] = self._create_field(ncvar)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/cfdm/read_write/netcdf/netcdfread.py", line 1985, in _create_field
self.implementation.set_properties(f, field_properties, copy=True)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/cfdm/read_write/cfdmimplementation.py", line 1771, in set_properties
construct.set_properties(properties, copy=copy)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/cf/mixin/properties.py", line 979, in set_properties
setattr(self, prop, value)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/cf/mixin/propertiesdata.py", line 1610, in units
self.Units = Units(value, getattr(self, 'calendar', None))
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/cf/units.py", line 16, in new
return cfUnits(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/cfunits/units.py", line 680, in init
raise ValueError("Can't set unsupported unit: {!r}".format(units))
ValueError: Can't set unsupported unit: 1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions