DESC
DESC copied to clipboard
Add a warning if any computed quantity from `XXX.compute` is NaN
something like
any_is_nan = any([ np.any(np.isnan(data[key])) for key in data.keys() ]
warnif(any_is_nan, UserWarning, "Detected one or more quantities computed as NaN, please check that the requested quantities are defined on the grid used")
at the end of each XXX.compute method of objects would be nice to warn the use of any NaN which exist when computing quantities. This also I predict would cause a lot of errors in our CI from areas where this is happening silently/benignly (like when plotting this I am certain happens all the time)
Related to #1138, as I think right now NaN exist in plotted quantities (for example on axis) but the blanket suppression would prevent the warning from coming through
Note that we deliberately return NaN in some cases, eg kinetic profiles for equilibria that don't have them assigned. The way the code is structured, if the user computes pressure we also always compute the kinetic profiles but set them to NaN, so this may cause some false positives unless we add some special logic