This forum is shutting down! Please post new discussions at community.naturalcapitalproject.org

Recreation model error

Hi everyone i have an error in recreational model could someone help?

12/08/2017 16:28:25 root INFO Logging will be saved to natcap.invest.recreation.recmodel_client-log-2017-12-08--16_28_25.txt

12/08/2017 16:28:25 root DEBUG Loaded the model from natcap.invest.recreation.recmodel_client

12/08/2017 16:28:25 root INFO Executing the loaded model

12/08/2017 16:28:25 root INFO Running InVEST version "3.3.3"

12/08/2017 16:28:25 root INFO Python architecture: ('32bit', 'WindowsPE')

12/08/2017 16:28:25 root INFO Disk space remaining for workspace: 5.7 TB

12/08/2017 16:28:25 root INFO Pointing temporary directory at the workspace at \\uol.le.ac.uk\root\student\home\m\mk586\Desktop Files\Coursework 3 GY7310\mapinvest

12/08/2017 16:28:25 root INFO Starting natcap.invest.recreation.recmodel_client

12/08/2017 16:28:25 root INFO Setting tempfile.tempdir to \\uol.le.ac.uk\root\student\home\m\mk586\Desktop Files\Coursework 3 GY7310\mapinvest\tmp

12/08/2017 16:28:25 natcap.invest.recmodel_client INFO Contacting server, please wait.

12/08/2017 16:28:26 natcap.invest.recmodel_client INFO Server online, version: 3.3.2:./recserver_cache/0c010b5f4a698db8_fast_hash.pickle

12/08/2017 16:28:26 natcap.invest.recmodel_client INFO Server supports year queries between 2005 and 2014

12/08/2017 16:28:26 natcap.invest.recmodel_client INFO gridding aoi

12/08/2017 16:28:26 natcap.invest.recmodel_client INFO archiving \\uol.le.ac.uk\root\student\home\m\mk586\Desktop Files\Coursework 3 GY7310\mapinvest\aoi.prj

12/08/2017 16:28:26 natcap.invest.recmodel_client INFO archiving \\uol.le.ac.uk\root\student\home\m\mk586\Desktop Files\Coursework 3 GY7310\mapinvest\aoi.shp

12/08/2017 16:28:26 natcap.invest.recmodel_client INFO archiving \\uol.le.ac.uk\root\student\home\m\mk586\Desktop Files\Coursework 3 GY7310\mapinvest\aoi.shx

12/08/2017 16:28:26 natcap.invest.recmodel_client INFO archiving \\uol.le.ac.uk\root\student\home\m\mk586\Desktop Files\Coursework 3 GY7310\mapinvest\aoi.dbf

12/08/2017 16:28:26 natcap.invest.recmodel_client INFO Please wait for server to calculate PUD...

12/08/2017 16:28:34 natcap.invest.recmodel_client INFO received result, took 7.940000 seconds, workspace_id: 2b3202b3-deb6-4404-b6f3-8fa94aa3a846

12/08/2017 16:28:34 natcap.invest.recmodel_client INFO Calculating regression

12/08/2017 16:28:34 natcap.invest.recmodel_client INFO Building predictor Services

12/08/2017 16:28:35 natcap.invest.recmodel_client INFO gis.osm_pois_free_1.shp point distance: 100.00% complete

12/08/2017 16:28:35 natcap.invest.recmodel_client INFO Building predictor LandUse

12/08/2017 16:28:36 natcap.invest.recmodel_client INFO gis.osm_landuse_a_free_1.shp point distance: 100.00% complete

12/08/2017 16:28:36 natcap.invest.recmodel_client INFO Building predictor POFI

12/08/2017 16:28:37 natcap.invest.recmodel_client INFO gis.osm_pois_a_free_1.shp point distance: 100.00% complete

12/08/2017 16:28:37 natcap.invest.recmodel_client INFO Building predictor Beaches

12/08/2017 16:28:37 natcap.invest.recmodel_client INFO gis.osm_natural_a_free_1.shp point distance: 100.00% complete

12/08/2017 16:28:37 root ERROR ---------------------------------------------------

12/08/2017 16:28:37 root ERROR ---------------------- ERROR ----------------------

12/08/2017 16:28:37 root ERROR ---------------------------------------------------

12/08/2017 16:28:37 root ERROR Error: exception found while running natcap.invest.recreation.recmodel_client

12/08/2017 16:28:37 root DEBUG

12/08/2017 16:28:37 root DEBUG Build details

12/08/2017 16:28:37 root DEBUG Interpreter

12/08/2017 16:28:37 root DEBUG Current temp dir: \\uol.le.ac.uk\root\student\home\m\mk586\Desktop Files\Coursework 3 GY7310\mapinvest\tmp

