@@ -257,7 +257,7 @@ def _get_measure(obj: Union[DataArray, Dataset], key: str) -> List[str]:
257
257
258
258
def _get_bounds (obj : Union [DataArray , Dataset ], key : str ) -> List [str ]:
259
259
"""
260
- Translate from key (either CF key or variable name) to appropriate bounds names.
260
+ Translate from key (either CF key or variable name) to its bounds' variable names.
261
261
This function interprets the ``bounds`` attribute on DataArrays.
262
262
263
263
Parameters
@@ -269,15 +269,15 @@ def _get_bounds(obj: Union[DataArray, Dataset], key: str) -> List[str]:
269
269
270
270
Returns
271
271
-------
272
- List[str], Variable name(s) in parent xarray object that matches axis or coordinate `key`
272
+ List[str], Variable name(s) in parent xarray object that are bounds of `key`
273
273
"""
274
274
275
- results = []
275
+ results = set ()
276
276
for var in apply_mapper (_get_all , obj , key , error = False , default = [key ]):
277
277
if "bounds" in obj [var ].attrs :
278
- results += [ obj [var ].attrs ["bounds" ]]
278
+ results |= { obj [var ].attrs ["bounds" ]}
279
279
280
- return results
280
+ return list ( results )
281
281
282
282
283
283
def _get_with_standard_name (
@@ -1162,11 +1162,12 @@ def cell_measures(self) -> Dict[str, List[str]]:
1162
1162
@property
1163
1163
def bounds (self ) -> Dict [str , List [str ]]:
1164
1164
"""
1165
- Property that returns a dictionary mapping valid keys to variable names of their bounds.
1165
+ Property that returns a dictionary mapping valid keys
1166
+ to the variable names of their bounds.
1166
1167
1167
1168
Returns
1168
1169
-------
1169
- Dictionary mapping valid keys to variable names of their bounds.
1170
+ Dictionary mapping valid keys to the variable names of their bounds.
1170
1171
"""
1171
1172
1172
1173
obj = self ._obj
@@ -1191,7 +1192,7 @@ def get_standard_names(self) -> List[str]:
1191
1192
@property
1192
1193
def standard_names (self ) -> Dict [str , List [str ]]:
1193
1194
"""
1194
- Returns a sorted list of standard names in Dataset .
1195
+ Returns a dictionary mapping standard names to variable names .
1195
1196
1196
1197
Parameters
1197
1198
----------
@@ -1200,7 +1201,7 @@ def standard_names(self) -> Dict[str, List[str]]:
1200
1201
1201
1202
Returns
1202
1203
-------
1203
- Dictionary of standard names in dataset
1204
+ Dictionary mapping standard names to variable names.
1204
1205
"""
1205
1206
if isinstance (self ._obj , Dataset ):
1206
1207
variables = self ._obj .variables
0 commit comments