This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
Hi, and thanks for reaching out! Right now, most of MetPy's iterative vertical calculations (profile calculations, layer depths, etc.) must be limited to use on 1-dimensional profiles. Looping across large grids for these calculations can be done, but can cost time or computation resources. An example: import xarray as xr from metpy.calc import dewpoint_from_relative_humidity, showalter_index from metpy.cbook import get_test_data from metpy.units import units ds = xr.open_dataset(get_test_data("NAM_test.nc", False)) ds["Dewpoint_isobaric"] = dewpoint_from_relative_humidity( ds["Temperature_isobaric"], ds["Relative_humidity_isobaric"]) showalter_indices = [] for x in ds.x: for y in ds.y: column = ds.sel(x=x, y=y) si = showalter_index(column["isobaric"], column["Temperature_isobaric"].squeeze(), column["Dewpoint_isobaric"].squeeze()) da = xr.DataArray(si, dims=["time"], coords={"time": column.time, "y": column.y, "x": column.x}) da = da.expand_dims(["y", "x"]) showalter_indices.append(da) xr.combine_by_coords(showalter_indices) And there are some tools in xarray like `apply_ufunc` and `map_blocks` that can somewhat parallelize this for you with dask (https://docs.xarray.dev/en/stable/user-guide/dask.html#automatic-parallelization-with-apply-ufunc-and-map-blocks). I may be able to throw together some example code for this in the future. As part of funded NSF grant work, we have high priority efforts to speed up our profile calculations and explore making more of our calculation suite grid-friendly. In the mean time, I hope this helps! Let me know if I can provide any further help. All the best, Drew > I appreciate using this package. > Now, i have a question when I use this package to calculate the > showalter index, I found that I could only count single points. But I want > to calculate the array, it seems that this package does not support, is > there a good way. I wish I could get a little help > Ticket Details =================== Ticket ID: OCF-850030 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.