12/08/2017 16:28:37 root DEBUG tempfile.tempdir: \\uol.le.ac.uk\root\student\home\m\mk586\Desktop Files\Coursework 3 GY7310\mapinvest\tmp

12/08/2017 16:28:37 root DEBUG

12/08/2017 16:28:37 root DEBUG System

12/08/2017 16:28:37 root DEBUG OS : Windows-7-6.1.7601-SP1

12/08/2017 16:28:37 root DEBUG Processor architecture: AMD64

12/08/2017 16:28:37 root DEBUG FS encoding : mbcs

12/08/2017 16:28:37 root DEBUG Preferred encoding: cp1252

12/08/2017 16:28:37 root DEBUG

12/08/2017 16:28:37 root DEBUG Python

12/08/2017 16:28:37 root DEBUG Version : 2.7.9

12/08/2017 16:28:37 root DEBUG Build : ('default', 'Dec 10 2014 12:24:55')

12/08/2017 16:28:37 root DEBUG Compiler : MSC v.1500 32 bit (Intel)

12/08/2017 16:28:37 root DEBUG Implementation : CPython

12/08/2017 16:28:37 root DEBUG Architecture : 32bit

12/08/2017 16:28:37 root DEBUG Linkage format : WindowsPE

12/08/2017 16:28:37 root DEBUG

12/08/2017 16:28:37 root DEBUG Packages

12/08/2017 16:28:37 root DEBUG Cython : ?

12/08/2017 16:28:37 root DEBUG Numpy : 1.11.2

12/08/2017 16:28:37 root DEBUG Scipy : 0.16.1

12/08/2017 16:28:37 root DEBUG OSGEO : 1.11.3

12/08/2017 16:28:37 root DEBUG Shapely : 1.5.5

12/08/2017 16:28:37 root DEBUG InVEST : 3.3.3

12/08/2017 16:28:37 root DEBUG

12/08/2017 16:28:37 root DEBUG

12/08/2017 16:28:37 root DEBUG Exception not environment-related

12/08/2017 16:28:37 root DEBUG Printing traceback

Traceback (most recent call last):

File "C:\Users\natcap-servers\jenkins-home\workspace\natcap.invest\label\GCE-windows-1\exe\build\invest\out00-PYZ.pyz\natcap.invest.iui.executor", line 620, in runModel

File "C:\Users\natcap-servers\jenkins-home\workspace\natcap.invest\label\GCE-windows-1\exe\build\invest\out00-PYZ.pyz\natcap.invest.recreation.recmodel_client", line 261, in execute

File "C:\Users\natcap-servers\jenkins-home\workspace\natcap.invest\label\GCE-windows-1\exe\build\invest\out00-PYZ.pyz\natcap.invest.recreation.recmodel_client", line 850, in _build_regression

File "C:\Users\natcap-servers\jenkins-home\workspace\natcap.invest\label\GCE-windows-1\exe\build\invest\out00-PYZ.pyz\numpy.linalg.linalg", line 1889, in lstsq



ValueError: math domain error



12/08/2017 16:28:37 root ERROR Exiting due to failures

