in3Utils.geoTrans

Opperations and transformations of rasters and lines

Functions

areaPoly

Gauss’s area formula to calculate polygon area

checkOverlap

Check if two raster overlap

checkProfile

check that the avalanche profiles goes from top to bottom

findAngleProfile

Find the beta point: first point under the beta value given in prepareFind10Point.

findCellsCrossedByLineBresenham

findSplitPoint

Finds the closest point in Points to the AvaProfile and returns its projection on AvaProfile.

inpolygon

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.

isCounterClockWise

Determines if a polygon path is mostly clockwise or counter clockwise

path2domain

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

poly2maskSimple

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

prepareAngleProfile

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

prepareLine

1- Resample the avapath line with a max intervall of distance=10m between points (projected distance on the horizontal plane).

projectOnGrid

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

projectOnRaster

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

remeshDEM

change DEM cell size by reprojecting on a new grid

resizeData

Reproject raster on a grid of shape rasterRef :Parameters: * raster (dict) – raster dictionary * rasterRef (dict) – reference raster dictionary