我正在尝试使用GIS扩展中的apply-raster将ascii加载到Netlogo中。 虽然我之前做了很多次(虽然没有这个特定的ascii),netlogo现在抛出以下错误:
extension exception: 1944553
error while observer running GIS:APPLY-RASTER
我不确定为什么会这样。 ascii有一个投影文件(WKT),应该可以正常工作:
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
ascii本身有以下参数:
ncols 1481
nrows 1314
xllcorner -10.577897001
yllcorner 49.902509998994
cellsize 0.00833333333333
NODATA_value -9999
我正在运行这四行来加载ascii并调整世界大小。
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
是否有人熟悉此错误? 或者是否有一个地方可以查看此扩展异常的含义?我找不到它,但也许我在找错了地方。
谢谢!
编辑: 有关错误的详细信息,请参阅下文
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
答案 0 :(得分:1)
我非常确定RasterDataset.resample中存在一个错误的错误,但我从来没有时间去研究它。您应该能够通过从调用resize-world中删除" - 1"来解决这个问题,即
resize-world 0 gis:width-of (gis:load-dataset my-dataset) 0 gis:height-of (gis:load-dataset my-dataset)
如果这不起作用,请告诉我,我会看看是否可以抽出时间进一步调查。
答案 1 :(得分:1)
在重新创建所有ascii文件后,问题终于得以解决。即使旧的和新的ascii文件没有明显的区别,旧文件也必须以某种方式被破坏。问题中的代码现在运行正常。希望这个主题对于遇到同样错误的人来说仍然有用。