Skip to content

Calculating temperature advection from ERA5 data #2372

Discussion options

You must be logged in to vote

MetPy 1.0 changed to more natively work with xarray data and eliminate the dim_order argument. The upshot of all of that is you should be able to do:

data = xr.open_dataset('/home/nazimur/Downloads/Data/Storm of the Century/nonamestorm.nc').sel(time=data.time[0])

t850 = mpcalc.smooth_gaussian(data.t.sel(level=data.level[2]), n=6)
u850 = mpcalc.smooth_gaussian(data.u.sel(level=data.level[2]), n=6)
v850 = mpcalc.smooth_gaussian(data.v.sel(level=data.level[2]), n=6)

temp_adv_850 = mpcalc.advection(t850, u=u850, v=v850).metpy.convert_units('degC/s')

MetPy has smooth_gaussian which wraps gaussian_filter, but using an n of 6 should be close to what you had before. Going that way lets MetPy ha…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@nazimurrashidchy
Comment options

@dopplershift
Comment options

@nazimurrashidchy
Comment options

@DanielAdriaansen
Comment options

Answer selected by nazimurrashidchy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants