polaris.mesh.spherical.unified.effective_ocean.variable_box_average

polaris.mesh.spherical.unified.effective_ocean.variable_box_average(frac, lat, resolution, width_km, max_window=720)[source]

Box-average a fraction over a local window of width_km, emulating the conservative area fraction on mesh-scale cells.

The width field is quantized into geometric bins; each bin gets a separable box filter (nearest at the latitude boundaries, periodic in longitude) whose longitude window grows as 1/cos(latitude).

Parameters:
  • frac (numpy.ndarray) – The fraction to average, with dimensions (lat, lon)

  • lat (numpy.ndarray) – The latitude coordinate in degrees

  • resolution (float) – The grid resolution in degrees

  • width_km (numpy.ndarray) – The local averaging width in km on the same grid

  • max_window (int, optional) – The maximum longitude window in grid cells (limits cost near the poles)

Returns:

averaged (numpy.ndarray) – The locally averaged fraction