Skip to content

NK-fertiliser high-pH NH3 EF uses wrong list index (7=MAP instead of 8=NK) (SALCAfield_field.py:829-830) #4

Description

@mklarmann

Hi team — small index typo in the mineral-fertiliser NH3 emission factors.

The fertiliser list is documented as 0-indexed (SALCAfield/SALCAfield_field.py:787-799): 0=AS, 1=AN, 2=CAN, 3=AH, 4=UREA, 5=UAN, 6=DAP, 7=MAP, 8=NK, 9=NPK, 10=UAS.

Every ef_* pair (lines 817-832) uses the same index on both the low-pH and high-pH lists — except the NK factor:

829  ef_nk_kgNH3_NpkgN = (interpolation_factor*list_low_pH_kgNH3_NpkgN[8]
830                       + (1-interpolation_factor)*list_high_pH_kgNH3_NpkgN[7])

The low-pH term correctly uses index 8 (NK), but the high-pH term uses index 7 (MAP). This is the only mismatched pair in the block, which strongly suggests a typo of 7 for 8.

Why it's a bug: for NK fertilisers at higher soil pH (fi_pH > 5.5), the high-pH contribution to the NH3 emission factor is taken from MAP instead of NK, producing the wrong EF.

One-line fix:

ef_nk_kgNH3_NpkgN = (interpolation_factor*list_low_pH_kgNH3_NpkgN[8]
                     + (1-interpolation_factor)*list_high_pH_kgNH3_NpkgN[8])

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions