[python #GAF-878612]: Problem in the metpy bulk shear calculation function
- Subject: [python #GAF-878612]: Problem in the metpy bulk shear calculation function
- Date: Sun, 22 Nov 2020 17:59:26 -0700
Apologies for the delayed response, this was a string issue to track down. In
the end, it's a weird bug involving the 32-bit floating point values coming out
of the netCDF file. This will be fixed in the impending MetPy 1.0 release. In
the meanwhile, you can work around the problem by tweaking your calls to e.g.
bulk_shear to pass in 64-bit floating point values:
mpcalc.bulk_shear(s_p.astype(np.float64), s_u, s_v, depth=1000 *
Hope this helps,
> I am facing some problems with the metpy function of calculating the
> magnitude and direction of bulk shear both 0-1 and 0-6 km. In some moments
> the function correctly calculates the values, but in other moments it does
> not calculate and appears as "nan", I tried everything and I couldn't solve
> the problem. Can someone help me? I am using this function to calculate the
> skewt of the WRF.
> I uploaded the script I'm using to plot these skewts on the google drive
> (link below), in addition, I also added some images:
> Where you can see this problem. At other times there is no problem with
> bulk shear.
> The gross outputs (netcdf) of the WRF referring to these images I also
> uploaded on the google drive in the file WRFout.tar.gz. If you download the
> files and unzip, just run the skewt_wrf.py script that will plot the skewts.
Ticket ID: GAF-878612
Department: Support Python
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.