Post Averaging

pysammos.post_averaging package

Subpackage for averaging slices of the results after the Coarse Graining process to obtain profiles in any dimension.

Profiles module

pysammos.post_averaging.profiles

This module provides functionality to perform vertical integration of variables in an xarray.Dataset along a specified profile dimension (x, y, or z). The integration is done by grouping data points based on their coordinate values along the profile dimension and summing the values of variables that have a 'point' dimension. The summed values are then normalized by an area element factor calculated from the spacing and extent of the other two spatial dimensions.

This module contains the VerticalIntegrator class with methods to:
  • get_position_data() to extract position data for the specified profile dimension.

  • get_area_factor() to calculate the area element factor for normalization.

  • integration() to perform the vertical integration of relevant variables in the dataset.

class pysammos.post_averaging.profiles.VerticalIntegrator(ds, profile_dim)[source]

Bases: object

get_area_factor()[source]

Calculate area element factor for normalization.

Inputs

coords_1xarray.DataArray

First coordinate array of coarse-grained data.

coords_2xarray.DataArray

Second coordinate array of coarse-grained data.

Outputs

area_elementfloat

Area element factor for normalization.

get_position_data()[source]
integration()[source]

Integrate all variables with a 'point' dimension by grouping along the y coordinate (either exact values or bins) and summing over the grouped 'point's, then multiply by area.

Return type:

Dataset

Inputs

dsxr.Dataset

Input dataset containing variables, some of which have a 'point' dim.

area_elementfloat

Area element to multiply the integrated sums by.

profile_dimstr

Name of the profile dimension (e.g., 'y', 'z', 'x').

Outputs

xr.Dataset

Dataset with variables (those that had 'point') integrated over vertical groups. Group dimension will be 'y' (exact).