File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -1030,8 +1030,12 @@ def isin(self, test_elements):
1030
1030
return self ._obj .isin (mapped_test_elements )
1031
1031
1032
1032
def _drop_missing_variables (self , variables : list [str ]) -> list [str ]:
1033
+ if isinstance (self ._obj , Dataset ):
1034
+ good_names = set (self ._obj .variables )
1035
+ elif isinstance (self ._obj , DataArray ):
1036
+ good_names = set (self ._obj .coords )
1033
1037
1034
- return [var for var in variables if var in self . _obj or var in self . _obj . coords ]
1038
+ return [var for var in variables if var in good_names ]
1035
1039
1036
1040
def _get_all_cell_measures (self ):
1037
1041
"""
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ What's New
5
5
v0.6.4 (unreleased)
6
6
===================
7
7
- integrate ``xclim ``'s CF-compliant unit formatter. :pr: `278 `. By `Justus Magin `_.
8
+ - Fix dropping of bad variable names. :pr: `291 `. By `Tom Vo `_.
8
9
9
10
v0.6.3 (December 16, 2021)
10
11
==========================
@@ -142,4 +143,5 @@ v0.1.3
142
143
.. _`Kristen Thyng` : https://github.com/kthyng
143
144
.. _`Julius Busecke` : https://github.com/jbusecke
144
145
.. _`Filipe Fernandes` : https://github.com/ocefpaf
146
+ .. _`Tom Vo` : https://github.com/tomvothecoder
145
147
.. _`flag variables` : http://cfconventions.org/Data/cf-conventions/cf-conventions-1.8/cf-conventions.html#flags
You can’t perform that action at this time.
0 commit comments