timba-link 1.0.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. linking_pipeline/__init__.py +0 -0
  2. linking_pipeline/cli/__init__.py +0 -0
  3. linking_pipeline/cli/cli.py +112 -0
  4. linking_pipeline/data/input/cge_data/default_cge_FOREST.csv +25 -0
  5. linking_pipeline/data/input/cge_data/default_cge_GDP.csv +25 -0
  6. linking_pipeline/data/input/supportive_data/POP_MAGNET_data.csv +26 -0
  7. linking_pipeline/data/input/supportive_data/country_concordance.xlsx +0 -0
  8. linking_pipeline/data/input/supportive_data/default_cge_POP.csv +26 -0
  9. linking_pipeline/data/input/supportive_data/fra_data.csv +237 -0
  10. linking_pipeline/data/input/supportive_data/oecd_data.xlsx +0 -0
  11. linking_pipeline/data/input/supportive_data/worldbank_data.xlsx +0 -0
  12. linking_pipeline/data/input/supportive_data/worldbank_data_2025.xlsx +0 -0
  13. linking_pipeline/data/input/supportive_data/worldbank_oecd_countries.xlsx +0 -0
  14. linking_pipeline/data/input/timba_data/default_timba_scenario_input.xlsx +0 -0
  15. linking_pipeline/data/input/timba_data/default_timba_scenario_output.pkl +0 -0
  16. linking_pipeline/helper_functions/__init__.py +0 -0
  17. linking_pipeline/helper_functions/base_logger.py +52 -0
  18. linking_pipeline/logic/__init__.py +0 -0
  19. linking_pipeline/logic/aggregation_pipeline.py +1168 -0
  20. linking_pipeline/logic/calibration_pipeline.py +213 -0
  21. linking_pipeline/logic/disaggregation_pipeline.py +805 -0
  22. linking_pipeline/logic/pipeline_helpers.py +0 -0
  23. linking_pipeline/logic/run_timba_pipeline.py +80 -0
  24. linking_pipeline/main.py +80 -0
  25. linking_pipeline/parameters/REGEX_patterns.py +3 -0
  26. linking_pipeline/parameters/__init__.py +0 -0
  27. linking_pipeline/parameters/default_parameters.py +35 -0
  28. linking_pipeline/parameters/defines.py +64 -0
  29. linking_pipeline/parameters/paths.py +47 -0
  30. tests/__init__.py +0 -0
  31. tests/integration/__init__.py +0 -0
  32. tests/integration/test_timba_link.py +61 -0
  33. tests/unit/__init__.py +0 -0
  34. tests/unit/test_cli.py +91 -0
  35. tests/unit/test_imports.py +25 -0
  36. timba_link-1.0.4.dist-info/COPYING +661 -0
  37. timba_link-1.0.4.dist-info/METADATA +281 -0
  38. timba_link-1.0.4.dist-info/RECORD +42 -0
  39. timba_link-1.0.4.dist-info/WHEEL +5 -0
  40. timba_link-1.0.4.dist-info/entry_points.txt +2 -0
  41. timba_link-1.0.4.dist-info/top_level.txt +2 -0
  42. timba_link-1.0.4.dist-info/zip-safe +1 -0
