yt-project / yt_idv

Interactive volume rendering for yt
Other
9 stars 6 forks source link

fix block data extrema calculation with nan values #23

Closed chrishavlin closed 3 years ago

chrishavlin commented 3 years ago

Was trying to load a dataset with lots of nans and was getting the following error:

/home/chris/src/yt_/yt_idv/yt_idv/scene_data/block_collection.py:59: RuntimeWarning: All-NaN axis encountered
  self.min_val = min(self.min_val, np.nanmin(np.abs(block.my_data[0]).min()))
/home/chris/src/yt_/yt_idv/yt_idv/scene_data/block_collection.py:60: RuntimeWarning: All-NaN axis encountered
  self.max_val = max(self.max_val, np.nanmax(np.abs(block.my_data[0]).max()))
/home/chris/src/yt_/yt_idv/yt_idv/scene_data/block_collection.py:123: RuntimeWarning: invalid value encountered in true_divide
  n_data = (n_data - self.min_val) / (

Switching the order of the nanmin (nanmax) and min (max) operations fixed it.