data-cleaning.sampling
clean-and-transform
(clean-and-transform map-properties settings)
Cleans .asc files content. Applies transformation to the cleaned cell values, if specified. map-properties: Preamble data with n/a positions. settings: Settings object. Excludes cells from every map if - a cell value is not defined, - any value in the cell Moore neighbourhood is not defined, - a cell belongs to the map-matrix border. 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. Additionally, returns a set of the 9 .asc maps content for each of the cell in the Moore neighbourhood. If specified, transforms cell values with ln function or rescaling to the [0,1] range from an original map. 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. returns: A hash-map of cleaned .asc files content with the original file names. Keys include :land-use-matrix, :neighbour-matrices, :var-matrices categories. ## Usage (require '[data-cleaning.sampling :refer :all]) (clean-and-transform {:na-cells {0 [0]} :declared-size [5 4]} {:land-use "land_use.asc" :other {"self.asc" :identity "unit.asc" :unit-rescaling "log.asc" :log}})