1

I have calculated the Moist Brunt-Vaisala frequency. Let's say that the variable is moistb and has a dimension of [height, lat, lon].

I would like to plot the horizontal distribution of the total depth of the moistb. How do I calculate the total depth? The idea is to sum all the depth of moistb in each grid point. Is there a way to do this with metpy?

For reference, here's an example as shown by Schumacher and Johnson (2008) where they plot the horizontal distribution of total depth (m).

DopplerShift
  • 5,472
  • 1
  • 21
  • 20
kiyas
  • 145
  • 10

1 Answers1

1

It sounds like in this case that you're working with data stored in an Xarray DataArray. If so, the way to do what you're looking for is:

moistb.sum(dim='height')

You can also do this with regular numpy arrays (or a DataArray) by using the axis argument, which corresponds to the number of the dimension in order. So for the order listed above this would be:

moistb.sum(axis=0)

For more information see the Xarray docs or the Numpy docs.

DopplerShift
  • 5,472
  • 1
  • 21
  • 20