RIOS ZeroDivisionError: float division by zero

I met a mistake about Rios, but I don’t know what caused it. I hope someone can help me
natcap.rios-log-2023-04-04–19_31_08.txt (281.4 KB)

Hi @nishang1 -

Looking at the log file, the final specific error is
ZeroDivisionError: float division by zero

So then if I read the lines before the final error message, it shows that you’ve allocated money to the different activities:
'budget_config': {u'years_to_spend': 5, u'activity_budget': {u'Forest resource management': {u'budget_amount': 58054500.0}, u'Forestry and grassland disaster prevention and relief': {u'budget_amount': 2208300.0}, u'Sand prevention and control': {u'budget_amount': 541800.0}, u'Wetland protection': {u'budget_amount': 3866300.0}, u'Returning farmland to forest and grassland': {u'budget_amount': 653200.0}}

… but then don’t seem to have assigned a cost or measurement length/area for those activities, and they have a value of 0:
u'measurement_unit': u'area', u'measurement_value': 0.0, 'prioritization_raster_uri': u'D:\\Result\\2015nianahuju\\senserios\\two\\1_investment_portfolio_adviser_workspace\\activity_scores\\Forest resource management_2020.tif', u'unit_cost': 0.0}, u'Forestry and grassland disaster prevention and relief': {'output_id': 1, u'measurement_unit': u'area', u'measurement_value': 0.0, 'prioritization_raster_uri': u'D:\\Result\\2015nianahuju\\senserios\\two\\1_investment_portfolio_adviser_workspace\\activity_scores\\Forestry and grassland disaster prevention and relief_2020.tif', u'unit_cost': 0.0}, u'Sand prevention and control': {'output_id': 3, u'measurement_unit': u'area', u'measurement_value': 0.0, 'prioritization_raster_uri':

So check to make sure that you’ve assigned values for the activity cost (“Cost per unit”) and unit of measurement (“Length (m) or Area (m^2)”) and see if that helps.

~ Stacie

1 Like

Hi,@swolny ,I have a doubt. In the manual, there are two ways to allocate funds. I have entered the total amount and specifically allocated the amount to each activity. Why is there such a mistake? When I run the software, there are still some other doubts. I would like to ask whether it is better to classify the land use data in detail, or just to classify it at the first level, and how to allocate the weight between the target transformations.

The two ways to allocate funds work like this:

1/ If you specify a “floating budget”, RIOS will choose which activities to spend the money on, which will generally be the least expensive ones. If you specify a floating budget, then you don’t need to enter anything into the “yearly activity allocation table”, but you still can if you want both methods to be used.

2/ If you want to specify that a certain amount of money is spent on each activity, enter that into the “yearly activity allocation table”. If you do this, then you don’t need to enter anything into the “floating budget”, but again you can if you want both methods to be used.

Regardless of which budget option you choose, you must enter values for the “cost per unit”, “measurement unit” and “length (m) or area (m^2)” for each activity. That’s the only way that RIOS knows how much each activity costs, which is of course necessary for calculating how much of the budget has been spent.

As for land use classification, it is entirely up to you to decide what kind of classification is most appropriate for your analysis. Sometimes it’s useful to have very specific classes. For example, some forest types might have different activities done with them than other forest types do, so in that case you’d want to have whatever specific forest classes are relevant to the activities. But sometimes it’s fine to have a single “forest” (or “agriculture” or whatever) class, if you are treating all forest the same.

~ Stacie

Oh oh, so that’s it. I see. Thank you for your answer. May I ask you one more question? I don’t know why there are many white squares in the general activity grid I made here for the next fifteen years, but there are no white squares in the activity grid every year.

natcap.rios-log-2023-04-06–16_49_17.txt (1.3 MB)

How many years did you specify for the model to run?

The RIOS User Guide describes the outputs this way:

**activity_portfolios**: Folder containing the selected activity portfolios. The main file
of interest is activity_portfolio_total.tif, which contains all of the activity areas
selected for the first year of the analysis. If more than one year was specified in the
Budget tab of the tool, separate portfolios for each year are saved in the
yearly_activity_portfolios folder, and cumulative portfolios (where, for example,
the year 2 portfolio contains activities selected in both years 1 and 2), are saved in
the folder continuous_activity_portfolios.

Looking back at it, this is not a very clear description, and I think it’s misleading. The output activity_portfolio_total.tif should contain all of the pixels selected for all activities over all of the years that you specified. The output activity_portfolio_continuous_year_1.tif represents only the activities selected in the first year. If you selected to run the model for multiple years, then you should also have activity_portfolio_continuous_year_2.tif, activity_portfolio_continuous_year_3.tif etc. And if you combine all of the activity_portfolio_continuous_#.tif layers, you should get the same result as activity_portfolio_total.tif.

~ Stacie

It turns out that my results are 15 years of data results, but what I am confused about at present is that there are many white □ in my results, just like in the picture, and I don’t know what caused it.

If the white areas represent places where there is no RIOS activity_portfolio data, then those places are not being chosen by RIOS to have activities done on them. It only has a limited amount of money to spend, so unless you give it a large enough budget to cover the whole area in activities, not all of the pixels will have activities assigned. Usually people use RIOS to choose only the best places to do an activity, so they can prioritize where to work first.

~ Stacie

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.