lu-preprocessing.generator
region-to-neighbours
(region-to-neighbours file-name map-lines)
Forms a csv content with a list of neighbouring regions
file-name: File name of the region .asc map.
map-lines: A list of .asc file rows.
returns: A hash-map with a file name and csv content.
## Usage
(require '[lu-preprocessing.generator :refer :all])
(region-to-neighbours "region.asc"
["ncols 6"
"nrows 10"
"xllcorner 1.0"
"yllcorner 2.0"
"cellsize 200.0"
"NODATA_value NA"
"0 0 0 NA 0 1"
"2 2 2 3 0 0"
"NA NA NA NA NA NA"
"NA 4 NA NA NA NA"
"NA NA NA NA NA NA"
"5 5 5 5 5 5"
"5 5 5 5 5 5"
"3 3 3 3 3 5"
"3 3 3 3 3 0"
"6 NA NA NA NA NA"])
=> {"region-neighbours.csv"
'(["id" "n1" "n2" "n3" "n4"]
["0" "1" "2" "3" "5"]
["1" "0" "" "" ""]
["2" "0" "3" "" ""]
["3" "0" "2" "5" "6"]
["4" "" "" "" ""]
["5" "0" "3" "" ""]
["6" "3" "" "" ""])}