Skip to content

Commit

Permalink
Fullmatch in warming_level
Browse files Browse the repository at this point in the history
  • Loading branch information
aulemahal committed Oct 5, 2023
1 parent cb4a251 commit 5c343db
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Bug fixes
^^^^^^^^^
* Fixed a bug in ``xs.search_data_catalogs`` when searching for fixed fields and specific experiments/members. (:pull:`251`).
* Fixed a bug in the documentation build configuration that prevented stable/latest and tagged documentation builds from resolving on ReadTheDocs. (:pull:`256`).
* Fixed ``get_warming_level`` to avoid incomplete matches. (:pull:`269`).

Internal changes
^^^^^^^^^^^^^^^^
Expand Down
8 changes: 4 additions & 4 deletions xscen/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -929,13 +929,13 @@ def get_warming_level(
out = {}
for model in info_models:
# choose colum based in ds cat attrs
mip = models.mip_era.str.match(model["mip_era"])
src = models.source.str.match(model["source"])
mip = models.mip_era.str.fullmatch(model["mip_era"])
src = models.source.str.fullmatch(model["source"])
if not src.any():
# Maybe it's an RCM, then source may contain the institute
src = models.source.apply(lambda s: model["source"].endswith(s))
exp = models.experiment.str.match(model["experiment"])
mem = models.member.str.match(model["member"])
exp = models.experiment.str.fullmatch(model["experiment"])
mem = models.member.str.fullmatch(model["member"])

candidates = models[mip & src & exp & mem]
if candidates.empty:
Expand Down

0 comments on commit 5c343db

Please sign in to comment.