I want to used metpy.calc.vorticity
. Previously, its structure was (u, v, dx, dy)
, but change to (u, v, *, dx=None, dy=None, x_dim=- 1, y_dim=- 2)
.
- What is
*
at the new structure? - When I use
(u, v)
, it seems other arguments are optional, I facedValueError: Must provide dx/dy arguments or input DataArray with latitude/longitude coordinates.
- When I used
(u , v, dx, dy)
, I facedTypeError: too many positional arguments
.
However, I don't have problem with geostrophic_wind(height,dx,dy,latitude)
in my code and my data, but what is the problem with vorticity?
Some parts of my code is as below:
PATH_nc = '/home/python_script/'
out_fff='gfs.t12z.pgrb2.0p50.f168'
ncfile = Dataset('{}{}.nc'.format(PATH_nc,out_fff))
lon = ncfile.variables['longitude'][:]
lon[lon < 0] = 360 + lon[lon < 0]
lat = ncfile.variables['latitude'][:]
dx, dy = mpcalc.lat_lon_grid_deltas(lon, lat)
long1, lat1 = np.meshgrid(lon, lat)
hght_850 = ncfile.variables['HGT_850mb'][:]
HGT_850 = gaussian_filter((hght_850)/10, sigma= 2)
height850 = ndimage.gaussian_filter(hght_850, sigma=1.5, order=0)
geo_wind_u_850, geo_wind_v_850 = mpcalc.geostrophic_wind(np.squeeze(height850)*units.m, dx, dy, lat1)
vwnd_700 = units('m/s') *ncfile.variables['VGRD_700mb'][:]
avor700 = mpcalc.vorticity(np.squeeze(uwnd_700), np.squeeze(vwnd_700), dx, dy)
I hope to write all necessary parts of my code, related to the problem. I'll be thankful for any help.