def correctLevel1Registrations(self, name, date):
        """
    Corrects for level 1 registration overestimations. Returns the scaling factor
    """

        hindex = self._find_headerindex(name)
        days = DataTable.subtract_dates(date, self.start_date)
        ref_table = self.data_table[hindex]

        for i in range(0, len(ref_table)):
            if (int(ref_table[i][0]) == int(days)):
                # then scale all previous entries by ref_table[i][1]/ref_table[i-1][1]
                if i > 0:
                    first_level_2_value = ref_table[i, 1]
                    last_level_1_value = ref_table[i - 1, 1]
                    #print(days, i, ref_table[0:i,1])
                    ref_table[0:i,
                              1] *= first_level_2_value / last_level_1_value
                    #print(first_level_2_value, last_level_1_value, ref_table[0:i,1])

        return first_level_2_value / last_level_1_value
Example #2
0
def date_to_sim_days(date):
    return DataTable.subtract_dates(date, "2015-05-01")
Example #3
0
def date_to_sim_days(date):
    return DataTable.subtract_dates(date, "2013-12-15")
Example #4
0
def date_to_sim_days(date):
    return DataTable.subtract_dates(date, "2012-02-29")
Example #5
0
def date_to_sim_days(date):
    return DataTable.subtract_dates(date, start_date)
from flee import flee
from datamanager import handle_refugee_data
from datamanager import DataTable
import numpy as np
import outputanalysis.analysis as a
import sys
"""
calc_date_difference.py
Calculates the number of days between two dates.

Usage python3 calc_date_difference.py <YYYY-MM-DD earlier date> <YYYY-MM-DD later date>

"""

if __name__ == "__main__":
    print(DataTable.subtract_dates(sys.argv[2], sys.argv[1]))