Skip to content

BUG: netCDF with Python 3.12 on Mac #104

@aburrell

Description

@aburrell

Description

self = <pysatMadrigal.tests.test_instruments.TestInstruments object at 0x119549a30>
clean_level = 'clean'
inst_dict = {'inst_id': '', 'inst_module': <module 'pysatMadrigal.instruments.gnss_tec' from '/Users/runner/work/pysatMadrigal/pys...uments/gnss_tec.py'>, 'tag': 'site', 'user_info': {'password': 'pysat.developers@gmail.com', 'user': 'pysat+CI_tests'}}

    @pytest.mark.second
    # Need to maintain download mark for backwards compatibility.
    # Can remove once pysat 3.1.0 is released and libraries are updated.
    @pytest.mark.load_options
    @pytest.mark.download
    @pytest.mark.parametrize("clean_level", ['none', 'dirty', 'dusty', 'clean'])
    def test_load(self, clean_level, inst_dict):
        """Test that instruments load at each cleaning level.
    
        Parameters
        ----------
        clean_level : str
            Cleanliness level for loaded instrument data.
        inst_dict : dict
            Dictionary containing info to instantiate a specific instrument.
            Set automatically from instruments['download'] when
            `initialize_test_package` is run.
    
        """
    
        test_inst, date = initialize_test_inst_and_date(inst_dict)
        if len(test_inst.files.files) > 0:
            # Set Clean Level
            test_inst.clean_level = clean_level
            target = 'Fake Data to be cleared'
            test_inst.data = [target]
            try:
>               test_inst.load(date=date, use_header=True)

/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pysat/tests/classes/cls_instrument_library.py:343: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pysat/_instrument.py:3332: in load
    self.data, meta = self._load_data(date=self.date, fid=self._fid,
/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pysat/_instrument.py:1619: in _load_data
    data, mdata = self._load_rtn(load_fname, tag=self.tag,
pysatMadrigal/instruments/gnss_tec.py:315: in load
    data, meta, lat_keys, lon_keys = gnss.load_site(fnames)
pysatMadrigal/instruments/methods/gnss.py:1[54](https://github.com/pysat/pysatMadrigal/actions/runs/8251407088/job/22619624627?pr=98#step:10:55): in load_site
    data, meta = general.load(fnames, 'site', '', xarray_coords=xcoords)
pysatMadrigal/instruments/methods/general.py:780: in load
    file_data = xr.open_dataset(load_file_types["netCDF4"][0],
/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/xarray/backends/api.py:573: in open_dataset
    backend_ds = backend.open_dataset(
/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/xarray/backends/netCDF4_.py:646: in open_dataset
    store = NetCDF4DataStore.open(
/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/xarray/backends/netCDF4_.py:409: in open
    return cls(manager, group=group, mode=mode, lock=lock, autoclose=autoclose)
/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/xarray/backends/netCDF4_.py:3[56](https://github.com/pysat/pysatMadrigal/actions/runs/8251407088/job/22619624627?pr=98#step:10:57): in __init__
    self.format = self.ds.data_model
/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/xarray/backends/netCDF4_.py:418: in ds
    return self._acquire()
/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/xarray/backends/netCDF4_.py:412: in _acquire
    with self._manager.acquire_context(needs_lock) as root:
/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/contextlib.py:137: in __enter__
    return next(self.gen)
/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/xarray/backends/file_manager.py:199: in acquire_context
    file, cached = self._acquire_with_cache_info(needs_lock)
/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/xarray/backends/file_manager.py:217: in _acquire_with_cache_info
    file = self._opener(*self._args, **kwargs)
src/netCDF4/_netCDF4.pyx:2492: in netCDF4._netCDF4.Dataset.__init__
    ???
src/netCDF4/_netCDF4.pyx:1927: in netCDF4._netCDF4._get_vars
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   RuntimeError: NetCDF: HDF error

src/netCDF4/_netCDF4.pyx:2034: RuntimeError

Test configuration

  • OS: "mac-latest"
  • Version: Python 3.12
  • Other details about your setup that could be relevant: netCDF4-1.6.5-cp312-cp312-macosx_10_9_x86_64.whl.metadata

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions