mxs_average

../../_images/MXAVERAGE.png

Derives (and returns) a vertical average cross section data unit of upper air fields in GRIB format. For each upper air field, this average is taken along the North-South or East-West direction over a specified rectangular area and then interpolated horizontally along the direction perpendicular to the averaging direction with a spacing consistent with the resolution of the input GRIB data.

The average cross section data can be plotted (using a default visualisation and with the plot area based on the range of data values) or saved as a NetCDF data file (NetCDF) using write().

If access to the output computed values is not required, or for more control of the plotting, use maverageview().

Note

This function performs the same task as the Average Data icon in Metview’s user interface. It accepts its parameters as keyword arguments, described below.

mxs_average(**kwargs)

Derives (and returns) vertical average cross section data.

Parameters
  • data (str) – Specifies the GRIB data from which to derive the average view data. The input GRIB must specify a multi-level (pressure or model levels) upper air meteorological variable, in a latitude-longitude or Gaussian grid. If the input data is specified in model levels, you must include a Logarithm Of Surface Pressure (LNSP) field should you want the vertical axis of the plot in pressure levels rather than model levels when visualising the output. Note that the input fields should be on the same grid. If more than one time and/or forecast step is contained in data, it returns a set of average cross sections in the resulting data, but note that currently only the first of these will be plotted with plot().

  • area (list[number], default: [90, -180, -90, 180]) – Specifies the coordinates of the area (as [North, West, South, East]) over which the averages are calculated.

  • direction ({"ns", "ew"}, default: "ns") – Specifies the direction along which the averaging of the variable is performed. Options are “ns” (North-South) and “ew” (East-West). For “ns”, the averaging is weighted by the cosine of latitude.

Return type

NetCDF