Skip to content

cdms2 conflict with latest numpy version #449

@lee1043

Description

@lee1043

numpy.float (e.g., used here is deprecated since numpy 1.20, need to replace it to numpy.float64.

f = cdms2.open(path) with latest numpy version returns below error.

 File "/Users/lee1043/mambaforge/envs/pmp_devel_20230223/lib/python3.9/site-packages/cdms2/dataset.py", line 523, in openDataset
    file = CdmsFile(path, mode, hostObj)
  File "/Users/lee1043/mambaforge/envs/pmp_devel_20230223/lib/python3.9/site-packages/cdms2/dataset.py", line 1348, in __init__
    self.variables[name] = FileVariable(
  File "/Users/lee1043/mambaforge/envs/pmp_devel_20230223/lib/python3.9/site-packages/cdms2/fvariable.py", line 21, in __init__
    DatasetVariable.__init__(self, parent, varname)
  File "/Users/lee1043/mambaforge/envs/pmp_devel_20230223/lib/python3.9/site-packages/cdms2/variable.py", line 74, in __init__
    self._numericType_ = numpy.float
  File "/Users/lee1043/mambaforge/envs/pmp_devel_20230223/lib/python3.9/site-packages/numpy/__init__.py", line 305, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'float'.
`np.float` was a deprecated alias for the builtin `float`. To avoid this error in existing code, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

I understand cdms2 is no longer under active development, so leaving this error for documenting it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions