Skip to content

UnicodeDecodeError attempting to open an NCO-generated netcdf file #442

@durack1

Description

@durack1

Describe the bug
cdms 3.1.5 fails with a UnicodeDecodeError when attempting to open an NCO-generated netcdf file

To Reproduce
Steps to reproduce the behavior:

In [2]: import cdms2 as cdm
In [3]: f = '/p/css03/esgf_publish/CMIP6/CMIP/CNRM-CERFACS/CNRM-CM6-1/abrupt-4xCO2/r3i1p1f2/Eday/rivo/gn/v20181012/rivo_Eday_CNRM-CM6-1_abrupt-4xCO2_r3i1p1f2_gn_18500501-18591231.nc'
In [4]: fH = cdm.open(f)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb0 in position 11: invalid start byte
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/tmp/ipykernel_70886/1508437202.py", line 1, in <module>
    fH = cdm.open(f)
  File "/home/durack1/anaconda3/envs/cdms315spy515cart020/lib/python3.9/site-packages/cdms2/dataset.py", line 523, in openDataset
    file = CdmsFile(path, mode, hostObj)
  File "/home/durack1/anaconda3/envs/cdms315spy515cart020/lib/python3.9/site-packages/cdms2/dataset.py", line 1295, in __init__
    self._file_ = Cdunif.CdunifFile(path, mode)
SystemError: <built-in function CdunifFile> returned a result with an error set

Expected behavior
I would have expected cdms could open the file, ncdump -h works fine

Screenshots or traceback
reproducible steps above should provide enough info

Desktop (please complete the following information):

  • OS: RHEL 7.9

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