Skip to main content

findHoofdteelt

@nmi-agro/fdm-source


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

Function: findHoofdteelt()

findHoofdteelt(cultivations, year): string

Defined in: fdm-calculator/src/shared/hoofdteelt.ts:33

Finds the main cultivation ('hoofdteelt') for a given year using the legal Dutch definition: the cultivation present for the longest duration within the period May 15–July 15 of that year.

In case of a tie in duration, the cultivation with the alphabetically first b_lu_catalogue is chosen.

Cultivations without a b_lu_start are skipped. A missing b_lu_end is treated as still being present through the end of the window (July 15).

Parameters

cultivations

CultivationForHoofdteelt[]

List of cultivations to evaluate.

year

number

The calendar year to evaluate.

Returns

string

The b_lu_catalogue of the hoofdteelt, or GROENE_BRAAK ("nl_6794") if no cultivation overlaps with the May 15–July 15 window.