This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
Hi, With the update to your environment, I'm guessing pint was updated, which causes some issues with masked arrays. Try this, which changes to multiply units on the left: u_500 = units('m/s') * file.variables['ugrdprs'][start_hrs:num_hrs,12,iy1:iy2,ix1:ix2] Ryan > Hello, > > My Anaconda Environment at work was completely updated. Since then I get > the following error on a script that previously worked, and works at home. > A version change of some package appears to be causing an issue with > units. > > Is this something you recognize? I am using MetPy 0.12.0. > > Thanks, ]> > File "U:\p_scripts\gfs\gfs_svroutlk_nomad.py", line 191, in <module> > u_500 = file.variables['ugrdprs'][start_hrs:num_hrs,12,iy1:iy2,ix1:ix2] > * units.meter / units.second #12 for 500 > > File > "C:\Users\steven.piltz\Anaconda3\lib\site-packages\numpy\ma\core.py", line > 4157, in __truediv__ > return true_divide(self, other) > > File > "C:\Users\steven.piltz\Anaconda3\lib\site-packages\numpy\ma\core.py", line > 1171, in __call__ > m = ~umath.isfinite(result) > > TypeError: ufunc 'isfinite' not supported for the input types, and the > inputs could not be safely coerced to any supported types according to the > casting rule ''safe'' Ticket Details =================== Ticket ID: CRW-777842 Department: Support Python Priority: Low Status: Closed =================== NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly available through the web. If you do not want to have your interactions made available in this way, you must let us know in each email you send to us.