[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[python #GAF-878612]: Problem in the metpy bulk shear calculation function


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,


> Hello,
> 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.
> <goog_635079440>
> I uploaded the script I'm using to plot these skewts on the google drive
> (link below), in addition, I also added some images:
> skewt_wrf_00z_*1*.png
> skewt_wrf_00z_*3*.png
> skewt_wrf_00z_*4*.png
> skewt_wrf_00z_*6*.png
> 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.
> <goog_635079440>
> https://drive.google.com/drive/folders/1gQZQTwpV0zW2YzWVo1_chSY0WqyHwbTw?usp=sharing

Ticket Details
Ticket ID: GAF-878612
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.