File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -433,7 +433,7 @@ def build_cube_metadata(engine):
433433 # Set the cube global attributes.
434434 for attr_name , attr_value in cf_var .cf_group .global_attributes .items ():
435435 try :
436- cube .attributes [str (attr_name )] = attr_value
436+ cube .attributes . globals [str (attr_name )] = attr_value
437437 except ValueError as e :
438438 msg = "Skipping global attribute {!r}: {}"
439439 warnings .warn (msg .format (attr_name , str (e )))
Original file line number Diff line number Diff line change @@ -159,8 +159,13 @@ def attribute_predicate(item):
159159 return item [0 ] not in _CF_ATTRS
160160
161161 tmpvar = filter (attribute_predicate , cf_var .cf_attrs_unused ())
162+ attrs_dict = iris_object .attributes
163+ if hasattr (attrs_dict , "locals" ):
164+ # Treat cube attributes (i.e. a CubeAttrsDict) as a special case.
165+ # These attrs are "local" (i.e. on the variable), so record them as such.
166+ attrs_dict = attrs_dict .locals
162167 for attr_name , attr_value in tmpvar :
163- _set_attributes (iris_object . attributes , attr_name , attr_value )
168+ _set_attributes (attrs_dict , attr_name , attr_value )
164169
165170
166171def _get_actual_dtype (cf_var ):
You can’t perform that action at this time.
0 commit comments