-main
(-main & args)
Creates a sample of the cleaned .asc map files.
Saves results into the bunch of .asc files
in the root execution directory.
Arguments: settings-path
Steps include: 1) filtering of cells,
2) transformation of the land use map
by counting the number of cells with urban land use
in the cell Moore neighbourhood,
3) transformation of other maps with log and rescaling to [0,1],
if specified,
4) creating a matrix of neighbouring regions.
1) Excludes cells from every map if
- a cell value is not defined originally
(in any of the original maps specified),
- any value in the cell Moore neighbourhood is not defined originally
(in any of the original maps specified),
- a cell belongs to the map-matrix border,
- a cell is masked in the "black-list" file,
- any value in the cell Moore neighbourhood is masked in the "black-list" file.
"Black-list" file should mask cells with "1" in order to exclude these cells
from the resultant maps.
"Black-list" file should be specified with 'mask' attribute in the settings file.
2) Original land use map should contain 0-1 cell values, where 0 is a non-urban land
(e.g., vegetation, wetlands, agricultural land and water) and 1 is an urban land
(e.g., all artificial surfaces).
Every cell value in the land use map is substituted with the number of cells with
urban land use in the cell Moore neighbourhood.
Land use map should be specified with 'land-use' attribute in the settings file.
3) If specified, transforms cell values with ln function or rescaling to the [0,1] range.
Rescaling to the [0,1] range is done using the following transformation:
x'=(x-x_min)/(x_max-x_min),
where x is an original value. The minimum and maximum values (x_min, x_max respectively)
are taken from the original cell values.
Logarithmic transformation should be specified with 'log' attribute in the settings file.
Rescaling to [0,1] transformation should be specified with 'unit-rescaling' attribute
in the settings file.
4) Two regions are assumed to be neighbours if any of their cells are neighbours
(in their Moore neighbourhoods).
First column of the output contains identifiers of subregions. Every cell value in the row
(except first cell) contains identifier of the neighbouring region.
Region map should be specified with 'region' attribute in the settings file.
In case of valid original maps,
saves to disk
a) cleaned .asc files,
output: lu-preprocessing/["land-use.asc"]
lu-preprocessing/["region.asc"]
lu-preprocessing/["map1.asc"]
lu-preprocessing/["map1.asc"]
...
b) a sorted list of Moore neighbourhoods by their frequency in the land use map
(in csv and latex formats),
output: lu-preprocessing/["land-use.asc"]-neighbourhoods.csv
lu-preprocessing/["land-use.asc"]-neighbourhoods.tex,
c) a csv file with neighbours matrix,
output: lu-preprocessing/["region.asc"]-neighbours.csv
prints to terminal
d) a list of validation warnings.
Otherwise, prints to terminal a list of validation errors.
## Usage
$ lein run "settings.xml"
## Example settings.xml
<?xml version="1.0"?>
<files>
<raster path = "land-use.asc"
group = "land-use" />
<raster path = "region.asc"
group = "region" />
<raster path = "map1.asc" />
<raster path = "map2.asc"
transform = "log" />
<raster path = "map3.asc"
transform = "unit-rescaling" />
<raster path = "zoning.asc"
group = "mask" />
</files>