xgcm / xhistogram

Fast, flexible, label-aware histograms for numpy and xarray
https://xhistogram.readthedocs.io
MIT License
90 stars 20 forks source link

Fix bug with density calculation when NaNs are present #52

Closed dougiesquire closed 3 years ago

dougiesquire commented 3 years ago

Description

There is a bug in the calculation of histogram densities when Nans are present and there is at least one dimension that is not histogram'd. Details are here. This PR implements a fix for the bug.

Closes #51

Type of change

Testing

codecov[bot] commented 3 years ago

Codecov Report

Merging #52 (9769f83) into master (8a6765a) will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #52   +/-   ##
=======================================
  Coverage   84.08%   84.08%           
=======================================
  Files           2        2           
  Lines         245      245           
  Branches       74       72    -2     
=======================================
  Hits          206      206           
  Misses         34       34           
  Partials        5        5           
Impacted Files Coverage Δ
xhistogram/xarray.py 91.07% <ø> (-0.46%) :arrow_down:
xhistogram/core.py 82.01% <100.00%> (+0.29%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 8a6765a...9769f83. Read the comment docs.

dougiesquire commented 3 years ago

Thanks for the review @TomNicholas. I've just made a few updates to be compatible with recent changes on master. If you're still happy, I'll go ahead and merge.