将栅格数据导入 NetLogo 会导致所有补丁变量 = 0 的列

Importing raster data into NetLogo results in a column with all patch variables = 0

当我使用这段代码将栅格图层导入 NetLogo 并调整世界大小时,最后一列的所有补丁变量都为零,而它应该包含数据。这种情况只发生在来自同一景观的几个栅格上。

set rasterLayer gis:load-dataset "x.asc"
resize-world 0 (gis:width-of rasterLayer) -1 0 (gis:height-of rasterLayer) -1
gis:set-world-envelope gis:envelope-of rasterLayer
gis: apply-raster rasterLayer 

在调整世界大小时没有“-1”,我得到一列 NaN 值 (Importing raster data into NetLogo results in a row/column of NaN values)。

此光栅的尺寸正确; 0值的列不是多余的,这意味着一些数据丢失了。

感谢@Tyr:发布了解决此可能错误的方法 。这是我为 NetLogo 6 使用的代码,以确保光栅已正确应用于 NetLogo 世界:

 file-open "data/my-folder/my-file.asc"
 let temp []
 repeat 6 [let header file-read-line] ; skip first 6 lines of header
 while [file-not-at-end?][
       set temp lput file-read temp 
]
 file-close
(foreach sort patches temp [
       [a b] -> ask a [ set my-variable b] 
 ] )