agrifoodpy.utils.scaling

Scaling utilities module

Functions

logistic_scale(y0, y1, y2, y3, c_init, c_end)

Create an xarray DataArray with a logistic growth interval

linear_scale(y0, y1, y2, y3, c_init, c_end)

Create an xarray DataArray with a single coordinate called 'year'.

Module Contents

agrifoodpy.utils.scaling.logistic_scale(y0, y1, y2, y3, c_init, c_end)

Create an xarray DataArray with a logistic growth interval

Parameters:
  • y0 – (int) The initial year.

  • y1 – (int) The year when the values start to transition.

  • y2 – (int) The year when the transition completes.

  • y3 – (int) The final year.

  • c_init – (float) The initial constant value.

  • c_end – (float) The final constant value.

Returns: xarray DataArray

An xarray DataArray object with ‘year’ as the coordinate and values set by a logistic growth between the user defined intervals.

agrifoodpy.utils.scaling.linear_scale(y0, y1, y2, y3, c_init, c_end)

Create an xarray DataArray with a single coordinate called ‘year’.

The values from the first year ‘y0’ up to a given year ‘y1’ will be constant, then they will vary linearly between ‘y1’ and another given year ‘y2’, and from ‘y2’ until the end of the array ‘y3’, the values will continue with a constant value.

Parameters:
  • y0 – (int) Starting year.

  • y1 – (int) Year where the linear variation starts.

  • y2 – (int) Year where the linear variation ends.

  • y3 – (int) Last year in the array.

  • c_init – (float) Value to use for initial constant scale segment.

  • c_end – (float)

Returns: xr.DataArray

An xarray DataArray object with ‘year’ as the coordinate and values set by a linear growth between the user defined intervals.