Skip to content
Snippets Groups Projects
Commit f616d2d3 authored by philippe.verley_ird.fr's avatar philippe.verley_ird.fr
Browse files

This commit adds a new option to the ads::mimetic function: the user may...

This commit adds a new option to the ads::mimetic function: the user may provide a raster in the arguments for defining a mask. 
mimetic(..., mask=NULL)
mask must either inherit from RasterStack or RasterLayer at the moment (we might change this in future commit). Every non NA values are considered as allowed values for positioning new points.
It only works for rectangular windows without triangle at the moment (we will extend the option to other window type in future commits).

In the C sources, I updated the functions mimetic_rect(), exchange_point_rect() and created a new function s_alea_rect_mask based on s_alea_rect. The main differences is that instead of 
generating new points anywhere within the sampling window, it only generates points within the raster limits inside the sampling window.
The precision parameter might not be implemented properly for the masked point process, it should be double checked.
The updated functions take the additional arguments nmask, xmask, ymask, dx and dy:
nmask: number of non-NA points of the raster
xmask: x-coordinates of the non-NA points in the raster
ymask: y-ccordinates of the non-NA points in the raster
dx: dimension of one raster cell along the x-axis
dy: dimension of one raster cell along the y-axis

The ads::mimetic function does not check whether the spatial point pattern and the raster are consistent in terms of CRS. It assumes at the moment that they are expressed in the same CRS. The function gets rid of any point from the raster that are outside the rectangular sampling window.


parent 467a5d40
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment