-
Notifications
You must be signed in to change notification settings - Fork 446
Open
Labels
Type: FeatureNew functionalityNew functionality
Description
What should we add?
I've been developing an application that works with gridded data. The metpy.calc.thermo module has been a great guide for my work thus far.
My moist_lapse function differs from metpy.calc.thermo.moist_lapse and is written in Cython, that seemed to be one of the major bottlenecks the vectorizing things for gridded data support.
I currently have implementations of the moist_lapse, wet_bulb_temperature, parcel_profile, ccl, and downdraft_cape that support 2d: (N, Z) array structure.
My implementations don't use pint, everything is assumed si units. Let me know if there is any interest I'm happy to share.
pressure = isobaric_levels()
(temperature, specific_humidity), shape = get_values(["temperatureair", "humidityspecific"])
dewpoint = thermo.dewpoint_from_specific_humidity(pressure[newaxis, :], specific_humidity)
dcape = thermo.downdraft_cape(pressure, temperature, dewpoint)
dcape = dcape.reshape((-1,) + shape[2:])
fig, axes = plt.subplots(1, dcape.shape[0])
fig.tight_layout()
fig.suptitle("dcape", fontsize=16, x=0.5, y=0.65)
for i, ax in enumerate(axes):
ax.imshow(dcape[i, :, :], cmap="coolwarm")T = temperature[::2500]
Td = dewpoint[::2500]
my_dcape = thermo.downdraft_cape(
pressure=pressure,
temperature=T,
dewpoint=Td,
)
mp_dcape = np.array(
[
mpcalc.downdraft_cape(pressure * units.pascal, T[i] * units.kelvin, Td[i] * units.kelvin)[0].m
for i in range(T.shape[0])
]
)
delta = np.abs(my_dcape - mp_dcape)
print(f"{delta.max() = } {delta.mean() = } {delta.std() = }")delta.max() = 0.6819282354549614 delta.mean() = 0.1615940182263646 delta.std() = 0.13604876693905152
Reference
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Type: FeatureNew functionalityNew functionality
