Ouranosinc / xscen

A climate change scenario-building analysis framework.
https://xscen.readthedocs.io/
Apache License 2.0
15 stars 2 forks source link

Better get_warming_level #269

Closed aulemahal closed 12 months ago

aulemahal commented 12 months ago

Pull Request Checklist:

What kind of change does this PR introduce?

In #215, I used pd.Series.str.match to find models in the global tas dataset. However, match will return a match even if only the beginning of the string matches the pattern.

For example: looking for "EC-Earth3" would match for "EC-Earth3-CC". This resulted in some models getting multiple matches even though an exact match existed.

This PR switches to fullmatch which ensures the full string matches, which I'm pretty sure is the expected behaviour when regex is not used. If needed, the previous behaviour can be obtained by adding "." to the query (like "EC-Earth3.").

Does this PR introduce a breaking change?

Yes and no. I think the new behaviour is the proper one.