Skip to content

goes-imager_nc fails to read GOES 13 netcdf data #3430

Description

@KNLargadas

Describe the bug
goes-imager_nc fails to read GOES 13 netcdf data.

To Reproduce

from satpy import Scene
import glob

filenames = glob.glob('goes13.2015.291.001519.BAND_01.nc')

scene = Scene(filenames=filenames, reader='goes-imager_nc')
available = scn.available_dataset_names()
print(f"Available dataset names: {available}")

Expected behavior
Available dataset names: ['00_7', 'latitude_00_7', 'longitude_00_7']

Actual results

    scene = Scene(filenames=filenames, reader='goes-imager_nc')
  File "/Users/user/miniconda3/envs/satpy_env/lib/python3.14/site-packages/satpy/scene.py", line 155, in __init__
    self._readers = self._create_reader_instances(filenames=filenames,
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
                                                  reader=reader,
                                                  ^^^^^^^^^^^^^^
                                                  reader_kwargs=cleaned_reader_kwargs)
                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/miniconda3/envs/satpy_env/lib/python3.14/site-packages/satpy/scene.py", line 176, in _create_reader_instances
    return load_readers(filenames=filenames,
                        reader=reader,
                        reader_kwargs=reader_kwargs)
  File "/Users/user/miniconda3/envs/satpy_env/lib/python3.14/site-packages/satpy/readers/core/loading.py", line 65, in load_readers
    reader_instance.create_storage_items(
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
            loadables,
            ^^^^^^^^^^
            fh_kwargs=reader_kwargs_without_filter[None if reader is None else reader[idx]])
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/miniconda3/envs/satpy_env/lib/python3.14/site-packages/satpy/readers/core/yaml_reader.py", line 618, in create_storage_items
    return self.create_filehandlers(files, **kwargs)
           ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/Users/user/miniconda3/envs/satpy_env/lib/python3.14/site-packages/satpy/readers/core/yaml_reader.py", line 630, in create_filehandlers
    filehandlers = self._new_filehandlers_for_filetype(filetype_info,
                                                       filename_set,
                                                       fh_kwargs=fh_kwargs)
  File "/Users/user/miniconda3/envs/satpy_env/lib/python3.14/site-packages/satpy/readers/core/yaml_reader.py", line 613, in _new_filehandlers_for_filetype
    return list(filtered_iter)
  File "/Users/user/miniconda3/envs/satpy_env/lib/python3.14/site-packages/satpy/readers/core/yaml_reader.py", line 595, in filter_fh_by_metadata
    for filehandler in filehandlers:
                       ^^^^^^^^^^^^
  File "/Users/user/miniconda3/envs/satpy_env/lib/python3.14/site-packages/satpy/readers/core/yaml_reader.py", line 591, in _new_filehandler_instances
    yield filetype_cls(filename, filename_info, filetype_info, *req_fh, **fh_kwargs)
          ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/miniconda3/envs/satpy_env/lib/python3.14/site-packages/satpy/readers/goes_imager_nc.py", line 1014, in __init__
    super(GOESNCFileHandler, self).__init__(filename, filename_info,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
                                            filetype_info)
                                            ^^^^^^^^^^^^^^
  File "/Users/user/miniconda3/envs/satpy_env/lib/python3.14/site-packages/satpy/readers/goes_imager_nc.py", line 623, in __init__
    self.platform_shortname = self.platform_name.replace("-", "").lower()
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'replace'

Environment Info:

  • OS: Mac
  • Satpy Version: 0.60.0

Additional context
Patching this error with the following gives the correct output in the expected behavior section above:

import re
import satpy.readers.goes_imager_nc as ginc
from satpy.readers.goes_imager_hrit import SPACECRAFTS
 
def _get_platform_name_fixed(ncattr):
    match = re.match(r"G(?:OES)?-(\d+)", ncattr.strip())
    if match:
        return SPACECRAFTS.get(int(match.groups()[0]))
    return None
 
ginc.GOESNCFileHandler._get_platform_name = staticmethod(_get_platform_name_fixed)

(Code was generated by AI.)

Patching this permanently would be nice.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions