为什么 Netlogo 从输入文件中导出具有不同单元大小的 asc 结果?

问题描述 投票:0回答:1

我有一个使用 GIS 数据(数字地形模型 -DTM- 的 ascii 和道路的另一个)构建的模型,两个输入的块分辨率均为 30 * 30 米(请参阅 )。运行模型并将结果信息导入ArcGis Pro后,我发现栅格的像素大小为50*50米()。我认为输出的面片/像素大小与输入信息相同。 ..至少大约,并且它们之间没有20m的差异... 这是GIS扩展的代码:

to setup-terrain ;; Pull in the asc terrain files and apply it to create patch data from gis data.
  set elevation gis:load-dataset "dtm_30m.asc" ;; change the GIS terrain data by changing this file.
  gis:set-world-envelope gis:envelope-of elevation
  let horizontal-gradient gis:convolve elevation 3 3 [ 1 1 1 0 0 0 -1 -1 -1 ] 1 1
  let vertical-gradient gis:convolve elevation 3 3 [ 1 0 -1 1 0 -1 1 0 -1 ] 1 1
  set slope gis:create-raster gis:width-of elevation gis:height-of elevation gis:envelope-of elevation
  set aspect gis:create-raster gis:width-of elevation gis:height-of elevation gis:envelope-of elevation
  let x 0
  repeat (gis:width-of slope)
  [ let y 0
    repeat (gis:height-of slope)
    [ let gx gis:raster-value horizontal-gradient x y
      let gy gis:raster-value vertical-gradient x y
      if ((gx <= 0) or (gx >= 0)) and ((gy <= 0) or (gy >= 0))
      [ let s sqrt ((gx * gx) + (gy * gy))
        gis:set-raster-value slope x y s
        ifelse (gx != 0) or (gy != 0)
        [ gis:set-raster-value aspect x y atan gy gx ]
        [ gis:set-raster-value aspect x y 0 ] ]
      set y y + 1 ]
    set x x + 1 ]
  gis:set-sampling-method aspect "bilinear"
  gis:apply-raster elevation p-elevation ;; take all the data from the raster and apply it onto a given patch variable
  gis:apply-raster aspect p-aspect
  gis:apply-raster slope p-slope

  ask patches with [p-elevation > 0] [
    set pcolor scale-color 35 p-elevation .6 250
  ]
  ask patches with [p-elevation < 0] [set p-elevation 0]
  ask patches with [p-elevation = "NaN"] [set p-elevation 0]
end

to setup-roads ;; Pull in the asc road files and apply it to create patch data from gis data.
  set road-data gis:load-dataset "new_roads_30m.asc" ;; change the GIS road data by changing this file.
  gis:set-world-envelope gis:envelope-of elevation
  ask patches with [pcolor = 0] [ set p-elevation 0]

  gis:apply-raster road-data p-road-data ;; take all the data from the raster and apply it onto a given patch variable

  ask patches with [p-road-data > 0]
  [
    set pcolor scale-color yellow p-road-data 0 40
  ]
  ask patches with [p-road-data < 0] [set p-road-data 0]
end

为什么会发生这种情况以及如何使输出文件具有所需的 30m 分辨率?

gis netlogo arcgis
1个回答
0
投票

我发现 Netlogo 在导入带有 gis 扩展名的 .asc 文件时,没有使用正确的行数和列数来向世界展示。我根据 .asc 文件中的 ncols 和 nrows 手动更改了模型设置中的 max-pxcor 和 max-pycor,现在它以正确的像元大小导出。我仍然需要做一些测试,看看它是否影响模型的其他输出/结果,但初步分析似乎不会影响其他任何东西。 enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.