Closed mcgibbon closed 6 years ago
I removed .item() from all my code, and no tests break. So, it seems as if it is not really necessary.
However, adding .value IMO makes the code more natural to read --
default_constants['boltzmann_constant'].value
makes more sense than default_constants['boltzmann_constant'].values
Even if it's more natural to read .value, it's more confusing to have both. Most people who have already used xarray (or are going to) are used to .values. I think for now I'll leave it as is, and stop using .item() in my own code.
alright, I think we could revisit this if necessary at a later time.
It would be nice to have a shorthand for DataArray.values.item() since it gets used so often for constants. Let's make it so that sympl.DataArray.value is the scalar contained inside the DataArray (as opposed to sympl.DataArray.values which is a numpy array scalar).
On the other hand, maybe we should just be using numpy array scalars? Is there anything wrong with just using .values? Are there cases where we actually need the .item()?