data-cleaning.map
read-map
(read-map map-path)
Returns a map matrix from the .asc file.
map-path: Path to the map file.
returns: List of map elements in the row-by-row order.
## Usage
(require '[data-cleaning.map :refer :all])
;; "raster.asc"
;; ncols 5
;; nrows 3
;; xllcorner 1
;; yllcorner 2
;; cellsize 200
;; NODATA_value -9999
;; u 2 -9999 2
;; 4 6 -9999 4
;; 1
;; -9999 -9999 3 -9999 -9999
;; 1 2 3 4
(read-map "raster.asc")
=> ["u" "2" "-9999" "2"
"4" "6" "-9999" "4"
"1"
"-9999" "-9999" "3" "-9999" "-9999"
"1" "2" "3" "4"]
read-positions
(read-positions map-path)
Returns positions for the masked cells from the .asc file.
map-path: Path to the map file.
returns: List of positions for masked cells.
## Usage
(require '[data-cleaning.map :refer :all])
;; "mask.asc"
;; ncols 5
;; nrows 3
;; xllcorner 1
;; yllcorner 2
;; cellsize 200
;; NODATA_value -9999
;; u u -9999 u
;; 1 u -9999 1
;; u
;; -9999 -9999 u -9999 -9999
;; u u u 1.000
(read-positions "mask.asc")
=> {1 [0 3] 4 [3]}
read-properties
(read-properties map-path)
Returns .asc preamble data from the file with information about
- map size (number of rows, number of columns) declared in .asc file,
- number of elements in each row,
- map resolution (cell size),
- left bottom corner coordinates,
- positions of NA values per row.
map-path: Path to the map file.
returns: .asc preamble data.
## Usage
(require '[data-cleaning.map :refer :all])
;; "raster.asc"
;; ncols 5
;; nrows 3
;; xllcorner 1
;; yllcorner 2
;; cellsize 200
;; NODATA_value -9999
;; u 2 -9999 2
;; 4 6 -9999 4
;; 1
;; -9999 -9999 3 -9999 -9999
;; 1 2 3 4
(read-properties "raster.asc")
=> {:declared-size [3 5]
:rows [4 4 1 5 4]
:cell-size) 200.0
:left-bottom-corner [1.0 2.0]
:na-cells {0 [2] 1 [2] 3 [0 1 3 4]}}