xarray.Dataset.traj.concentration#

Dataset.traj.concentration(grid, weights=None)#

Calculate concentration of elements on a provided grid

Parameters:
  • grid (Dataset) – A grid Dataset, as returned from trajan.make_grid

  • weights (string) – If provided, the concentration weighted with this variable will also be calculated

Returns:

Dataset

The same grid Xarray Dataset as input, with the following variables added:
  • number: the number of elements within each grid cell

  • number_area_concentration: the number of elements per area of each grid cell (only if grid does not contain z)

  • number_volume_concentration: the number of elements per volume of each grid cell (only if grid does not contain z)

  • <weights>_sum: the sum of property <weights> within each grid cell

  • <weights>_mean: the mean of property <weights> within each grid cell

  • <weights>_area_concentration: the concentration of <weights> per area of each grid cell (only if grid does not contain z)

  • <weights>_volume_concentration: the volume concentration of <weights> per volume of each grid cell (only if grid contains z)