This corrects a mistake introduced by https://github.com/ClimateImpactLab/dodola/pull/163. The functionality to cap non-polar DTR values had an error in its implementation that lead all polar values to be modified. The tests couldn't catch this because they were also wrong, using == to compare xarray.Dataset objects.
This PR :
Corrects the boolean condition expression in the cap function to preserve polar values
Corrects the cap function test by making use of xarray.testing.assert_equals and adds an additional test case to verify that values that should not be capped (because those are not out of range) are indeed not capped.
This corrects a mistake introduced by https://github.com/ClimateImpactLab/dodola/pull/163. The functionality to cap non-polar DTR values had an error in its implementation that lead all polar values to be modified. The tests couldn't catch this because they were also wrong, using
==
to comparexarray.Dataset
objects.This PR :
xarray.testing.assert_equals
and adds an additional test case to verify that values that should not be capped (because those are not out of range) are indeed not capped.