将栅格数据导入NetLogo会导致NaN值的行/列 [英] Importing raster data into NetLogo results in a row/column of NaN values

查看:154
本文介绍了将栅格数据导入NetLogo会导致NaN值的行/列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将栅格导入NetLogo时,沿着NetLogo世界的其中一个边界添加了额外的行或列的NaN像元,而栅格中不存在该边界.

When importing rasters into NetLogo, there is an additional row or column of NaN cells that are added along one of the borders of the NetLogo world, which does not exist in the raster.

是否与此处提出的问题相同: https://github.com /NetLogo/GIS-Extension/issues/5 ?但就我而言,它们不是具有NaN值的随机单元,而是沿边界的单元.

Is this the same issue that was raised here: https://github.com/NetLogo/GIS-Extension/issues/5 ? In my case though, they are not random cells that have a value of NaN but cells along a border.

这是我用来导入栅格图层的代码:

Here's the code I used to import the raster layer:

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

推荐答案

非常感谢塞思,您从共享线程获得的注释解决了这个谜团:

Thanks a lot Seth this comment from the thread you shared solves the mystery:

'netlogo世界从0开始,而ASCII的gis:width-从1开始.'

'the netlogo world starts at 0, while the gis:width-of an ascii starts at 1.'

因此,我认为在设置NetLogo世界的宽度和高度时减去1会有所帮助.

So I think subtracting 1 while setting the width and height of the NetLogo world would help.

这篇关于将栅格数据导入NetLogo会导致NaN值的行/列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