Comments

  • DaveDave Member, Administrator, NatCap Staff
    Hi @mk586,

    Thanks for posting. I think we'll need your data to reproduce and debug this. Could you share your predictor datasets and your AOI shapefile with me via dropbox? To davefisher@stanford.edu

    Thanks,

  • Thank you for the response @Dave, done.

  • DaveDave Member, Administrator, NatCap Staff
    Got it. I'll try out your data as soon as I can and post back here with what I find.
  • Hi I upload again the data in zip file you can have a look now.
  • RichRich Administrator, NatCap Staff
    Hi @mk586, I took a look at your run on the server side, and it looks like your AOI polygon is totally empty. Can you verify that you're not passing an empty shapefile as the AOI?
  • mk586mk586 Member
    edited December 2017
    I double check and no one of them is empty
    Post edited by mk586 on
  • DaveDave Member, Administrator, NatCap Staff
    Hi @mk586,

    Thanks for sharing your data. I took a look and the problem is that your AOI shapefile is a polyline geometry instead of a polygon. So when the model tried to divide it into grid cells, it could not fit any grid cells inside. That explains why it looked empty to Rich.

    So, please try a polygon instead of a line for the AOI. It looks like your coastline is a closed loop, so you should be able to use a "polyline to polygon" tool in GIS.
  • DaveDave Member, Administrator, NatCap Staff
    One more tip...If you wish to divide the AOI area into grid cells, with the "Grid AOI" option, the "cell size" units will be the same units as the AOI shapefile's coordinate system. Right now your coordinate system is lat/lon degrees, so at the same time that you convert to polygon, you may wish to project your AOI into a system like UTM, which uses meters, so that you can specify the cell size in meters.

    Best,
    Dave
  • Thabk you for your help and advise .I Change the coastline now to another shapefile which is a polygon and this error appeared.



    Initializing...

    12/11/2017 17:48:19 root DEBUG Loading <module 'natcap.invest.recreation.recmodel_client' from 'V:\BELUQJ7U.FWG\INVEST~1.3_X\INVEST~1\natcap\invest\recreation\recmodel_client.pyc'> in frozen environment

    Arguments:

    aoi_path //uol.le.ac.uk/root/student/home/m/mk586/Desktop Files/Coursework 3 GY7310/mapinvest/gis.osm_places_a_free_1.shp

    cell_size 7000.0

    compute_regression True

    end_year 2014

    grid_aoi True

    grid_type hexagon

    predictor_table_path //uol.le.ac.uk/root/student/home/m/mk586/Desktop Files/Coursework 3 GY7310/mapinvest/tourist_points_in.csv

    results_suffix

    scenario_predictor_table_path V:\InVEST_3.3.3_C01\InVEST_3.3.3_x86\recreation\predictors_scenario.csv

    start_year 2005

    workspace_dir \\uol.le.ac.uk\root\student\home\m\mk586\Desktop Files\Coursework 3 GY7310\mapinvest



    12/11/2017 17:48:19 root INFO Logging will be saved to natcap.invest.recreation.recmodel_client-log-2017-12-11--17_48_19.txt

    12/11/2017 17:48:19 root DEBUG Loaded the model from natcap.invest.recreation.recmodel_client

    12/11/2017 17:48:19 root INFO Executing the loaded model

    12/11/2017 17:48:19 root INFO Running InVEST version "3.3.3"

    12/11/2017 17:48:19 root INFO Python architecture: ('32bit', 'WindowsPE')

    12/11/2017 17:48:19 root INFO Disk space remaining for workspace: 5.88 TB

    12/11/2017 17:48:19 root INFO Pointing temporary directory at the workspace at \\uol.le.ac.uk\root\student\home\m\mk586\Desktop Files\Coursework 3 GY7310\mapinvest

    12/11/2017 17:48:19 root INFO Starting natcap.invest.recreation.recmodel_client

    12/11/2017 17:48:19 root INFO Setting tempfile.tempdir to \\uol.le.ac.uk\root\student\home\m\mk586\Desktop Files\Coursework 3 GY7310\mapinvest\tmp

    12/11/2017 17:48:20 root ERROR ---------------------------------------------------

    12/11/2017 17:48:20 root ERROR ---------------------- ERROR ----------------------

    12/11/2017 17:48:20 root ERROR ---------------------------------------------------

    12/11/2017 17:48:20 root ERROR Error: exception found while running natcap.invest.recreation.recmodel_client

    12/11/2017 17:48:20 root DEBUG

    12/11/2017 17:48:20 root DEBUG Build details

    12/11/2017 17:48:20 root DEBUG Interpreter

    12/11/2017 17:48:20 root DEBUG Current temp dir: \\uol.le.ac.uk\root\student\home\m\mk586\Desktop Files\Coursework 3 GY7310\mapinvest\tmp

    12/11/2017 17:48:20 root DEBUG tempfile.tempdir: \\uol.le.ac.uk\root\student\home\m\mk586\Desktop Files\Coursework 3 GY7310\mapinvest\tmp

    12/11/2017 17:48:20 root DEBUG

    12/11/2017 17:48:20 root DEBUG System

    12/11/2017 17:48:20 root DEBUG OS : Windows-7-6.1.7601-SP1

    12/11/2017 17:48:20 root DEBUG Processor architecture: AMD64

    12/11/2017 17:48:20 root DEBUG FS encoding : mbcs

    12/11/2017 17:48:20 root DEBUG Preferred encoding: cp1252

    12/11/2017 17:48:20 root DEBUG

    12/11/2017 17:48:20 root DEBUG Python

    12/11/2017 17:48:20 root DEBUG Version : 2.7.9

    12/11/2017 17:48:20 root DEBUG Build : ('default', 'Dec 10 2014 12:24:55')

    12/11/2017 17:48:20 root DEBUG Compiler : MSC v.1500 32 bit (Intel)

    12/11/2017 17:48:20 root DEBUG Implementation : CPython

    12/11/2017 17:48:20 root DEBUG Architecture : 32bit

    12/11/2017 17:48:20 root DEBUG Linkage format : WindowsPE

    12/11/2017 17:48:20 root DEBUG

    12/11/2017 17:48:20 root DEBUG Packages

    12/11/2017 17:48:20 root DEBUG Cython : ?

    12/11/2017 17:48:20 root DEBUG Numpy : 1.11.2

    12/11/2017 17:48:20 root DEBUG Scipy : 0.16.1

    12/11/2017 17:48:20 root DEBUG OSGEO : 1.11.3

    12/11/2017 17:48:20 root DEBUG Shapely : 1.5.5

    12/11/2017 17:48:20 root DEBUG InVEST : 3.3.3

    12/11/2017 17:48:20 root DEBUG

    12/11/2017 17:48:20 root DEBUG

    12/11/2017 17:48:20 root DEBUG Exception not environment-related

    12/11/2017 17:48:20 root DEBUG Printing traceback

    Traceback (most recent call last):

    File "C:\Users\natcap-servers\jenkins-home\workspace\natcap.invest\label\GCE-windows-1\exe\build\invest\out00-PYZ.pyz\natcap.invest.iui.executor", line 620, in runModel

    File "C:\Users\natcap-servers\jenkins-home\workspace\natcap.invest\label\GCE-windows-1\exe\build\invest\out00-PYZ.pyz\natcap.invest.recreation.recmodel_client", line 149, in execute

    File "C:\Users\natcap-servers\jenkins-home\workspace\natcap.invest\label\GCE-windows-1\exe\build\invest\out00-PYZ.pyz\natcap.invest.recreation.recmodel_client", line 1040, in _validate_same_ids_and_types

    ValueError: table pairs unequal.

    predictor: set([(u'Natural', u'point_count'), (u'Services', u'point_count'), (u'Waterp', u'polygon_area_coverage'), (u'Airports', u'point_count'), (u'LandUse', u'polygon_area_coverage'), (u'Beaches', u'polygon_area_coverage'), (u'Poin', u'polygon_area_coverage')])

    scenario:set([(u'bonefish', u'polygon_percent_coverage'), (u'airdist', u'point_nearest_distance'), (u'elevation', u'raster_mean'), (u'roads', u'polygon_percent_coverage'), (u'ports', u'point_count'), (u'beaches', u'line_intersect_length')])



    12/11/2017 17:48:20 root ERROR Exiting due to failures

  • DaveDave Member, Administrator, NatCap Staff
    Thanks for the update. Are you sure you want to be running a scenario? It looks like you are using the default scenario predictors table, but that won't match any of your predictor datasets, which is resulting in the error. Best to leave the scenario table blank until the rest of the model is working for you. See some usage tips here: http://data.naturalcapitalproject.org/nightly-build/invest-users-guide/html/recreation.html#running-the-model
  • Sorry for the awful  mistake i run it without to take out the scenario. I run it again and the MATHEMATICAL ERROR is still the same.
  • DaveDave Member, Administrator, NatCap Staff
    No problem! Well the cause of the error may be the same as before then. Double-check your AOI and confirm that it contains polygons, and check the coordinate system, based on my comment from above about the "cell size". Or try it without the "Grid AOI" option, if your AOI contains multiple features.
  • I double check it and i use two different shape files in case that one of them is the problem. But is still the same error and i also run it how you advice me without the Grid of AOI and again the same problem.
  • DaveDave Member, Administrator, NatCap Staff
    Okay, in that case please upload your latest logfile and also share the new data you are using via dropbox and I will try to reproduce the problem.
  • I uploaded them agian 
  • DaveDave Member, Administrator, NatCap Staff
    Thank you @mk586. I was able to reproduce the math domain error. And I was also able to run the model without errors.

    The error is generated because the "Cell Size" value is too large. Your AOI shapefile and all the predictor datasets use a WGS84 lat/lon coordinate system. This means distances are measured in decimal degrees. If you choose a Cell Size of 7000, the model tries to make grid cells that are 7000 degrees wide. No cells of that size fit within your AOI, so the model creates 0 grid cells and returns the math domain error when it tries to fit a linear regression model with 0 data points.

    You may choose from these three options to avoid this problem. I tested options A and B and received no errors:

    A) Do not check the box for "Grid the AOI"

    B) Check the box for "Grid the AOI" and choose an appropriate Cell Size. For example 0.1 degrees roughly equals 10 km.

    C) If you wish to specify your Cell Size in meters, then first transform all of your GIS data to a different coordinate system that uses meters instead of degrees for the units. UTM systems are a good choice.

    Please see my logfile for an example of a successful run. The input parameters I chose are at the top. If you continue seeing errors, please double-check your inputs, and please be sure to post the logfile that details the errors. That makes it much easier for us to help!

    Best,
    Dave
Sign In or Register to comment.