allfed / allfed-integrated-model

Integrated model to calculate the effects of resilient foods in catastrophic events
https://allfed.github.io/allfed-integrated-model/
GNU General Public License v3.0
11 stars 10 forks source link

Warnings in tests #145

Open lukaszgajewski opened 1 week ago

lukaszgajewski commented 1 week ago

We're hitting some warnings in our tests:

tests/test_argentina_parameters.py: 384 warnings
tests/test_individual_scenarios.py: 14 warnings
  allfed-integrated-model/src/scenarios/run_model_no_trade.py:231: FutureWarning: The geopandas.dataset module is deprecated and will be removed in GeoPandas 1.0. You can get the original 'naturalearth_lowres' data from https://www.naturalearthdata.com/downloads/110m-cultural-vectors/.
    world = gpd.read_file(gpd.datasets.get_path("naturalearth_lowres"))

tests/test_argentina_parameters.py: 384 warnings
tests/test_individual_scenarios.py: 142 warnings
  allfed-integrated-model/src/optimizer/validate_results.py:525: RuntimeWarning: invalid value encountered in divide
    100.0 * min_human_food_consumption[food_name].kcals / available_food

tests/test_argentina_parameters.py: 384 warnings
tests/test_individual_scenarios.py: 170 warnings
  intmodel/lib/python3.12/site-packages/pandas/core/frame.py:717: DeprecationWarning: Passing a BlockManager to GeoDataFrame is deprecated and will raise in a future version. Use public APIs instead.

1st and 3rd seem to be rather minor (deprecation warnings) but we seem to be hitting a division by zero in the validator which might be something worth looking into.

morganrivers commented 1 week ago

allfed-integrated-model/src/optimizer/validate_results.py Line 525

So I was just making sure here that the amount of food used is in line with the prioritization in every month. That is the prioritization for specifically round 2 of optimization. I'd available food is zero, then we end up skipping the assertion (basically that means there is no order because one or more are zero). So it's not an issue. Easily fixed by just checking if it's zero earlier in the function and continuing the loop in that case