VUEG / priocomp

Data processing and analytics code for project "SP2: Comparing spatial prioritization methods for biodiversity conservation and ecosystem service supply in Europe"
MIT License
1 stars 2 forks source link

Dealing with NoData when optimizing with Gurobi #4

Closed jlehtoma closed 8 years ago

jlehtoma commented 8 years ago

Currently Gurobi (R-interface) will give the following error if layers in the rasterstack provided contain NAs:

Error in grb_solve(filename, rows, cols, obj, modelsense, modelname, objcon, : Error 10003: Element 0 of a double array is Nan.

The current R implementation of the priocomp optimization for 771 input rasters (4526 rows, 4410 cols) replaces all NAs with zeros, but this takes a lot of time for the full feature stack.

Must NAs always to be converted to zeros?

jlehtoma commented 8 years ago

Python/NumPy implementation would probably be faster.

jlehtoma commented 8 years ago

Now implemented in Python/NumPy. Note also that the R-implementation in prioritizr-package can deal with NoData.