|
Check the file to be sure of the length of a row. To do this, note the value in the middle column top. Scroll down until that value changes and note the number of columns (which is the number of the row of the change). Often, the first few rows are not full width. That is the number of columns in the first rows does not equal the size the UTM said it would be. This is critical as the values are read in without carriage returns to indicate next row and the image will be distorted in NetLogo if the first few rows are short of the correct number of columns. This will need to be the width of the interface screen in the NetLogo program. The number of rows must be less than the number of rows in the UTM map.
Highlight the first two columns and delete them. This produces a single column file of tab delimited elevations.
Save this file as a “zmountain” file. This file needs to be put in a folder that will also hold the NetLogo program file that will read the data into the patch setup.
In the setup of the NetLogo program, the text file must be opened and read into the variable “elevation”. The code you will need looks like the following:
patches-own [elevation]
to setup setup-patches
end
to setup-patches ask patches [ file-open "zmoutain.txt" set elevation file-read file-close ] end
To see the result, a “go” routine that scales the color according to elevation will enable the viewing of the elevation we just imported. The following would work to do that.
to go
ask patches with [elevation >= the midpoint elevation on the map] [ set pcolor scale-color lime elevation ; Range of elevation ; might be half of ; total elevation ; change in the map.) ]
ask patches with [elevation < the midpoint elevation on the map]
[ set pcolor scale-color green elevation x y
;(Range of elevation might be ; the lower half of the total ; elevation change in the map ; x = min value ; y = max value ]
end
Now that your topography is in the program, you should be able to export the world file and use it again on subsequent runs. The set-up can be run at each session as an alternate way of loading the program to run again.
|