Skip to content

Commit

Permalink
Yet more formatting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mataeui committed Feb 20, 2025
1 parent b1c5b18 commit 2953e33
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion satpy/readers/netcdf_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,20 @@ def _collect_global_attrs(self, obj):
self.file_content[fc_key] = global_attrs[key] = value
self.file_content["/attrs"] = global_attrs

def _get_object_attrs(self, obj):
@classmethod
def _get_object_attrs(cls, obj):
"""
Do not try to use __dict__ if obj is a compound variable.
Return empty dict if it is, otherwise return the object's
attributes in a dict.
"""
try:
if obj.dtype.kind == "V":
LOG.warning(f"Warning: Cannot load attributes for compound variable ({obj.name})")
return {}
except (AttributeError, KeyError):
pass
return obj.__dict__

def _collect_attrs(self, name, obj):
Expand Down

0 comments on commit 2953e33

Please sign in to comment.