Skip to Content.

mget-help - RE: [mget-help] Issue with visualizing simulation results : MGET

Please Wait...

Subject: Marine Geospatial Ecology Tools (MGET) help

Text archives


RE: [mget-help] Issue with visualizing simulation results : MGET


Chronological Thread 
  • From: Jason Roberts <>
  • To: Young Jin <>
  • Cc: "" <>
  • Subject: RE: [mget-help] Issue with visualizing simulation results : MGET
  • Date: Tue, 31 Jul 2018 21:27:43 +0000
  • Accept-language: en-US
  • Spamdiagnosticmetadata: NSPM
  • Spamdiagnosticoutput: 1:99

Dear Young,

 

I am back from my travels. I was able to reproduce and fix the problem.

 

Ultimately, it was a bug in the open-source GDAL library that MGET utilizes internally. I had not detected this problem before because all of my test data involves at least one Patch ID that is greater than 127, which fails to reveal the problem. When all of the Patch IDs are less than this, ArcGIS may store MGET’s copy of the Patch IDs raster with a signed 8-bit data type. This data type can range from -128 to 127, and with Patch ID data, it will use the value -1 for NoData. GDAL was not reading this correctly; it reported to MGET that the NoData value was 255, which is what you get if you assume that -1 is actually an unsigned 8-bit integer rather than a signed 8-bit integer. I have a distant memory that GDAL did not use to handle signed 8-bit data very well. This might be related to that. In any case, MGET is using an fairly old version of GDAL at this point. Most likely, the GDAL team fixed this problem long ago. I will eventually update GDAL, but that is a big job that requires recompilation and testing of a bunch of other things, so I have been delaying it. For now, I have patched MGET to work around this GDAL bug.

 

To apply this patch:

 

1.    Close all ArcGIS programs.

 

2.    Save the attached file to the C:\Python27\ArcGIS10.5\lib\site-packages\GeoEco\DataManagement directory, overwriting the file that is there.

 

3.    Restart ArcGIS and try the Summarize Larval Simulation tool again.

 

Please let me know how it goes.

 

Best,

Jason

 

From: Young Jin <>
Sent: Monday, July 9, 2018 10:25 PM
To: Jason Roberts <>;
Subject: Re: Issue with visualizing simulation results : MGET

 

Dear Jason,

 

Thanks for your reply. Please see attached files I'm recently working with. I still get the same error message: "The first argument of bincount must be non-negative". But I found larval density data in "Results" file! and still no connectivity data ...

 

Thanks.

 

Young

 


From: Jason Roberts <>
Sent: Tuesday, 10 July 2018 4:07 AM
To: Young Jin;
Subject: RE: Issue with visualizing simulation results : MGET

 

Dear Young,

 

I’m very sorry to take so long to reply. I have been travelling and in meetings for most of the past month. This will finally end this week. I can look at this problem in detail next week.

 

I believe you are correct that there is nothing wrong with your files. I suspect the problem is that MGET did not anticipate that ArcGIS might use a negative number to represent the “no data value” in some of the simulation rasters. The error message comes from a function in the Python numpy package that MGET is using to compute some counts. That function requires there be no negative numbers in the input data. I suspect that MGET needs to change the negative value representing “no data” to zero before calling the numpy function. But I will get back to you next week about it.

 

Best regards,

 

Jason

 

 

Dear sir,

 

I came across an error message "The first argument of bincount must be non-negative" after executing "Visualize Larval Dispersal Simulation Results (2012). I couldn't find anything wrong with my files. I believe all values and counts are non-negative. I would really apprecate it if you could help me with this. A whole error message is copied and pasted below. I also attached my three raster files.

 

Thanks,

 

Young 

 

Executing: LarvalDispersalVisualizeResults2012 E:\ArcGIS_files_YJIN\Test_LDS2\LDS E:\ArcGIS_files_YJIN\Test_LDS2\Results Test_output 0.1 A true 0.00001 false true 0.00001 Quantity

Start Time: Tue Jul 03 09:23:21 2018

Running script LarvalDispersalVisualizeResults2012...

Reading the simulation results from E:\ArcGIS_files_YJIN\Test_LDS2\Results\Results.pickle.

Creating the output geodatabase E:\ArcGIS_files_YJIN\Test_LDS2\Results\Test_output.gdb.

Importing 6 datasets into ArcGIS Workspace E:\ArcGIS_files_YJIN\Test_LDS2\Results\Test_output.gdb with mode "replace".

Import complete: 0:00:11 elapsed, 6 datasets imported, 0:00:01.848333 per dataset.

Creating raster catalog E:\ArcGIS_files_YJIN\Test_LDS2\Results\Test_output.gdb\Density.

Loading rasters into the raster catalog.

Retrieving raster paths from the raster catalog.

Finished retrieving paths: 0:00:00 elapsed, 6 paths retrieved, 0:00:00.001666 per path.

Querying ArcGIS Workspace E:\ArcGIS_files_YJIN\Test_LDS2\Results\Test_output.gdb.

Query complete: 0:00:00 elapsed, 6 datasets found, 0:00:00.037500 per dataset.

Updating the fields of each row of the raster catalog.

Update complete: 0:00:00 elapsed, 6 rows updated, 0 deleted, 0 unchanged, 0:00:00.000666 per row.

ValueError: The first argument of bincount must be non-negative

Failed script LarvalDispersalVisualizeResults2012...

 

Traceback (most recent call last):

  File "C:\Program Files\GeoEco\ArcGISToolbox\Scripts\LarvalDispersalVisualizeResults2012.py", line 5, in <module>

    ExecuteMethodFromCommandLineAsArcGISTool('GeoEco.Connectivity.LarvalDispersal', 'LarvalDispersal', 'VisualizeResults2012')

  File "C:\Python27\ArcGIS10.5\lib\site-packages\GeoEco\ArcGISScripts.py", line 210, in ExecuteMethodFromCommandLineAsArcGISTool

    exec sourceCode in globals(), locals()

  File "<string>", line 1, in <module>

  File "C:\Python27\ArcGIS10.5\lib\site-packages\GeoEco\Connectivity\LarvalDispersal.py", line 1371, in VisualizeResults2012

    probabilityMatrix = cls._ComputeProbabilityMatrix(simulationDirectory, settlementMatrix, metadata)[0]

  File "C:\Python27\ArcGIS10.5\lib\site-packages\GeoEco\Connectivity\LarvalDispersal.py", line 1543, in _ComputeProbabilityMatrix

    larvaeReleasedForPatch = numpy.bincount(patchIDsImage.flatten(), weights=patchCoverImage.flatten())

ValueError: The first argument of bincount must be non-negative

 

Failed to execute (LarvalDispersalVisualizeResults2012).

Failed at Tue Jul 03 09:23:42 2018 (Elapsed Time: 20.69 seconds)

 

Attachment: ArcGISRasters.py
Description: ArcGISRasters.py




Archive powered by MHonArc 2.6.19.

Top of Page