in3Utils.geoTrans¶
Opperations and transformations of rasters and lines
Functions
Gauss’s area formula to calculate polygon area |
|
Check if two raster overlap |
|
check that the avalanche profiles goes from top to bottom |
|
Find the beta point: first point under the beta value given in prepareFind10Point. |
|
Finds the closest point in Points to the AvaProfile and returns its projection on AvaProfile. |
|
For a polygon defined by vertex points (xv, yv), returns a np array of size X with ones if the points (X, Y) are inside (or on the boundary) of the polygon; Otherwise, returns zeros. Usage: mask = inpolygon(X, Y, xv, yv) Input: X, Y: Set of points to check xv, yv: polygon vertex points Output: mask: np array of zeros and ones. |
|
Determines if a polygon path is mostly clockwise or counter clockwise |
|
Creates a domain (irregular raster) along a path, given the path polyline, a domain width and a raster cellsize Usage: [rasterTransfo] = path2domain(xyPath, rasterTransfo) Input: -xyPath: Polyline Coordinates -rasterTransfo[‘w’]: Domain width -rasterTransfo[‘xllc’]: xllc -rasterTransfo[‘yllc’]: yllc -rasterTransfo[‘cellsize’]: cellsize Output: xp, yp Arrays determining a path of width w along a polyline -rasterTransfo[‘DBXl’]: x coord of the left boundary -rasterTransfo[‘DBXr’]: x coord of the right boundary -rasterTransfo[‘DBYl’]: y coord of the left boundary -rasterTransfo[‘DBYr’]: y coord of the right boundary |
|
Create a mask from a polyline Usage: mask = poly2maskSimple(ydep, xdep, ncols, nrows) Input: ydep, xdep: Polyline Coordinates ncols, nrows: Raster size Output: mask: Raster of the polyline mask |
|
Prepare inputs for findBetaPoint function: Read profile, compute Angle look for points for which the slope is under the given Beta value and that are located downstreem of the splitPoint |
|
1- Resample the avapath line with a max intervall of distance=10m between points (projected distance on the horizontal plane). |
|
Projects the points Points on Raster using a bilinear or nearest interpolation and returns the z coord Input : Points: (x, y) coord of the points Output: PointsZ: z coord of the points ioob number of out of bounds indexes |
|
Projects the points Points on Raster using a bilinear or nearest interpolation and returns the z coord (no for loop) Input : Points: list of points (x,y) 2 rows as many columns as Points Output: PointsZ: list of points (x,y,z) 3 rows as many columns as Points |
|
change DEM cell size by reprojecting on a new grid |
|
Reproject raster on a grid of shape rasterRef :Parameters: * raster (dict) – raster dictionary * rasterRef (dict) – reference raster dictionary |