首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >NetLogo:识别山谷=人工景观中的河流位置

NetLogo:识别山谷=人工景观中的河流位置
EN

Stack Overflow用户
提问于 2016-05-20 03:05:38
回答 2查看 236关注 0票数 1

我想制作人工景观,包括丘陵,山坡和山谷。到现在为止还好。现在,我想在谷底放置一条河流。我认为最简单的方法是让乌龟在这里下降时按海拔向上/向下移动:http://modelingcommons.org/browse/one_model/2352#model_tabs_browse_info

然而,由于我的景观不是真实的,我的山谷也不是直线,而只是地形中的“凹陷”,因此我的河流定位真的很奇怪吗?

请问,有没有办法在不使用GIS扩展的情况下,在netlogo中创建反映真实地形的丘陵和山谷?我已经找到了很好的侵蚀模型,分水岭和GIS梯度示例,但是我如何才能最初将我的乌龟放在只停留在山谷中?

编辑

GIS梯度示例提供了出色的解决所有单元在空间中移动的问题,并且它们聚集在山谷中。然而,当我想通过我的乌龟的运动来“创造”河床的谷底时,我如何放置它呢?也许从最低点开始,在几个滴答声后停下来,这样就不允许登上山顶了?谢谢!

代码语言:javascript
复制
globals [
  low
  high
  range ]

patches-own [
  altitude ]

to setup
  clear-all
  setup-hills
  scale-patches
  color-patches
end



to setup-hills

  ask n-of 2 patches [
    set pcolor magenta ]

  ask patches [
    let max_dist sqrt (world-width ^ world-width + world-height ^ world-height)
    set altitude world-width - distance patch 10 10 
    set altitude world-width - distance min-one-of patches with [pcolor = magenta][distance myself]
    ]
 crt 1 [                ; create a turtle, needed to identify the lowest slope
    set color red
    let bottom_valley min-one-of patches [altitude] 
    move-to bottom_valley
  ]
end

to scale-patches  
  set low  [altitude] of min-one-of patches [altitude]
  set high [altitude] of max-one-of patches [altitude]
  set range high - low  
  ask patches [
    set altitude altitude - low   ; shift every patch down so lowest altitude is 0
    set altitude altitude * 99.0 / range ; scale every patch so that the lowest is 0 and highest is 999
      ]
  repeat 5 [ 
      diffuse altitude 0.5 ]
end

to color-patches
  ask patches [
    set pcolor scale-color green altitude 0 100]
end

to create-river

  ask turtles [    
    let p max-one-of neighbors in-radius 1 [altitude]
    if [altitude] of p >= altitude [
      face p
      move-to p
      set pcolor blue
    ]

  ]
end
EN

回答 2

Stack Overflow用户

发布于 2016-05-20 06:01:05

你的总体想法是正确的。我建议在您的环境中查看"GIS梯度“模型。您可以在Code Examples/GIS下的Models库中找到它。然后考虑如何过滤随着时间推移通过的水粒子数量最少的补丁。

票数 0
EN

Stack Overflow用户

发布于 2016-07-19 04:52:36

基于地理信息系统梯度的景观水系识别--以http://modelingcommons.org/browse/one_model/2352#model_tabs_browse_info为例

复杂景观上水系识别的整个过程由3个子过程组成:

(create-source)

  1. 确定景观的最高点
    • place here the river source river

  1. 通过将相邻单元的海拔降低到河谷的最低海拔来从最高的河源识别下坡溪流的补丁当海龟到达世界的边缘时,

从河床系统中移除最高的“”

    • 河不是从山顶开始的,而是在河谷的最高点从河床系统中移除的最高的“河”斑块(remove-river-from-top-hill)

源的数量取决于可用的GIS数据类型。对于要从山顶移除的面片数量也是如此。

代码语言:javascript
复制
;; ----------------------------------------------
;;          create river
;; ----------------------------------------------


to create-source
  ; identify the 5 highest points of the landscape
  repeat 5 [
    ; avoid the highest points to be close to each other
    ask max-one-of patches with [ not any? turtles-here and not any? turtles in-radius 20 ] [p_elev] [
      ;ask patches to sporout turtles
      sprout 1 [
        set size 1
        set color orange 
      ]
    ]
  ]
end


to go-downhill
  ; stop if there is no more turtles
  if not any? turtles with [color = orange]
    [ stop ]
  ; ask turtles located on top of thehills to move downhill 
  ask turtles with [color = orange] [

    ; die when you reach the edge of the world
    if ([pxcor] of patch-here = max-pxcor) or ([pycor] of patch-here = max-pycor) 
       or ([pxcor] of patch-here = min-pxcor) or ([pycor] of patch-here = min-pycor) [
         die ]


       move-to patch-here  ; go to patch center
       set pcolor blue     ; identify the use of patch 
       set p min-one-of neighbors with [pcolor != blue ] [p_elev]  ;; or neighbors4 with [pcolor != blue]patches in-radius 3  

       if p != nobody [
           ; move downhill if elevation of patch you are standing on is higher then one of the neighboring patches     
           ifelse [p_elev] of p <= p_elev 
               [
                 face p
                 move-to p
                 set pcolor blue ; identify the use of patch 
                 ]

              [
                ;move-to min-one-of patches with [pcolor != blue] [distance myself]
                move-to min-one-of patches in-radius 2 with [pcolor != blue] [p_elev]
                set pcolor blue  ; identify the use of patch 
              ]
       ]
  ]

end


to remove-river-from-top-hill
  ; remove 5% of the blue (river) patches placed on the top of the hill
  let total_blue count patches with [pcolor = blue]
  repeat total_blue * 0.05 [
  ask max-one-of patches with [pcolor = blue] [p_elev] [
    set pcolor yellow ]
  ]
end

确定了复杂的河流系统:

(河床=蓝色,移除山顶=黄色):

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37332038

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档