Skip to main content

calculateOrganicMatterBalanceForFarms

@nmi-agro/fdm-source


@nmi-agro/fdm-source / fdm-calculator/src / calculateOrganicMatterBalanceForFarms

Function: calculateOrganicMatterBalanceForFarms()

calculateOrganicMatterBalanceForFarms(fdm, inputs): Promise<OrganicMatterBalanceNumeric>

Defined in: fdm-calculator/src/balance/organic-matter/index.ts:65

Calculates the organic matter balance for multiple farms, aggregating results from all its fields.

This function serves as the main entry point for the organic matter balance calculation. It takes a comprehensive set of input data for a farm, processes each field in batches to calculate its individual balance, and then aggregates these results into farm-level balances. The final output is a numeric representation of the balance, suitable for display or further analysis.

Parameters

fdm

FdmType

The FDM instance for database access (caching).

inputs

OrganicMatterBalanceInput & object[]

The complete dataset required for the calculation, including all fields, fertilizer catalogues, and cultivation catalogues for the farm.

Returns

Promise<OrganicMatterBalanceNumeric>

A promise that resolves to the aggregated OrganicMatterBalanceNumeric object for the farm.

Throws

Throws an error if the calculation process fails for any reason.