<commit_before># -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division

"""
Imported from CalcLoads.bas
"""

import logging

import numpy as np


log = logging.getLogger(__name__)


def CalculateLoads(z, Y):
    log.debug('CalculateLoads')

    PrecipitationTotal = 0
    RunoffTotal = 0
    GroundWatLETotal = np.zeros(z.WxYrs)
    EvapotransTotal = 0
    PtSrcFlowTotal = 0
    WithdrawalTotal = 0
    StreamFlowTotal = 0
    SedYieldTotal = 0
    ErosionTotal = 0
    DisNitrTotal = 0
    DisPhosTotal = 0
    TotNitrTotal = 0
    TotPhosTotal = 0
    AnimalFCTotal = 0
    WWOrgsTotal = 0
    SSOrgsTotal = 0
    UrbOrgsTotal = 0
    WildOrgsTotal = 0
    TotalOrgsTotal = 0
    CMStreamTotal = 0
    OrgConcTotal = 0

    # CALCULATE THE MONTHLY WATER BALANCE FOR STREAM Flow FOR EACH YEAR OF THE ANALYSIS
    for i in range(12):
        z.StreamFlow[Y][i] = (z.Runoff[Y][i]
                              + z.GroundWatLE[Y][i]
                              + z.PtSrcFlow[Y][i]
                              + z.TileDrain[Y][i]
                              - z.Withdrawal[Y][i])

        z.StreamFlowLE[Y][i] = z.StreamFlow[Y][i]
        if z.StreamFlowLE[Y][i] < 0:
            z.StreamFlowLE[Y][i] = 0

    # ANNUAL WATER BALANCE CALCULATIONS
    for i in range(12):
        # Calculate landuse runoff for rural areas
        for l in range(z.NRur):
            z.LuRunoff[Y][l] += z.RurQRunoff[l][i]

        # Calculate landuse runoff for urban areas
        for l in range(z.NRur, z.NLU):
            z.LuRunoff[Y][l] += z.UrbQRunoff[l][i]

        PrecipitationTotal += z.Precipitation[Y][i]
        RunoffTotal += z.Runoff[Y][i]
        GroundWatLETotal += z.GroundWatLE[Y][i]
        EvapotransTotal += z.Evapotrans[Y][i]
        PtSrcFlowTotal += z.PtSrcFlow[Y][i]
        WithdrawalTotal += z.Withdrawal[Y][i]
        StreamFlowTotal += z.StreamFlow[Y][i]

    # CALCULATE ANNUAL NITROGEN  LOADS FROM NORMAL SEPTIC SYSTEMS
    AnNormNitr = 0
    for i in range(12):
        AnNormNitr += z.MonthNormNitr[i] * z.NumNormalSys[i]

    z.CalendarYr = z.WxYrBeg + (Y - 1)

    # SEDIMENT YIELD AND TILE DRAINAGE
    for i in range(12):
        z.BSed[i] = 0
        for m in range(i, 12):
            z.BSed[i] += z.SedTrans[Y][m]
        for m in range(i):
            if z.BSed[m] > 0:
                z.SedYield[Y][i] += z.Erosion[Y][m] / z.BSed[m]

        z.SedYield[Y][i] = z.SedDelivRatio * z.SedTrans[Y][i] * z.SedYield[Y][i]
        SedYieldTotal += z.SedYield[Y][i]
        ErosionTotal += z.Erosion[Y][i]
<commit_msg>Include all prior months in SedYield initialization<commit_after># -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division

"""
Imported from CalcLoads.bas
"""

import logging

import numpy as np


log = logging.getLogger(__name__)


def CalculateLoads(z, Y):
    log.debug('CalculateLoads')

    PrecipitationTotal = 0
    RunoffTotal = 0
    GroundWatLETotal = np.zeros(z.WxYrs)
    EvapotransTotal = 0
    PtSrcFlowTotal = 0
    WithdrawalTotal = 0
    StreamFlowTotal = 0
    SedYieldTotal = 0
    ErosionTotal = 0
    DisNitrTotal = 0
    DisPhosTotal = 0
    TotNitrTotal = 0
    TotPhosTotal = 0
    AnimalFCTotal = 0
    WWOrgsTotal = 0
    SSOrgsTotal = 0
    UrbOrgsTotal = 0
    WildOrgsTotal = 0
    TotalOrgsTotal = 0
    CMStreamTotal = 0
    OrgConcTotal = 0

    # CALCULATE THE MONTHLY WATER BALANCE FOR STREAM Flow FOR EACH YEAR OF THE ANALYSIS
    for i in range(12):
        z.StreamFlow[Y][i] = (z.Runoff[Y][i]
                              + z.GroundWatLE[Y][i]
                              + z.PtSrcFlow[Y][i]
                              + z.TileDrain[Y][i]
                              - z.Withdrawal[Y][i])

        z.StreamFlowLE[Y][i] = z.StreamFlow[Y][i]
        if z.StreamFlowLE[Y][i] < 0:
            z.StreamFlowLE[Y][i] = 0

    # ANNUAL WATER BALANCE CALCULATIONS
    for i in range(12):
        # Calculate landuse runoff for rural areas
        for l in range(z.NRur):
            z.LuRunoff[Y][l] += z.RurQRunoff[l][i]

        # Calculate landuse runoff for urban areas
        for l in range(z.NRur, z.NLU):
            z.LuRunoff[Y][l] += z.UrbQRunoff[l][i]

        PrecipitationTotal += z.Precipitation[Y][i]
        RunoffTotal += z.Runoff[Y][i]
        GroundWatLETotal += z.GroundWatLE[Y][i]
        EvapotransTotal += z.Evapotrans[Y][i]
        PtSrcFlowTotal += z.PtSrcFlow[Y][i]
        WithdrawalTotal += z.Withdrawal[Y][i]
        StreamFlowTotal += z.StreamFlow[Y][i]

    # CALCULATE ANNUAL NITROGEN  LOADS FROM NORMAL SEPTIC SYSTEMS
    AnNormNitr = 0
    for i in range(12):
        AnNormNitr += z.MonthNormNitr[i] * z.NumNormalSys[i]

    z.CalendarYr = z.WxYrBeg + (Y - 1)

    # SEDIMENT YIELD AND TILE DRAINAGE
    for i in range(12):
        z.BSed[i] = 0
        for m in range(i, 12):
            z.BSed[i] += z.SedTrans[Y][m]
        for m in range(i + 1):
            if z.BSed[m] > 0:
                z.SedYield[Y][i] += z.Erosion[Y][m] / z.BSed[m]

        z.SedYield[Y][i] = z.SedDelivRatio * z.SedTrans[Y][i] * z.SedYield[Y][i]
        SedYieldTotal += z.SedYield[Y][i]
        ErosionTotal += z.Erosion[Y][i]

{'fraction_non_alphanumeric': 0.11812665908229047, 'fraction_numerical': 0.01422070534698521, 'mean_word_length': 2.1380130874479475, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3664524', 'n_tokens_mistral': 2120, 'n_tokens_neox': 1984, 'n_words': 421}