Reputation: 85
I am trying to load an ascii into Netlogo with apply-raster from the GIS extension. While I did this many times before (although not with this specific ascii), netlogo now throws the following error:
extension exception: 1944553
error while observer running GIS:APPLY-RASTER
I am not sure why this is happening. The ascii has a projection file with it (WKT), which should work fine:
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
The ascii itself has these parameters:
ncols 1481
nrows 1314
xllcorner -10.577897001
yllcorner 49.902509998994
cellsize 0.00833333333333
NODATA_value -9999
I am running these four lines for loading the ascii and resizing the world.
set my-dataset "data/my-folder/my-file.asc"
resize-world 0 gis:width-of (gis:load-dataset my-dataset) - 1 0 gis:height-of (gis:load-dataset my-dataset) - 1
gis:set-world-envelope-ds (gis:envelope-of (gis:load-dataset my-dataset))
gis:apply-raster (gis:load-dataset my-dataset) my-variable
Is anyone familiar with this error? Or is there a place where I can look up what this extension exception means? I could not find it, but maybe I am looking in the wrong places.
Thanks!
edit: See below for the details of the error
Extension exception: 1944553
error while observer running GIS:APPLY-RASTER
called by procedure LOAD-DATASETS
called by procedure CREATE-WORLD
called by Button 'create-world'
org.nlogo.nvm.EngineException: Extension exception: 1944553
at org.nlogo.agent.World.fastGetPatchAt(World.java:560)
at org.nlogo.agent.World.fastGetPatchAt(World.java:35)
at org.myworldgis.netlogo.ApplyRaster.performInternal(ApplyRaster.java:53)
at org.myworldgis.netlogo.GISExtension$Command.perform(GISExtension.java:63)
at org.nlogo.prim._extern.perform(_extern.java:54)
at org.nlogo.nvm.Context.stepConcurrent(Context.java:91)
at org.nlogo.nvm.ConcurrentJob.step(ConcurrentJob.java:82)
at org.nlogo.job.JobThread.org$nlogo$job$JobThread$$runPrimaryJobs(JobThread.scala:143)
at org.nlogo.job.JobThread$$anonfun$run$1.apply$mcV$sp(JobThread.scala:78)
at org.nlogo.job.JobThread$$anonfun$run$1.apply(JobThread.scala:76)
at org.nlogo.job.JobThread$$anonfun$run$1.apply(JobThread.scala:76)
at scala.util.control.Exception$Catch.apply(Exception.scala:88)
at org.nlogo.util.Exceptions$.handling(Exceptions.scala:41)
at org.nlogo.job.JobThread.run(JobThread.scala:75)
NetLogo 5.2.0
main: org.nlogo.app.AppFrame
thread: JobThread
Java HotSpot(TM) Server VM 1.6.0_45 (Sun Microsystems Inc.; 1.6.0_45-b06)
operating system: Windows 7 6.1 (x86 processor)
Scala version 2.9.2
JOGL: (3D View not initialized)
OpenGL Graphics: (3D View not initialized)
model: test_run_world
03:23:17.778 SwitchedTabsEvent (org.nlogo.app.Tabs) AWT-EventQueue-0
03:23:17.778 RuntimeErrorEvent (org.nlogo.app.App$$anon$1 (org.nlogo.window.GUIWorkspace)) AWT-EventQueue-0
03:23:17.778 InterfaceGlobalEvent (org.nlogo.window.ChooserWidget) AWT-EventQueue-0
03:23:17.778 InterfaceGlobalEvent (org.nlogo.window.InputBoxWidget) AWT-EventQueue-0
03:23:17.778 InterfaceGlobalEvent (org.nlogo.window.InputBoxWidget) AWT-EventQueue-0
03:23:17.778 InterfaceGlobalEvent (org.nlogo.app.InterfacePanel$2 (org.nlogo.window.SliderWidget)) AWT-EventQueue-0
03:23:17.778 InterfaceGlobalEvent (org.nlogo.window.ChooserWidget) AWT-EventQueue-0
03:23:17.778 InterfaceGlobalEvent (org.nlogo.window.ChooserWidget) AWT-EventQueue-0
03:23:17.778 InterfaceGlobalEvent (org.nlogo.window.ChooserWidget) AWT-EventQueue-0
03:23:17.778 InterfaceGlobalEvent (org.nlogo.widget.SwitchWidget) AWT-EventQueue-0
Upvotes: 1
Views: 599
Reputation: 85
The issue was finally solved after recreating all ascii files. Even though there was no apparent difference in the old and new ascii files, the old files must have been corrupted somehow. The code in the question works fine now. Hopefully this topic is still helpful for anybody running into the same error.
Upvotes: 1
Reputation: 198
I'm pretty sure there is an off-by-one error in RasterDataset.resample, but I've never had the time to look into it. You should be able to work around this issue by removing the "- 1"'s from your call to resize-world, i.e.,
resize-world 0 gis:width-of (gis:load-dataset my-dataset) 0 gis:height-of (gis:load-dataset my-dataset)
If that doesn't work, let me know and I'll see if I can find time to investigate further.
Upvotes: 1