in3Utils.geoTrans

Opperations and transformations of rasters and lines

Functions

areaPoly

Gauss’s area formula to calculate polygon area

cartToSpherical

convert from cartesian to spherical coordinates

checkOverlap

Check if two rasters overlap

checkProfile

check that the avalanche profiles goes from top to bottom flip it if not and adjust the splitpoint in consequence

computeS

compute s coordinate given a path (x, y)

findAngleProfile

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

findPointOnDEM

find point on dem given a direction and a z value to reach

findSplitPoint

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

getCellsAlongLine

Find all raster cells crossed by the line line has to be entierly contained on the raster extend.

getNeighborCells

Find the neighbour cells to a given cell

isCounterClockWise

Determines if a polygon path is mostly clockwise or counter clockwise

makeCoordGridFromHeader

Get x and y (2D) grid description vectors for a mesh with a given number of rows and columns, lower left center and cellSize.

makeCoordinateGrid

Create grid :Parameters: * xllc, yllc (float) – x and y coordinate of the lower left center * csz (float) – cell size * ncols, nrows (int) – number of columns and rows

path2domain

Creates a domain (irregular raster) along a path, given the path xyPath, a domain width and a raster cellsize

prepareAngleProfile

Prepare inputs for findAngleProfile function Read profile (s, z), compute the slope Angle look for points for which the slope is under the given Beta value and that are located downstream of the splitPoint

prepareLine

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

projectOnGrid

Projects Z onto points (x,y) using a bilinear or nearest interpolation and returns the z coord

projectOnRaster

Projects Points on raster using a bilinear or nearest interpolation and returns the z coord (no for loop)

remeshDEM

change DEM cell size by reprojecting on a new grid - first check if remeshed DEM available

remeshData

compute raster data on a new mesh with cellSize using the specified remeshOption.

resizeData

Reproject raster on a grid of shape rasterRef

rotate

rotate a vector provided as start and end point with theta angle rotation counter-clockwise

rotateRaster

rotate clockwise a raster arround (0, 0) with theta angle

searchRemeshedDEM

search if remeshed DEM with correct name and cell size already available