Skip to content

Commit

Permalink
Merge pull request #21 from kthyng/main
Browse files Browse the repository at this point in the history
small but important fix
  • Loading branch information
kthyng authored Dec 22, 2022
2 parents e2606d5 + 297621b commit df4d94a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cf_pandas/accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,11 @@ def keys(self) -> Set[str]:

varnames = list(self.axes) + list(self.coordinates)
try:
varnames.extend(list(self.custom_keys))
# see which custom keys have matched values in object
matched_keys = [
key for key, val in self.custom_keys.items() if len(val) > 0
]
varnames.extend(matched_keys)
except ValueError:
# don't have criteria defined, then no custom keys to report
pass
Expand Down
2 changes: 2 additions & 0 deletions tests/test_accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"temp2": {
"standard_name": "temp$",
},
"salt2": {"standard_name": "sal$"},
}


Expand Down Expand Up @@ -73,6 +74,7 @@ def test_match_criteria_key_accessor():
]
assert "X" in df.cf
assert "Y" not in df.cf
assert "salt2" not in df.cf


@mock.patch("requests.get")
Expand Down

0 comments on commit df4d94a

Please sign in to comment.