Closed burakatakan closed 6 months ago
Thanks for the note. Any idea what causes this issue? I'll fix it ASAP since warnings are annoying.
In def REFPROP2dll the problematic line is: a = ct.c_double(a) I assume that 'a' is a numpy array of length 1? Probably the following could help, but I am not sure, if this has any side effects: a = ct.c_double(a[0])
Regards!
Ugh - looks like I am going to have to change every single one of them, but it is automated, so that won't be too bad.
Thinking about this for a second longer, in this case the calling code is the problem. The function REFPROPdll
expects a scalar input for a
, and you actually provided an array with one entry, which is not the same thing, so on your side, you should call float(a)
before passing to the function
Thanks! Probably you are right, but the function REFPROP2dll is called hundreds of times via a different function. I checked many places, but there were always scalars. Along errors one sees the whole chain of function calls leading to the error. For warnings this is not the case. Do you have an idea of how to find the "bad" code line(s)? If not, I will wait until it is treared as an error ....
Thanks again!
Yes, you can use the warnings
module in Python to turn warnings into errors, at which point you'll get the backtrace: https://docs.python.org/3/library/warnings.html#overriding-the-default-filter where you would change the "ignore"
to "error"
. That should help you track it down.
Dear Ian, recently I get the following warning from the version I installed using pip (from PyPi):
... \Lib\site-packages\ctREFPROP\ctREFPROP.py:2496: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)
You may want to change this?
Thanks a lot!
My best regards,
Burak