NUmpy

Christian Gollwitzer auriocus at gmx.de
Wed Sep 29 13:27:32 EDT 2021


Am 29.09.21 um 18:16 schrieb Jorge Conforte:
> 
> 
> Hi,
> 
> I have a netcdf file "uwnd_850_1981.nc" and I'm using the commands to 
> read it:

Your code is incomplete:
> from numpy import dtype
>   fileu ='uwnd_850_1981.nc'
> ncu = Dataset(fileu,'r')

Where is "Dataset" defined?

> uwnd=ncu.variables['uwnd'][:]
> 
> 
> and I had:
> 
> <stdin>:1: DeprecationWarning: `np.bool` is a deprecated alias for the 
> builtin `bool`. To silence this warning, use `bool` by itself. Doing 
> this will not modify any behavior and is safe. If you specifically 
> wanted the numpy scalar type, use `np.bool_` here.
> Deprecated in NumPy 1.20; for more details and guidance: 
> https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
> 
> I didn't how I have this message. My numpy verison is 1.21.2.
> 
> 
> Please, how can I solve this.

First, it is only a warning, therefore it should still work. Second, the 
problem is not in the code that you posted. POssibly in the definition 
of "Dataset". Maybe the netCDF-File contains boolean values and the 
package you use to read it should be updated?

	Christian


More information about the Python-list mailing list