File without changes
File without changes
@@ -0,0 +1,112 @@
1
+ import click
2
+ from linking_pipeline.main import TiMBALink
3
+ from linking_pipeline.parameters.defines import VarNames
4
+ from linking_pipeline.parameters.default_parameters import project_parameters
5
+
6
+
7
+ @click.group()
8
+ def cli():
9
+ pass
10
+
11
+
12
+ @cli.command("run")
13
+ @click.option(
14
+ '-SC', '--current_scenario',
15
+ default=project_parameters[VarNames.CURRENT_SC.value],
16
+ show_default=True,
17
+ required=True,
18
+ type=str,
19
+ help="Current scenario name."
20
+ )
21
+ @click.option(
22
+ '-LT', '--link_type',
23
+ default=project_parameters[VarNames.LINK_TYPE.value],
24
+ show_default=True,
25
+ required=True,
26
+ type=str,
27
+ help="Linkage type (options: `continuous` or `end_point`)."
28
+ )
29
+ @click.option(
30
+ '-LM', '--linked_CGE',
31
+ default=project_parameters[VarNames.LINKED_CGE.value],
32
+ show_default=True,
33
+ required=True,
34
+ type=str,
35
+ help="Linked CGE (options: `MAGNET` or `DART-BIO`)."
36
+ )
37
+ @click.option(
38
+ '-P', '--project',
39
+ default=project_parameters[VarNames.PROJECT.value],
40
+ show_default=True,
41
+ required=True,
42
+ type=str,
43
+ help="Current project name (options: `default_project` or own project name)."
44
+ )
45
+ @click.option(
46
+ '-IN', '--iter_num',
47
+ default=project_parameters[VarNames.ITER_NUM.value],
48
+ show_default=True,
49
+ required=True,
50
+ type=int,
51
+ help="Current iteration number."
52
+ )
53
+ @click.option(
54
+ '-AS', '--aggregation_switch',
55
+ default=project_parameters[VarNames.AGGREGATION_SWITCH.value],
56
+ show_default=True,
57
+ required=True,
58
+ type=click.BOOL,
59
+ help="Switch for aggregation pipeline."
60
+ )
61
+ @click.option(
62
+ '-DS', '--disaggregation_switch',
63
+ default=project_parameters[VarNames.DISAGGREGATION_SWITCH.value],
64
+ show_default=True,
65
+ required=True,
66
+ type=click.BOOL,
67
+ help="Switch for disaggregation pipeline."
68
+ )
69
+ @click.option(
70
+ '-TS', '--run_timba_switch',
71
+ default=project_parameters[VarNames.RUN_TIMBA_SWITCH.value],
72
+ show_default=True,
73
+ required=True,
74
+ type=click.BOOL,
75
+ help="Switch for running TiMBA."
76
+ )
77
+ def timba_link_cli(
78
+ current_scenario: str,
79
+ link_type: str,
80
+ linked_cge: str,
81
+ project: str,
82
+ iter_num: int,
83
+ aggregation_switch: bool,
84
+ disaggregation_switch: bool,
85
+ run_timba_switch: bool,
86
+ ):
87
+ """
88
+ Starts TiMBA_Link with defined cli project parameters
89
+ :param current_scenario: Current scenario name
90
+ :param link_type: Type of link
91
+ :param linked_cge: Linked CGE
92
+ :param project: Current project name
93
+ :param iter_num: Current iteration number
94
+ :param aggregation_switch: Switch for aggregation pipeline
95
+ :param disaggregation_switch: Switch for disaggregation pipeline
96
+ :param run_timba_switch: Switch for running timba
97
+ """
98
+ project_parameters_cli = {
99
+ VarNames.CURRENT_SC.value: current_scenario,
100
+ VarNames.LINK_TYPE.value: link_type,
101
+ VarNames.LINKED_CGE.value: linked_cge,
102
+ VarNames.PROJECT.value: project,
103
+ VarNames.ITER_NUM.value: iter_num,
104
+ VarNames.AGGREGATION_SWITCH.value: aggregation_switch,
105
+ VarNames.DISAGGREGATION_SWITCH.value: disaggregation_switch,
106
+ VarNames.RUN_TIMBA_SWITCH.value: run_timba_switch,
107
+ VarNames.CALIBRATION_SWITCH.value: project_parameters[VarNames.CALIBRATION_SWITCH.value],
108
+ VarNames.DETAILED_LOGGER.value: project_parameters[VarNames.DETAILED_LOGGER.value]
109
+ }
110
+ timba_link_cli = TiMBALink(project_parameters=project_parameters_cli)
111
+ timba_link_cli.run()
112
+
@@ -0,0 +1,25 @@
1
+ Region;2020;2022;2024;2026;2028;2030;2035;2040;2045;2050
2
+ EU27;1331898.71;1343691.39;1349864.45;1357282.97;1364276.23;1371010.9;1390815.04;1412098.47;1427970.47;1443028.33
3
+ GBR;11413.16;11598.15;11663.66;11748.04;11835.18;11920.97;12054.72;12174.13;12340.57;12492.7
4
+ EFTA;135638.17;135916.25;136027.77;136166.56;136293.91;136415.97;136447.93;136459.18;136606.12;136722.92
5
+ USA;2578402.44;2586630;2590429.06;2594778.32;2598256.82;2602152.94;2607784.19;2614360.75;2624649.56;2636492.75
6
+ CAN;4188214.25;4186563.31;4189816.31;4190294.63;4189775.69;4189423.25;4185934.06;4181590.13;4178186.44;4175581.25
7
+ CSAM;3549520.63;3547645;3546945.63;3546381.75;3544212.88;3542332.75;3536789.5;3534234.25;3535442.13;3539020.38
8
+ CHL;169773.69;170833.02;171331.79;171928.52;172487.05;173040.75;174202.95;175384.9;176532.43;177557.89
9
+ BRA;4036694.56;4029781.38;4025079.38;4026086.06;4027157.25;4026167.88;4013336.38;3994604.25;3969831.63;3935995.88
10
+ MERCOSUR;372118.18;376924.78;378088.9;380678.2;383252.97;385668.47;390712.53;395050.79;399462.28;403516.4
11
+ AUS;548316.06;553576.26;557010.33;560702.51;564180.07;567594.44;573594.06;579208.22;585895.62;592946.53
12
+ NZL;67748.92;67809.47;68034.7;68184.74;68270.66;68356.57;68385.81;68407.83;68526.53;68660.58
13
+ ASIA;1167155.75;1169928.03;1172290;1175127.84;1178192.44;1181420.03;1188856.47;1195705.44;1202839.44;1210205.44
14
+ IDN;1019304.85;1004322.45;983929.77;964582.33;948141.69;934419.97;904952;881649.09;863260.43;848807.44
15
+ CHN;1602163;1621855.53;1638844.13;1654114.59;1668282.31;1681887.82;1707123.22;1729284.66;1752705.34;1777456.81
16
+ IND;477191.02;473775.65;472940.18;473102.64;474734.18;477474.26;486029.07;496769.83;508724.76;521059.17
17
+ JPN;238301.72;238738.88;239084.31;239430.12;239764.26;240097.38;240679.12;241226.59;241902;242547.67
18
+ RUS;8923899.37;8942864.12;8954528.5;8968074.38;8979141.25;8988106.5;9002725.5;9013388.5;9023733.25;9030213.25
19
+ UKR;85642;85444.64;85376.23;86572.55;87353.74;87995.46;88858.87;89298.49;89635.67;89721.36
20
+ TUR;89462.91;90333.18;90970.19;91605.58;92206.93;92817.39;94037.58;95315.84;96630.12;97895.98
21
+ MENA;22131.8;22774;23182.4;23755.78;24333.19;24887.12;26176.69;27357.31;28481.13;29547.77
22
+ SSA;876373.09;881970.19;886666.25;891719.03;896884.32;902435.63;916981.53;929533.57;940388.6;950074.03
23
+ LDC_afr;5068990.75;5084826.5;5098370.5;5117285.75;5137695.63;5158620;5213257.38;5265376.25;5317254;5369029.38
24
+ ROW_WTO;157476.38;157848.49;157914.03;158074.72;158263.76;158489.19;159112.93;159939.16;160904.89;161889.49
25
+ ROW_NWTO;978726.78;980723.53;982083.72;983497.66;984735;985874.37;987839.09;988932.25;990246.72;991524.09
@@ -0,0 +1,25 @@
1
+ Region;2020;2022;2024;2026;2028;2030;2035;2040;2045;2050
2
+ EU27;14553.77;15995.994;16286.571;16876.498;17457.8;18009.67;19373.524;20739.598;22068.53;23362.882
3
+ GBR;2493.001;2827.0415;2861.3895;2941.91;3046.57725;3152.9775;3448.14875;3797.059;4192.379;4613.677
4
+ EFTA;1148.507;1239.8435;1263.95225;1300.23238;1336.41763;1372.901;1464.42838;1553.51688;1643.64888;1735.24288
5
+ USA;20064.828;21639.432;22492.21;23342.03;24247.184;25103.022;27099.286;28974.488;30799.478;32607.294
6
+ CAN;1639.1725;1780.49875;1815.80238;1889.96125;1971.65063;2053.8965;2282.53525;2536.41725;2801.92225;3067.808
7
+ CSAM;2418.79675;2723.76275;2867.42425;3021.50825;3201.8885;3395.96975;3938.93325;4559.0385;5252.931;6010.4035
8
+ CHL;270.82003;310.70528;316.47113;327.06144;336.53644;347.89244;384.54847;426.28669;472.54203;521.70244
9
+ BRA;2046.69125;2220.758;2329.42275;2410.30075;2487.0835;2583.6555;2937.1245;3399.80575;3964.2965;4612.0865
10
+ MERCOSUR;657.00525;752.69975;741.8925;780.31331;822.42556;861.34888;963.83313;1077.09925;1205.30025;1350.49325
11
+ AUS;1365.0925;1489.3825;1537.85275;1611.25725;1699.26863;1788.51725;2023.74738;2277.08075;2550.98025;2835.5665
12
+ NZL;219.59719;238.26764;245.42428;256.35338;269.6945;282.66772;314.7125;345.59416;377.6255;410.35372
13
+ ASIA;5504.207;5978.9045;6377.496;6915.698;7510.7215;8140.692;9729.196;11286.862;12889.521;14582.726
14
+ IDN;1098.77888;1199.93538;1323.77375;1463.0725;1599.673;1732.34188;2073.08675;2429.538;2787.3845;3137.2105
15
+ CHN;14241.502;15905.886;17512.948;19056.186;20544.26;21939.26;25280.828;27956.386;30521.356;32915.662
16
+ IND;2794.821;3245.98325;3647.6135;4144.81475;4647.593;5162.719;6510.6025;7966.6975;9533.409;11213.711
17
+ JPN;4732.867;4883.4045;5018.371;5110.645;5190.636;5280.896;5506.138;5698.6935;5897.0145;6107.217
18
+ RUS;1609.734;1666.2105;1705.6935;1740.30025;1789.33138;1851.52375;2031.194;2217.27325;2406.253;2596.39125
19
+ UKR;115.22575;84.53768;88.98756;99.50888;108.0043;118.24888;143.19006;168.09281;192.04605;216.00856
20
+ TUR;908.67113;1068.5155;1148.53025;1234.343;1333.792;1433.472;1679.313;1905.71125;2121.01175;2320.63575
21
+ MENA;2522.45425;2798.769;2954.65025;3213.04375;3496.03725;3787.13925;4550.017;5359.7385;6227.1725;7167.9755
22
+ SSA;1096.04663;1187.58863;1256.80738;1340.94138;1435.6885;1555.07113;1937.64738;2402.618;2967.92775;3650.62
23
+ LDC_afr;681.20825;738.90431;790.97856;878.23538;982.20094;1102.082;1469.76863;1931.14725;2520.58575;3268.70125
24
+ ROW_WTO;379.0565;424.30069;462.77078;505.18003;549.78831;599.12425;736.03769;882.8995;1037.84469;1203.95175
25
+ ROW_NWTO;1228.1075;1327.03488;1404.005;1488.97788;1578.05388;1670.34225;1949.43213;2284.644;2644.36975;3018.864
@@ -0,0 +1,26 @@
1
+ Region;2020;2022;2024;2026;2028;2030;2035;2040;2045;2050
2
+ EU27;449.47;450.47;450.54;449.97;449;447.91;445.62;443.7;442.03;440.57
3
+ GBR;66.95;67.3;67.66;68.01;68.36;68.71;69.59;70.55;71.62;72.79
4
+ EFTA;14.38;14.55;14.71;14.84;14.96;15.07;15.36;15.63;15.92;16.24
5
+ USA;330.67;333.05;335.75;338.67;341.71;344.78;352.21;359.21;365.65;371.68
6
+ CAN;37.74;38.11;38.46;38.79;39.11;39.43;40.17;40.85;41.49;42.15
7
+ CSAM;339.80;345.48;351.48;357.64;363.75;369.64;382.72;393.47;401.82;407.89
8
+ CHL;19.31;19.46;19.61;19.77;19.92;20.06;20.34;20.51;20.57;20.55
9
+ BRA;211.88;213.84;215.86;217.85;219.76;221.5;224.88;226.91;227.65;227.08
10
+ MERCOSUR;55.44;56.04;56.68;57.32;57.97;58.6;60.06;61.34;62.4;63.21
11
+ AUS;25.56;25.97;26.38;26.78;27.18;27.57;28.49;29.36;30.21;31.09
12
+ NZL;5.08;5.14;5.2;5.26;5.32;5.37;5.5;5.62;5.73;5.83
13
+ ASIA;972.32;994.2;1015.82;1037.02;1057.63;1077.48;1123.11;1162.74;1196.43;1224.91
14
+ IDN;270.98;274.78;278.8;282.9;286.93;290.74;298.81;304.8;308.77;310.77
15
+ CHN;1399.89;1402.66;1402.91;1401.02;1397.36;1392.29;1375.16;1352.4;1322.53;1283.89
16
+ IND;1374.02;1395.04;1417.44;1440.37;1463;1484.49;1530.3;1565.5;1589.23;1601.74
17
+ JPN;125.66;124.42;123.19;121.96;120.72;119.45;116.14;112.75;109.33;106.03
18
+ RUS;144.80;144.97;144.68;144.08;143.3;142.46;140.63;139.27;138.41;137.84
19
+ UKR;44.26;39.46;37.05;36.33;36.58;37.08;37.07;36.63;35.91;35.1
20
+ TUR;82.80;84.13;85.41;86.64;87.8;88.87;91.16;93.01;94.41;95.2
21
+ MENA;277.71;286.63;295.36;303.89;312.23;320.38;339.98;358.72;376.17;391.68
22
+ SSA;436.40;455.17;474.57;494.52;514.94;535.76;589.22;644.3;699.99;755.1
23
+ LDC_afr;686.47;725.86;766.64;808.63;851.66;895.57;1008.16;1123.26;1239;1353.44
24
+ ROW_WTO;93.07;95.36;97.56;99.67;101.69;103.62;108.1;112.31;116.23;119.58
25
+ ROW_NWTO;253.38;259.49;265.73;271.99;278.22;284.31;298.75;312.33;324.82;335.83
26
+ ;;;;;;;;;;
@@ -0,0 +1,26 @@
1
+ Region;2020;2022;2024;2026;2028;2030;2035;2040;2045;2050
2
+ EU27;449.47;450.47;450.54;449.97;449;447.91;445.62;443.7;442.03;440.57
3
+ GBR;66.95;67.3;67.66;68.01;68.36;68.71;69.59;70.55;71.62;72.79
4
+ EFTA;14.38;14.55;14.71;14.84;14.96;15.07;15.36;15.63;15.92;16.24
5
+ USA;330.67;333.05;335.75;338.67;341.71;344.78;352.21;359.21;365.65;371.68
6
+ CAN;37.74;38.11;38.46;38.79;39.11;39.43;40.17;40.85;41.49;42.15
7
+ CSAM;339.80;345.48;351.48;357.64;363.75;369.64;382.72;393.47;401.82;407.89
8
+ CHL;19.31;19.46;19.61;19.77;19.92;20.06;20.34;20.51;20.57;20.55
9
+ BRA;211.88;213.84;215.86;217.85;219.76;221.5;224.88;226.91;227.65;227.08
10
+ MERCOSUR;55.44;56.04;56.68;57.32;57.97;58.6;60.06;61.34;62.4;63.21
11
+ AUS;25.56;25.97;26.38;26.78;27.18;27.57;28.49;29.36;30.21;31.09
12
+ NZL;5.08;5.14;5.2;5.26;5.32;5.37;5.5;5.62;5.73;5.83
13
+ ASIA;972.32;994.2;1015.82;1037.02;1057.63;1077.48;1123.11;1162.74;1196.43;1224.91
14
+ IDN;270.98;274.78;278.8;282.9;286.93;290.74;298.81;304.8;308.77;310.77
15
+ CHN;1399.89;1402.66;1402.91;1401.02;1397.36;1392.29;1375.16;1352.4;1322.53;1283.89
16
+ IND;1374.02;1395.04;1417.44;1440.37;1463;1484.49;1530.3;1565.5;1589.23;1601.74
17
+ JPN;125.66;124.42;123.19;121.96;120.72;119.45;116.14;112.75;109.33;106.03
18
+ RUS;144.80;144.97;144.68;144.08;143.3;142.46;140.63;139.27;138.41;137.84
19
+ UKR;44.26;39.46;37.05;36.33;36.58;37.08;37.07;36.63;35.91;35.1
20
+ TUR;82.80;84.13;85.41;86.64;87.8;88.87;91.16;93.01;94.41;95.2
21
+ MENA;277.71;286.63;295.36;303.89;312.23;320.38;339.98;358.72;376.17;391.68
22
+ SSA;436.40;455.17;474.57;494.52;514.94;535.76;589.22;644.3;699.99;755.1
23
+ LDC_afr;686.47;725.86;766.64;808.63;851.66;895.57;1008.16;1123.26;1239;1353.44
24
+ ROW_WTO;93.07;95.36;97.56;99.67;101.69;103.62;108.1;112.31;116.23;119.58
25
+ ROW_NWTO;253.38;259.49;265.73;271.99;278.22;284.31;298.75;312.33;324.82;335.83
26
+ ;;;;;;;;;;
@@ -0,0 +1,237 @@
1
+ regions,iso3,name,forest_area_2020,land_area_2020,primary_forest_area_2010,primary_forest_area_2015,primary_forest_area_2020
2
+ North and Central America,ABW,Aruba,0.42,18,,,
3
+ Asia,AFG,Afghanistan,1208.44,65286,,,
4
+ Africa,AGO,Angola,66607.38,124670,,26743,26743
5
+ North and Central America,AIA,Anguilla,5.5,9,0,0,0
6
+ Europe,ALB,Albania,788.9,2740,84.8,84.8,84.8
7
+ Europe,AND,Andorra,16,47,0,0,0
8
+ Asia,ARE,United Arab Emirates,317.3,7102,0,0,0
9
+ South America,ARG,Argentina,28573,273669,,,
10
+ Asia,ARM,Armenia,328.47,2847,17,17,17
11
+ Oceania,ASM,American Samoa,17.13,20,2.69,1.38,0.09
12
+ North and Central America,ATG,Antigua and Barbuda,8.12,44,0,0,0
13
+ Oceania,AUS,Australia,134005.1,768230,,4504,
14
+ Europe,AUT,Austria,3899.15,8252,63,63,63
15
+ Asia,AZE,Azerbaijan,1131.77,8266,,,
16
+ Africa,BDI,Burundi,279.64,2568,64.78,64.78,64.78
17
+ Europe,BEL,Belgium,689.3,3028,0,0,0
18
+ Africa,BEN,Benin,3135.15,11276,0,0,0
19
+ North and Central America,BES,"Bonaire, Sint Eustatius and Saba",1.91,32.2,,,
20
+ Africa,BFA,Burkina Faso,6216.4,27360,0,0,0
21
+ Asia,BGD,Bangladesh,1883.4,13017,,,
22
+ Europe,BGR,Bulgaria,3893,10856,597,704,704
23
+ Asia,BHR,Bahrain,0.7,77,,,
24
+ North and Central America,BHS,Bahamas,509.86,1001,0,0,0
25
+ Europe,BIH,Bosnia and Herzegovina,2187.91,5120,,,
26
+ North and Central America,BLM,Saint Barthélemy,0.17,2,0,0,0
27
+ Europe,BLR,Belarus,8767.6,20297.8,134.8,134.8,134.8
28
+ North and Central America,BLZ,Belize,1277.05,2281,,,
29
+ North and Central America,BMU,Bermuda,1,5,,,
30
+ South America,BOL,Bolivia (Plurinational State of),50833.76,108330,,,
31
+ South America,BRA,Brazil,496619.6,835814,218200,217193,216187
32
+ North and Central America,BRB,Barbados,6.3,43,,,
33
+ Asia,BRN,Brunei Darussalam,380,527,263,263,263
34
+ Asia,BTN,Bhutan,2725.08,3812,413,413,413
35
+ Africa,BWA,Botswana,15254.7,56673,,,
36
+ Africa,CAF,Central African Republic,22303,62298,2752,2370,1988
37
+ North and Central America,CAN,Canada,346928.1,909351,205276.23,205154.18,205130.73
38
+ Europe,CHE,Switzerland,1269.11,3952,42.86,42.86,42.86
39
+ South America,CHL,Chile,18210.7,74353,4801.51,5198.56,5347.67
40
+ Asia,CHN,China,219978.18,942470,11453.33,11453.33,11453.33
41
+ Africa,CIV,Côte d'Ivoire,2836.71,31800,1345.86,1323.69,1301.51
42
+ Africa,CMR,Cameroon,20340.48,47271,0,0,0
43
+ Africa,COD,Democratic Republic of the Congo,126155.24,226705,89979.29,86365.4,82751.51
44
+ Africa,COG,Congo,21946,34150,,,
45
+ Oceania,COK,Cook Islands,15.59,24,0,0,0
46
+ South America,COL,Colombia,59141.91,110950,,,
47
+ Africa,COM,Comoros,32.92,186,,,
48
+ Africa,CPV,Cabo Verde,45.72,403,0,0,0
49
+ North and Central America,CRI,Costa Rica,3034.87,5106,,,
50
+ North and Central America,CUB,Cuba,3242,10402,0,0,0
51
+ North and Central America,CUW,Curaçao,0.07,44.4,,,
52
+ North and Central America,CYM,Cayman Islands,12.72,24,,,
53
+ Asia,CYP,Cyprus,172.53,924,0,0,0
54
+ Europe,CZE,Czechia,2677.09,7721,9.99,9.99,9.99
55
+ Europe,DEU,Germany,11419,34886,0,0,0
56
+ Africa,DJI,Djibouti,5.8,2318,0,0,0
57
+ North and Central America,DMA,Dominica,47.87,75,26.72,26.3,26.3
58
+ Europe,DNK,Denmark,628.44,4199,27.93,22.09,21.14
59
+ North and Central America,DOM,Dominican Republic,2144.1,4831,,,
60
+ Africa,DZA,Algeria,1949,238174,0,0,0
61
+ South America,ECU,Ecuador,12497.83,24836,,,
62
+ Africa,EGY,Egypt,44.98,99545,,,
63
+ Africa,ERI,Eritrea,1055.26,10100,0,0,0
64
+ Africa,ESH,Western Sahara,665.07,26600,,,
65
+ Europe,ESP,Spain,18572.17,49966.1,,,
66
+ Europe,EST,Estonia,2438.4,4347,59.16,51.43,52.09
67
+ Africa,ETH,Ethiopia,17068.5,111971.55,,,
68
+ Europe,FIN,Finland,22409,30391,234,203,203
69
+ Oceania,FJI,Fiji,1140.02,1827,0,0,0
70
+ South America,FLK,Falkland Islands (Malvinas),0,1217,0,0,0
71
+ Europe,FRA,France,17253,54756,,,
72
+ Europe,FRO,Faroe Islands,0.08,140,0,0,0
73
+ Oceania,FSM,Micronesia (Federated States of),64.42,70,48.37,48.37,48.37
74
+ Africa,GAB,Gabon,23530.6,25767,,,
75
+ Europe,GBR,United Kingdom of Great Britain and Northern Ireland,3190,24193,0,0,0
76
+ Asia,GEO,Georgia,2822.4,6949,500,500,500
77
+ Europe,GGY,Guernsey,0.42,8,0,0,0
78
+ Africa,GHA,Ghana,7985.71,22754,395,395,385
79
+ Europe,GIB,Gibraltar,0,1,0,0,0
80
+ Africa,GIN,Guinea,6189,24572,63,63,63
81
+ North and Central America,GLP,Guadeloupe,71.92,169,7.11,7.11,6.9
82
+ Africa,GMB,Gambia,242.67,1012,13,13,13
83
+ Africa,GNB,Guinea-Bissau,1980.01,2812,,,
84
+ Africa,GNQ,Equatorial Guinea,2448.42,2805,,,
85
+ Europe,GRC,Greece,3901.8,12890,,,
86
+ North and Central America,GRD,Grenada,17.7,34,2.32,2.32,2.32
87
+ North and Central America,GRL,Greenland,0.22,41045,0,0,0
88
+ North and Central America,GTM,Guatemala,3527.8,10716,688.68,675.72,658.06
89
+ South America,GUF,French Guiana,8002.85,8220,7694,7658,7640
90
+ Oceania,GUM,Guam,28,54,,,
91
+ South America,GUY,Guyana,18415.34,19685,9477,9477,9477
92
+ North and Central America,HND,Honduras,6359.26,11189,,,
93
+ Europe,HRV,Croatia,1939.11,5596,6.73,6.73,6.73
94
+ North and Central America,HTI,Haiti,347.3,2756,,,
95
+ Europe,HUN,Hungary,2053.01,9053,0,0,0
96
+ Asia,IDN,Indonesia,92133.2,187752,45597,45168.4,44740
97
+ Europe,IMN,Isle of Man,3.46,57,,,
98
+ Asia,IND,India,72160,297319,15701,15701,15701
99
+ Europe,IRL,Ireland,782.02,6889,0,0,0
100
+ Asia,IRN,Iran (Islamic Republic of),10751.87,162876,200,200,200
101
+ Asia,IRQ,Iraq,825,43412.8,0,0,0
102
+ Europe,ISL,Iceland,51.35,10025,0,0,0
103
+ Asia,ISR,Israel,140,2164,0,0,0
104
+ Europe,ITA,Italy,9566.13,29414,93,93,93
105
+ North and Central America,JAM,Jamaica,596.89,1083,85.36,84.16,82.96
106
+ Europe,JEY,Jersey,0.6,12,0,0,0
107
+ Asia,JOR,Jordan,97.5,8878,0,0,0
108
+ Asia,JPN,Japan,24935,36456,4770,5170,5346
109
+ Asia,KAZ,Kazakhstan,3454.68,269970,30.5,62,66.9
110
+ Africa,KEN,Kenya,3611.09,56914,,,
111
+ Asia,KGZ,Kyrgyzstan,1315.38,19180,455.2,463.4,487
112
+ Asia,KHM,Cambodia,8068.37,17652,322,322,322
113
+ Oceania,KIR,Kiribati,1.18,81,,,
114
+ North and Central America,KNA,Saint Kitts and Nevis,11,26,,,
115
+ Asia,KOR,Republic of Korea,6287,9744.5,,,
116
+ Asia,KWT,Kuwait,6.25,1782,,,
117
+ Asia,LAO,Lao People's Democratic Republic,16595.5,23080,,,
118
+ Asia,LBN,Lebanon,143.33,1023,,,
119
+ Africa,LBR,Liberia,7617.44,9632,,,
120
+ Africa,LBY,Libya,217,175954,,,
121
+ North and Central America,LCA,Saint Lucia,20.77,61,,,
122
+ Europe,LIE,Liechtenstein,6.7,16,1.5,1.5,1.5
123
+ Asia,LKA,Sri Lanka,2113.02,6271,167,167,167
124
+ Africa,LSO,Lesotho,34.52,3036,,,
125
+ Europe,LTU,Lithuania,2201,6265,26,26.54,26.54
126
+ Europe,LUX,Luxembourg,88.7,243,0,0,0
127
+ Europe,LVA,Latvia,3410.79,6218,14.92,15.2,16.98
128
+ North and Central America,MAF,Saint Martin (French Part),1.24,5,0,0,0
129
+ Africa,MAR,Morocco,5742.49,44630,0,0,0
130
+ Europe,MCO,Monaco,0,0,0,0,0
131
+ Europe,MDA,Republic of Moldova,386.5,3288,,,
132
+ Africa,MDG,Madagascar,12429.81,58180,3036,2993,2950
133
+ Asia,MDV,Maldives,0.82,30,,,
134
+ North and Central America,MEX,Mexico,65692.08,194395,32543.07,32281.01,32040.16
135
+ Oceania,MHL,Marshall Islands,9.4,18,5.76,5.76,5.76
136
+ Europe,MKD,North Macedonia,1001.49,2522,,,
137
+ Africa,MLI,Mali,13296,122019,0,0,0
138
+ Europe,MLT,Malta,0.46,32,0,0,0
139
+ Asia,MMR,Myanmar,28543.89,65308,3192,3192,3192
140
+ Europe,MNE,Montenegro,827,1345,,1.6,1.6
141
+ Asia,MNG,Mongolia,14172.78,155356,0,0,0
142
+ Oceania,MNP,Northern Mariana Islands,24.36,46,,,
143
+ Africa,MOZ,Mozambique,36743.76,78638,,,
144
+ Africa,MRT,Mauritania,312.8,103070,0,0,0
145
+ North and Central America,MSR,Montserrat,2.5,10,,,
146
+ North and Central America,MTQ,Martinique,52.29,106,2.8,2.8,2.8
147
+ Africa,MUS,Mauritius,38.77,203,20.3,20.3,20.3
148
+ Africa,MWI,Malawi,2241.7,9428,734,721,708
149
+ Asia,MYS,Malaysia,19114.04,32855,1086.16,1086.16,1086.16
150
+ Africa,MYT,Mayotte,13.89,37,,,
151
+ Africa,NAM,Namibia,6638.9,82329,,,
152
+ Oceania,NCL,New Caledonia,838.02,1828,337.6,337.6,337.6
153
+ Africa,NER,Niger,1079.7,126670,220,220,220
154
+ Oceania,NFK,Norfolk Island,0.49,4,,,
155
+ Africa,NGA,Nigeria,21626.95,91077,,,
156
+ North and Central America,NIC,Nicaragua,3407.53,12034,,,
157
+ Oceania,NIU,Niue,18.87,26,5.4,5.4,5.4
158
+ Europe,NLD,Netherlands (Kingdom of the),369.5,3369,0,0,0
159
+ Europe,NOR,Norway,12180,30413,200,200,200
160
+ Asia,NPL,Nepal,5962.03,14335,526,526,526
161
+ Oceania,NRU,Nauru,0,2,0,0,0
162
+ Oceania,NZL,New Zealand,9892.59,26331,2152,1973,1971
163
+ Asia,OMN,Oman,2.5,30950,,,
164
+ Asia,PAK,Pakistan,3725.9,77088,0,0,0
165
+ North and Central America,PAN,Panama,4213.84,7434,,,
166
+ Oceania,PCN,Pitcairn,3.5,5,,,
167
+ South America,PER,Peru,72330.37,128000,,,
168
+ Asia,PHL,Philippines,7188.59,29817,861,861,861
169
+ Oceania,PLW,Palau,41.41,46,,,
170
+ Oceania,PNG,Papua New Guinea,35855.76,45286,,27200.9,
171
+ Europe,POL,Poland,9483,30619,0,0,0
172
+ North and Central America,PRI,Puerto Rico,496.33,887,0,0,0
173
+ Asia,PRK,Democratic People's Republic of Korea,6030.09,12041,,,
174
+ Europe,PRT,Portugal,3312,9161,22,22,
175
+ South America,PRY,Paraguay,16102.26,39730,,,
176
+ Asia,PSE,Palestine,10.14,602,,,
177
+ Oceania,PYF,French Polynesia,149.46,366,40,40,40
178
+ Asia,QAT,Qatar,0,1161,0,0,0
179
+ Africa,REU,Réunion,98.44,251,53,53,53
180
+ Europe,ROU,Romania,6929.05,23008,127.7,127.7,165.23
181
+ Europe,RUS,Russian Federation,815311.6,1637687,271855.8,263533.7,255211.5
182
+ Africa,RWA,Rwanda,276,2467,,,
183
+ Asia,SAU,Saudi Arabia,977,214969,360,360,360
184
+ Africa,SDN,Sudan,18359.55,186665,1405.74,1344.7,1283.65
185
+ Africa,SEN,Senegal,8068.16,19253,2100.62,2055.8,2019.34
186
+ Asia,SGP,Singapore,15.57,71,,,
187
+ Africa,SHN,Saint Helena,2,39,,,
188
+ Europe,SJM,Svalbard and Jan Mayen Islands,0,6100,0,0,0
189
+ Oceania,SLB,Solomon Islands,2522.97,2799,,1738.31,
190
+ Africa,SLE,Sierra Leone,2534.88,7218,113,85,57
191
+ North and Central America,SLV,El Salvador,583.88,2072,,,
192
+ Europe,SMR,San Marino,1,6,0,0,0
193
+ Africa,SOM,Somalia,5980,62734,,,
194
+ North and Central America,SPM,Saint Pierre and Miquelon,1.22,23,,,
195
+ Europe,SRB,Serbia,2722.65,8746,1,1,1
196
+ Africa,SSD,South Sudan,7157,63173,,,
197
+ Africa,STP,Sao Tome and Principe,51.9,96,28,28,28
198
+ South America,SUR,Suriname,15196.29,15600,14936.87,14888.68,14833.29
199
+ Europe,SVK,Slovakia,1925.9,4808,10.58,10.58,10.58
200
+ Europe,SVN,Slovenia,1237.83,2014,49,49,33.6
201
+ Europe,SWE,Sweden,27980,40731,2365,2249,2249
202
+ Africa,SWZ,Eswatini,497.56,1720,0.3,0.45,1.2
203
+ North and Central America,SXM,Sint Maarten (Dutch part),0.37,3.4,,,
204
+ Africa,SYC,Seychelles,33.7,46,,,
205
+ Asia,SYR,Syrian Arab Republic,522.08,18363,0,0,0
206
+ North and Central America,TCA,Turks and Caicos Islands,10.52,95,,,
207
+ Africa,TCD,Chad,4313,125920,,,
208
+ Africa,TGO,Togo,1209.27,5439,,,
209
+ Asia,THA,Thailand,19873,51089,,,
210
+ Asia,TJK,Tajikistan,423.8,13879,296,296,296
211
+ Oceania,TKL,Tokelau,0,1,0,0,0
212
+ Asia,TKM,Turkmenistan,4127,46993,104,104,104
213
+ Asia,TLS,Timor-Leste,921.1,1487,,,
214
+ Oceania,TON,Tonga,8.95,72,4,4,4
215
+ North and Central America,TTO,Trinidad and Tobago,228.19,513,62.4,62.4,62.4
216
+ Africa,TUN,Tunisia,702.73,15536,0,0,0
217
+ Asia,TUR,Türkiye,22220.36,76963,0,0,0
218
+ Oceania,TUV,Tuvalu,1,3,0,0,0
219
+ Africa,TZA,United Republic of Tanzania,45745,88580,28508,28508,28508
220
+ Africa,UGA,Uganda,2337.9,20052,,,
221
+ Europe,UKR,Ukraine,9690,57929,59,59,59
222
+ South America,URY,Uruguay,2031,17502,301,340,340
223
+ North and Central America,USA,United States of America,309795,914742,75294,75300,75300
224
+ Asia,UZB,Uzbekistan,3689.66,42540,210.3,210.3,210.3
225
+ Europe,VAT,Holy See,0,0,0,0,0
226
+ North and Central America,VCT,Saint Vincent and the Grenadines,28.54,39,,,
227
+ South America,VEN,Venezuela (Bolivarian Republic of),46230.9,88205,46515.78,45329.41,44872.75
228
+ North and Central America,VGB,British Virgin Islands,3.62,15,,,
229
+ North and Central America,VIR,United States Virgin Islands,19.91,35,,,
230
+ Asia,VNM,Viet Nam,14643.09,31007,80,80,80
231
+ Oceania,VUT,Vanuatu,442.3,1219,205,205,205
232
+ Oceania,WLF,Wallis and Futuna Islands,5.83,14,,,
233
+ Oceania,WSM,Samoa,161.67,283,,,
234
+ Asia,YEM,Yemen,549,52797,0,0,0
235
+ Africa,ZAF,South Africa,17050.09,121309,497,428,428
236
+ Africa,ZMB,Zambia,44814.03,74339,,,
237
+ Africa,ZWE,Zimbabwe,17444.58,38685,,,
File without changes
@@ -0,0 +1,52 @@
1
+ from typing import Union
2
+ import os
3
+ from pathlib import Path
4
+ import datetime as dt
5
+ import logging
6
+
7
+
8
+ def get_logger(user_path: Union[str, Path, None], aggregation_flag: bool):
9
+ """
10
+ Creates a basic logger with defined user_path, if aggregation_flag is true logger output is saved under
11
+ data_aggregation (= used for aggregation scripts). If aggregation_flag is false logger output is saved under
12
+ data_disaggregation (= used for disaggregation scripts).
13
+ :param user_path: path where logger output is saved
14
+ :param aggregation_flag: allows to select the storing folder
15
+ :return:
16
+ """
17
+ current_dt = dt.datetime.now().strftime("%Y%m%d")
18
+ if aggregation_flag:
19
+ filename = rf"{current_dt}_aggregation.log"
20
+ LOGGING_OUTPUT_FOLDER = r"data\\output"
21
+ else:
22
+ filename = rf"{current_dt}_disaggregation.log"
23
+ LOGGING_OUTPUT_FOLDER = r"data\\output"
24
+
25
+ if user_path is None:
26
+ filepath = os.path.join(LOGGING_OUTPUT_FOLDER, filename)
27
+ else:
28
+ filepath = os.path.join(user_path, "output", filename)
29
+ if not os.path.exists(filepath):
30
+ os.makedirs(Path(filepath).parent, exist_ok=True)
31
+
32
+ Logger = logging.getLogger("TiMBA_Link pipeline")
33
+ Logger.setLevel(logging.DEBUG)
34
+ formatter = logging.Formatter(
35
+ '%(asctime)s %(levelname)s %(lineno)s: %(message)s',
36
+ '%d.%m.%y %H:%M:%S'
37
+ )
38
+
39
+ for handler in Logger.handlers[:]:
40
+ Logger.removeHandler(handler)
41
+ handler.close()
42
+
43
+ handler = logging.FileHandler(filepath, 'a+')
44
+ handler.setFormatter(formatter)
45
+ Logger.addHandler(handler)
46
+
47
+ console = logging.StreamHandler()
48
+ console.setLevel(logging.INFO)
49
+ console_formatter = logging.Formatter('%(name)-10s: %(levelname)-10s %(message)s')
50
+ console.setFormatter(console_formatter)
51
+ Logger.addHandler(console)
52
+ return Logger
File without changes