Skip to content

Commit

Permalink
UN API fix and download all data
Browse files Browse the repository at this point in the history
This adds code to use the new UN API format, which requires a token. Also requires some changes to OG-Core `demographics.py` to grab the data.
  • Loading branch information
SeaCelo committed May 20, 2024
1 parent 96105be commit b68c6b9
Show file tree
Hide file tree
Showing 9 changed files with 513 additions and 0 deletions.
1 change: 1 addition & 0 deletions ogzaf/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
un_api_token.txt
81 changes: 81 additions & 0 deletions ogzaf/data/demographic/fert_rates.csv

Large diffs are not rendered by default.

81 changes: 81 additions & 0 deletions ogzaf/data/demographic/immigration_rates.csv

Large diffs are not rendered by default.

81 changes: 81 additions & 0 deletions ogzaf/data/demographic/infmort_rates.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
2.149107999999999921e-02
2.730078000000000019e-02
2.879193000000000030e-02
2.741431000000000076e-02
2.135203000000000101e-02
2.098150999999999836e-02
2.061558000000000140e-02
2.023418000000000092e-02
1.988306000000000101e-02
1.954424999999999912e-02
1.919879000000000030e-02
1.887911999999999924e-02
1.853408000000000139e-02
1.822504000000000138e-02
1.789442999999999936e-02
1.758113999999999857e-02
1.726451000000000027e-02
1.688587000000000074e-02
1.650768000000000027e-02
1.613658999999999927e-02
1.575168999999999875e-02
1.539483999999999991e-02
1.501313999999999947e-02
1.466996999999999919e-02
1.433912000000000034e-02
1.402992999999999948e-02
1.370757000000000052e-02
1.337059999999999985e-02
1.304481000000000043e-02
1.273222000000000069e-02
1.244568000000000063e-02
1.214779000000000032e-02
1.186339999999999964e-02
1.156078999999999961e-02
1.128791999999999990e-02
1.101921999999999971e-02
1.074037000000000082e-02
1.048937999999999954e-02
1.022169000000000029e-02
9.929769999999999222e-03
9.678420000000000079e-03
9.413110000000000574e-03
9.181279999999999997e-03
8.946030000000000648e-03
8.678170000000000675e-03
8.449800000000000366e-03
8.190110000000000445e-03
7.978549999999999184e-03
7.760129999999999632e-03
7.557669999999999839e-03
7.322760000000000206e-03
7.123140000000000027e-03
6.906599999999999719e-03
6.712530000000000406e-03
6.502739999999999909e-03
6.308290000000000251e-03
6.131610000000000012e-03
5.952309999999999719e-03
5.765260000000000350e-03
5.630800000000000041e-03
5.501579999999999838e-03
5.375360000000000034e-03
5.245109999999999877e-03
5.115009999999999696e-03
4.985340000000000431e-03
4.864639999999999936e-03
4.743879999999999798e-03
4.619520000000000223e-03
4.500259999999999851e-03
4.387699999999999587e-03
4.272119999999999911e-03
4.159839999999999718e-03
4.056099999999999983e-03
3.947899999999999847e-03
3.845089999999999793e-03
3.743269999999999931e-03
3.642729999999999840e-03
3.537390000000000066e-03
3.441839999999999830e-03
3.350870000000000151e-03
3.252249999999999933e-03
81 changes: 81 additions & 0 deletions ogzaf/data/demographic/mort_rates.csv

Large diffs are not rendered by default.

82 changes: 82 additions & 0 deletions ogzaf/data/demographic/population_distribution.csv

Large diffs are not rendered by default.

100 changes: 100 additions & 0 deletions ogzaf/data/demographic/pre_period_population_distribution.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
1.196416000000000000e+06
1.160270000000000000e+06
1.122647000000000000e+06
1.123829000000000000e+06
1.150985000000000000e+06
1.154299000000000000e+06
1.145702000000000000e+06
1.134758000000000000e+06
1.116172000000000000e+06
1.106339000000000000e+06
1.129341000000000000e+06
1.107737000000000000e+06
1.051073000000000000e+06
1.019330000000000000e+06
9.783870000000000000e+05
9.336520000000000000e+05
8.952880000000000000e+05
8.848280000000000000e+05
8.905900000000000000e+05
9.079080000000000000e+05
9.275430000000000000e+05
9.421650000000000000e+05
9.843300000000000000e+05
1.035209000000000000e+06
1.061667000000000000e+06
1.078165000000000000e+06
1.096390000000000000e+06
1.119628000000000000e+06
1.133280000000000000e+06
1.148386000000000000e+06
1.168135000000000000e+06
1.168272000000000000e+06
1.143368000000000000e+06
1.088674000000000000e+06
1.032867000000000000e+06
9.893750000000000000e+05
9.518010000000000000e+05
9.101740000000000000e+05
8.615950000000000000e+05
8.014090000000000000e+05
7.227060000000000000e+05
6.447880000000000000e+05
5.831750000000000000e+05
5.469880000000000000e+05
5.383950000000000000e+05
5.530490000000000000e+05
5.820310000000000000e+05
6.138370000000000000e+05
6.382040000000000000e+05
6.512960000000000000e+05
6.522900000000000000e+05
6.396140000000000000e+05
6.146880000000000000e+05
5.808160000000000000e+05
5.430940000000000000e+05
5.042080000000000000e+05
4.659060000000000000e+05
4.289770000000000000e+05
3.925770000000000000e+05
3.592180000000000000e+05
3.343380000000000000e+05
3.155590000000000000e+05
2.999050000000000000e+05
2.894370000000000000e+05
2.837890000000000000e+05
2.803700000000000000e+05
2.742480000000000000e+05
2.634710000000000000e+05
2.498110000000000000e+05
2.347390000000000000e+05
2.241040000000000000e+05
2.105870000000000000e+05
1.911590000000000000e+05
1.738450000000000000e+05
1.575440000000000000e+05
1.425450000000000000e+05
1.294400000000000000e+05
1.173900000000000000e+05
1.059000000000000000e+05
9.481700000000000000e+04
8.413800000000000000e+04
7.382200000000000000e+04
6.413700000000000000e+04
5.568700000000000000e+04
4.872500000000000000e+04
4.328600000000000000e+04
3.897500000000000000e+04
3.503800000000000000e+04
3.112000000000000000e+04
2.719000000000000000e+04
2.328400000000000000e+04
1.948100000000000000e+04
1.592200000000000000e+04
1.255500000000000000e+04
9.524000000000000000e+03
7.041000000000000000e+03
5.101000000000000000e+03
3.629000000000000000e+03
2.551000000000000000e+03
1.773000000000000000e+03
1 change: 1 addition & 0 deletions ogzaf/macro_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import statsmodels.api as sm
from ogzaf.utils import get_legacy_session
from io import StringIO
import requests


def get_macro_params():
Expand Down
5 changes: 5 additions & 0 deletions tests/test_demog_jdebacker.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from ogcore.parameters import Specifications
from ogzaf.calibrate import Calibration

p = Specifications()
c = Calibration(p, estimate_pop=True)

0 comments on commit b68c6b9

Please sign in to comment.