EAPD-DRB / OG-PHL

Overlapping-generations macroeconomic model for evaluating fiscal policy in the Philippines
https://eapd-drb.github.io/OG-PHL
Creative Commons Zero v1.0 Universal
6 stars 38 forks source link

My run_og_phl.py script stops due to bad g_n data #25

Closed dorothyobispo closed 1 month ago

dorothyobispo commented 1 month ago

When I try to run the run_og_phl.py file, I encounter the problem below where the program fails to retrieve UN population data.

python examples/run_og_phl.py
Number of workers =  7
/Users/dorothyobispo/Desktop/OG-Core/OG-PHL/examples/run_og_phl.py:47: DeprecationWarning: open_text is deprecated. Use files() instead. Refer to https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy for migration advice.
  with importlib.resources.open_text(
/Users/dorothyobispo/Desktop/OG-Core/OG-PHL/ogphl/macro_params.py:61: FutureWarning: errors='ignore' is deprecated and will raise in a future version. Use to_numeric without passing `errors` and catch exceptions explicitly instead
  ).read()
Demographics data: Initial Data year =  2022 , Final Data year =  2024
Failed to retrieve population data from UN. Reading  from https://github.com/EAPD-DRB/Population-Data instead of UN WPP API
Failed to retrieve population data from UN. Reading  from https://github.com/EAPD-DRB/Population-Data instead of UN WPP API
Failed to retrieve population data from UN. Reading  from https://github.com/EAPD-DRB/Population-Data instead of UN WPP API
Failed to retrieve population data from UN. Reading  from https://github.com/EAPD-DRB/Population-Data instead of UN WPP API
Success?  True , Max diff =  14128.921779852128
Max diff =  14128.921779852128
Demographics data: Initial Data year =  2022 , Final Data year =  2024
Failed to retrieve population data from UN. Reading  from https://github.com/EAPD-DRB/Population-Data instead of UN WPP API
Failed to retrieve population data from UN. Reading  from https://github.com/EAPD-DRB/Population-Data instead of UN WPP API
Failed to retrieve population data from UN. Reading  from https://github.com/EAPD-DRB/Population-Data instead of UN WPP API
Failed to retrieve population data from UN. Reading  from https://github.com/EAPD-DRB/Population-Data instead of UN WPP API
Success?  True , Max diff =  14128.921779852128
Max diff =  14128.921779852128
Traceback (most recent call last):
  File "/Users/dorothyobispo/Desktop/OG-Core/OG-PHL/examples/run_og_phl.py", line 122, in <module>
    main()
  File "/Users/dorothyobispo/Desktop/OG-Core/OG-PHL/examples/run_og_phl.py", line 56, in main
    p.update_specifications(updated_params)
  File "/opt/anaconda3/envs/ogphl-dev/lib/python3.11/site-packages/ogcore/parameters.py", line 451, in update_specifications
    self.adjust(revision, raise_errors=raise_errors)
  File "/opt/anaconda3/envs/ogphl-dev/lib/python3.11/site-packages/paramtools/parameters.py", line 257, in adjust
    return self._adjust(
           ^^^^^^^^^^^^^
  File "/opt/anaconda3/envs/ogphl-dev/lib/python3.11/site-packages/paramtools/parameters.py", line 375, in _adjust
    raise self.validation_error
paramtools.exceptions.ValidationError: {
    "errors": {
        "omega_S_preTP": [
            "omega_S_preTP [-0.0003541744662001213, -0.0003523814701423341, -0.0003477574721806304, -0.000341801714630695, -0.0003365341018162274, -0.00033185947855955217, -0.0003268522097235588, -0.0003212171164519559, -0.00031628560158626596, -0.0003120568847624828, -0.0003057602357875541, -0.0002971045134810725, -0.0002873283340441176, -0.00027698346276663395, -0.00026769659818446864, -0.00025973137445790736, -0.0002526577098276762, -0.000246519296101293, -0.0002418633829747868, -0.00023832193103954887, -0.00023436230099616197, -0.00022898390770595452, -0.00022154214086158135, -0.00021260203349084307, -0.0002039899509746074, -0.00019684460976044415, -0.00019102298896014796, -0.00018589894571062146, -0.00018236279949449138, -0.0001805213588852931, -0.00017793559651314378, -0.0001733496458527279, -0.00016717330513034437, -0.00016060712513027973, -0.00015509323091497776, -0.00015081062624157913, -0.00014651857626420773, -0.0001411024637074827, -0.00013541070620434132, -0.00013032956770641009, -0.00012537817766617, -0.00012004664604606687, -0.0001138766350896009, -0.00010706410668681608, -0.0001005314254207903, -9.439114093338927e-05, -8.795838283436192e-05, -8.100716893772243e-05, -7.435934860131125e-05, -6.846175309950269e-05, -6.293763410290336e-05, -5.806331670232811e-05, -5.225600732954089e-05, -4.4892960392319026e-05, -3.795554803178524e-05, -3.245298985833209e-05, -2.7968484306883284e-05, -2.44125698616989e-05, -2.1817069195861516e-05, -1.943176390463529e-05, -1.7056617609980896e-05, -1.487051378400945e-05, -1.288289486036161e-05, -1.0947522989852944e-05, -9.067122984851423e-06, -7.3532896370160716e-06, -5.9377548702630886e-06, -4.745823711219592e-06, -3.6584751969662177e-06, -2.559432633929415e-06, -3.979253029366138e-06, 1.9047043879535238e-05, -0.00017816732475255942, 0.0012901043491196902, -0.007840932783768394, 0.036950055630168344, -0.14042801072661998, 0.4187153605837909, -0.9555586801580457, 1.6580708944517624] < min 0.0 ",
            "omega_S_preTP [-0.0003541744662001213, -0.0003523814701423341, -0.0003477574721806304, -0.000341801714630695, -0.0003365341018162274, -0.00033185947855955217, -0.0003268522097235588, -0.0003212171164519559, -0.00031628560158626596, -0.0003120568847624828, -0.0003057602357875541, -0.0002971045134810725, -0.0002873283340441176, -0.00027698346276663395, -0.00026769659818446864, -0.00025973137445790736, -0.0002526577098276762, -0.000246519296101293, -0.0002418633829747868, -0.00023832193103954887, -0.00023436230099616197, -0.00022898390770595452, -0.00022154214086158135, -0.00021260203349084307, -0.0002039899509746074, -0.00019684460976044415, -0.00019102298896014796, -0.00018589894571062146, -0.00018236279949449138, -0.0001805213588852931, -0.00017793559651314378, -0.0001733496458527279, -0.00016717330513034437, -0.00016060712513027973, -0.00015509323091497776, -0.00015081062624157913, -0.00014651857626420773, -0.0001411024637074827, -0.00013541070620434132, -0.00013032956770641009, -0.00012537817766617, -0.00012004664604606687, -0.0001138766350896009, -0.00010706410668681608, -0.0001005314254207903, -9.439114093338927e-05, -8.795838283436192e-05, -8.100716893772243e-05, -7.435934860131125e-05, -6.846175309950269e-05, -6.293763410290336e-05, -5.806331670232811e-05, -5.225600732954089e-05, -4.4892960392319026e-05, -3.795554803178524e-05, -3.245298985833209e-05, -2.7968484306883284e-05, -2.44125698616989e-05, -2.1817069195861516e-05, -1.943176390463529e-05, -1.7056617609980896e-05, -1.487051378400945e-05, -1.288289486036161e-05, -1.0947522989852944e-05, -9.067122984851423e-06, -7.3532896370160716e-06, -5.9377548702630886e-06, -4.745823711219592e-06, -3.6584751969662177e-06, -2.559432633929415e-06, -3.979253029366138e-06, 1.9047043879535238e-05, -0.00017816732475255942, 0.0012901043491196902, -0.007840932783768394, 0.036950055630168344, -0.14042801072661998, 0.4187153605837909, -0.9555586801580457, 1.6580708944517624] > max 1.0 "
        ],
        "g_n": [
            "g_n [-1.0112678350371962, 0.01962052778409879, 0.0196805913906558, 0.01946239792118718, 0.018978298890850346, 0.01862268209336789, 0.018535830374630236, 0.0181959863366628, 0.017535692823127055, 0.017140508698722096, 0.016606183969789516, 0.015736960540207054, 0.014598559303401995, 0.01366500174082816, 0.013343840254432218, 0.012716822069043811, 0.011821654493389623, 0.010676904087724705, 0.008031635991475912, 0.005582542344390927, 0.004880124226964919, 0.004678304396232507, 0.004447099584091364, 0.0041917689388948735, 0.00413392775197956, 0.004062383771552536, 0.003982548334988863, 0.003892792794190174, 0.003790836539312256, 0.003674657535073281, 0.0035439682586724656, 0.0033981937278576005, 0.0032370556138995644, 0.0030595344915136232, 0.0028579410299231145, 0.0026232497815536146, 0.0023507578254834682, 0.002038149475310981, 0.0016876623129787982, 0.001305740046089362, 0.0009001047055540985, 0.0004775576647166331, 4.416525657580619e-05, -0.0003944772131421942, -0.000833052768462914, -0.0012667241365811712, -0.0016914377057632734, -0.0021036345542038786, -0.0024992560546761656, -0.0028738499317328297, -0.0032237507594644445, -0.0035464151762375352, -0.0038403092288786956, -0.004104685424028785, -0.004339079903157554, -0.004543288059606649, -0.004718049874270919, -0.0048652520466272746, -0.004986700801266833, -0.005084023447996386, -0.00515966315940668, -0.00521682182707851, -0.005259001178458049, -0.005289614860671063, -0.0053123663350399634, -0.005330764527149956, -0.005346948662476608, -0.005362532963313037, -0.005378468414153915, -0.00539480434055355, -0.005410876427983569, -0.0054254295647203675, -0.005437647352695537, -0.005446711749024915, -0.0054519911132330685, -0.00545424839756118, -0.005452922535316065, -0.005446121443393877, -0.005433328953732065, -0.00541496195584615, -0.005391793461893151, -0.005364883316090065, -0.0053359500749550195, -0.005306781663712231, -0.0052791191364214484, -0.005254673419633066, -0.005234968584945383, -0.005220935120055948, -0.005212886619666047, -0.005210928500327117, -0.005214859524540594, -0.005223975778562183, -0.005237159574056124, -0.005253201440461433, -0.005271162045259183, -0.005290043028113104, -0.005308719290427779, -0.005326203220705757, -0.00534145097831838, -0.00535400040278606, -0.005364179665759254, -0.005372171363567274, -0.005377743302197651, -0.00538063725745856, -0.0053808787677734095, -0.0053786755157859715, -0.005374331588172301, -0.005368214346412019, -0.0053607272706026445, -0.005352284763150373, -0.005343294204645324, -0.005334143147563513, -0.005325189733072505, -0.0053167558119358, -0.0053091198411531594, -0.005302510572071564, -0.005297104242533324, -0.005293023975801498, -0.00529033994286969, -0.005289070219869318, -0.005289182032227647, -0.005290593446247809, -0.005293177056257258, -0.005296765684896165, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833, -0.005322075467803833] < min -1.0 "
        ]
    }
}

Thank you so much for the assistance!

SeaCelo commented 1 month ago

@dorothyobispo when you run this are you connected to the internet? If the code fails to reach the UN API it tries to download the data from a data repository (https://github.com/EAPD-DRB/Population-Data). In either case you need internet access.

rickecon commented 1 month ago

Fixed. This was an issue where @dorothyobispo's version of both the ogphl-dev conda environment and OG-PHL repository files were out of date. We updated her files and created a new ogphl-dev conda environment, and everything returned to full working status.