Documentation ¶
Index ¶
- Variables
- func BufferRings(nrings int) map[int][][]int
- func BufferRingsSquare(nrings int) map[int][][]int
- func SurroundingCells(unitRadius int) [][]int
- func SurroundingRing(unitRadius int) [][]int
- type Cell
- type Crawler
- type Definition
- func (gd *Definition) Buffer(cid0 int, cardinal, isActive bool) []int
- func (gd *Definition) Buffers(cardinal, isActive bool) map[int][]int
- func (gd *Definition) BuildTileSet(zoomMin, zoomMax, epsg int, outDir string) (tset TileSet)
- func (gd *Definition) CellArea() float64
- func (gd *Definition) CellCentroid(cid int) []float64
- func (gd *Definition) CellCentroids() map[int][]float64
- func (gd *Definition) CellID(row, col int) int
- func (gd *Definition) CellIndexXR() map[int]int
- func (gd *Definition) CellOriginUL(cid int) (r, c int, x0, y0 float64)
- func (gd *Definition) CellPerimeter(cid int) [][]float64
- func (gd *Definition) ConatainsPoint(x, y, buf float64) bool
- func (gd *Definition) Crop(xn, xx, yn, yx float64, buffer int) (*Definition, int, int)
- func (gd *Definition) CropToActives() *Definition
- func (gd *Definition) ExtentToCellIDs(ext mmaths.Extent) []int
- func (gd *Definition) Extents() []float64
- func (gd *Definition) Intersect(toGD *Definition) map[int][]int
- func (gd *Definition) IsActive(cid int) bool
- func (gd *Definition) IsSimilar(gd1 *Definition) bool
- func (gd *Definition) LineToCellIDs(x0, y0, x1, y1 float64) []int
- func (gd *Definition) Ncells() int
- func (gd *Definition) NullArray(nodatavalue float64) []float64
- func (gd *Definition) NullFloat32(nodatavalue float32) []float32
- func (gd *Definition) NullInt32(nodatavalue int32) []int32
- func (gd *Definition) PointToActiveCellID(x, y float64) int
- func (gd *Definition) PointToCellID(x, y float64) int
- func (gd *Definition) PointToRowCol(x, y float64) (row, col int)
- func (gd *Definition) PolygonToCellIDs(vertices [][]float64) ([]int, int)
- func (gd *Definition) ResetActives(cids []int)
- func (gd *Definition) RowCol(cid int) (row, col int)
- func (gd *Definition) SaveAs(fp string) error
- func (gd *Definition) ToASC(fp string) error
- func (gd *Definition) ToASCheader(t *mmio.TXTwriter)
- func (gd *Definition) ToAscData(fp string, d map[int]float64) error
- func (gd *Definition) ToBIL(fp string, f32 []float32)
- func (gd *Definition) ToCrawler(cardinalOnly bool) *Crawler
- func (gd *Definition) ToHDR(fp string, nbands, nbits int) error
- func (gd *Definition) ToHDRfloat(fp string, nbands, nbits int) error
- func (gd *Definition) ToIndx(imap map[int]int) *Indx
- func (gd *Definition) ToVertex() *Vertex
- type Face
- type HSTRAT
- type Indx
- func (x *Indx) ImportBil(fp string) error
- func (x *Indx) New(fp string)
- func (x *Indx) Nvalues() int
- func (x *Indx) ToASC(fp string, ignoreActives bool) error
- func (x *Indx) ToBil(fp string) error
- func (x *Indx) ToBinary(fp string) error
- func (g *Indx) ToTiles(cmap map[int]color.RGBA, zoomMin, zoomMax, epsg int, tileDir string)
- func (x *Indx) UniqueValues() []int
- func (x *Indx) Value(cid int) int
- type PolygonRasterizer
- type Real
- func (r *Real) Crop(xn, xx, yn, yx float64, buffer int)
- func (r *Real) ImportAsc(fp string) error
- func (r *Real) ImportBil(fp string) error
- func (r *Real) ImportRaster(fp string) error
- func (g Real) Min(buffer int) map[int]float64
- func (r *Real) New(fp string)
- func (r *Real) NewGD32(fp string, gd *Definition)
- func (r *Real) ResetToGDEF(gdeffp string, crop bool)
- func (r *Real) ToAsc(fp string) error
- func (x *Real) ToBil(fp string) error
- func (r *Real) ToPNG(fp string) error
- func (r *Real) ToTiles(minVal, maxVal float64, zoomMin, zoomMax, epsg int, tileDir string)
- type SWS
- type Tile
- type TileSet
- type Vertex
Constants ¶
This section is empty.
Variables ¶
var FilterGaussianSmoothing = [][]float64{
{0.00366, 0.01465, 0.02564, 0.01465, 0.00366},
{0.01465, 0.05861, 0.09524, 0.05861, 0.01465},
{0.02564, 0.09524, 0.15020, 0.09524, 0.02564},
{0.01465, 0.05861, 0.09524, 0.05861, 0.01465},
{0.00366, 0.01465, 0.02564, 0.01465, 0.00366},
}
https://homepages.inf.ed.ac.uk/rbf/HIPR2/gsmooth.htm center cell was modified from .15018 to .15020 such that the filter summed to 1.
Functions ¶
func BufferRings ¶
func BufferRingsSquare ¶
func SurroundingCells ¶
SurroundingCells returns the relative row,col given in units of cell width
func SurroundingRing ¶
Types ¶
type Crawler ¶
type Crawler struct {
// contains filtered or unexported fields
}
func (*Crawler) CrawlByFloat ¶
type Definition ¶
type Definition struct { Coord map[int]mmaths.Point Act map[int]int // [cellID]activeID Sactives []int // an ordered slice of active cell IDs Eorig, Norig, Rotation, Cwidth float64 // Xul; Yul; grid rotation about ULorigin; cell width Nrow, Ncol, Nact int Name string // contains filtered or unexported fields }
Definition struct of a uniform grid
func BuildDefinitionFromPoints ¶
func BuildDefinitionFromPoints(nam string, cxy map[int][]float64) *Definition
func NewDefinition ¶
func NewDefinition(nam string, nr, nc int, UniformCellSize float64) *Definition
NewDefinition constructs a basic grid definition
func ReadGDEF ¶
func ReadGDEF(fp string, print bool) (*Definition, error)
ReadGDEF imports a grid definition file
func (*Definition) BuildTileSet ¶
func (gd *Definition) BuildTileSet(zoomMin, zoomMax, epsg int, outDir string) (tset TileSet)
func (*Definition) CellArea ¶
func (gd *Definition) CellArea() float64
CellArea returns the (uniform) area of the grid cells
func (*Definition) CellCentroid ¶
func (gd *Definition) CellCentroid(cid int) []float64
func (*Definition) CellCentroids ¶
func (gd *Definition) CellCentroids() map[int][]float64
func (*Definition) CellID ¶
func (gd *Definition) CellID(row, col int) int
CellID returns cell ID for a given row and column index
func (*Definition) CellIndexXR ¶
func (gd *Definition) CellIndexXR() map[int]int
CellIndexXR returns a mapping of cell id to an array index
func (*Definition) CellOriginUL ¶
func (gd *Definition) CellOriginUL(cid int) (r, c int, x0, y0 float64)
func (*Definition) CellPerimeter ¶
func (gd *Definition) CellPerimeter(cid int) [][]float64
func (*Definition) ConatainsPoint ¶
func (gd *Definition) ConatainsPoint(x, y, buf float64) bool
ConatainsPoint returns whether a point exists within a grid definition, with a specified buffer
func (*Definition) Crop ¶
func (gd *Definition) Crop(xn, xx, yn, yx float64, buffer int) (*Definition, int, int)
func (*Definition) CropToActives ¶
func (gd *Definition) CropToActives() *Definition
func (*Definition) ExtentToCellIDs ¶
func (gd *Definition) ExtentToCellIDs(ext mmaths.Extent) []int
func (*Definition) Intersect ¶
func (gd *Definition) Intersect(toGD *Definition) map[int][]int
Intersect returns a mapping from current Definition to inputted Definition for now, only Definitions that share the same origin, and cell sizes are mulitples can be considered
func (*Definition) IsActive ¶
func (gd *Definition) IsActive(cid int) bool
IsActive returns whether a cell ID is of an active cell
func (*Definition) IsSimilar ¶
func (gd *Definition) IsSimilar(gd1 *Definition) bool
func (*Definition) LineToCellIDs ¶
func (gd *Definition) LineToCellIDs(x0, y0, x1, y1 float64) []int
func (*Definition) Ncells ¶
func (gd *Definition) Ncells() int
Ncells returns the count of grid cells
func (*Definition) NullArray ¶
func (gd *Definition) NullArray(nodatavalue float64) []float64
func (*Definition) NullFloat32 ¶
func (gd *Definition) NullFloat32(nodatavalue float32) []float32
func (*Definition) NullInt32 ¶
func (gd *Definition) NullInt32(nodatavalue int32) []int32
func (*Definition) PointToActiveCellID ¶
func (gd *Definition) PointToActiveCellID(x, y float64) int
func (*Definition) PointToCellID ¶
func (gd *Definition) PointToCellID(x, y float64) int
PointToCellID returns the cell id that contains the xy coordinates
func (*Definition) PointToRowCol ¶
func (gd *Definition) PointToRowCol(x, y float64) (row, col int)
PointToRowCol returns the row and column grid cell that contains the xy coordinates
func (*Definition) PolygonToCellIDs ¶
func (gd *Definition) PolygonToCellIDs(vertices [][]float64) ([]int, int)
func (*Definition) ResetActives ¶
func (gd *Definition) ResetActives(cids []int)
func (*Definition) RowCol ¶
func (gd *Definition) RowCol(cid int) (row, col int)
RowCol returns row and column index for a given cell ID
func (*Definition) SaveAs ¶
func (gd *Definition) SaveAs(fp string) error
SaveAs writes a grid definition file of format *.gdef
func (*Definition) ToASC ¶
func (gd *Definition) ToASC(fp string) error
ToASC creates an ascii-grid based on grid definition. If the grid definition contains active cells, they will be given a value of 1 in the raster.
func (*Definition) ToASCheader ¶
func (gd *Definition) ToASCheader(t *mmio.TXTwriter)
ToASCheader writes ASC grid header info to writer
func (*Definition) ToAscData ¶
func (gd *Definition) ToAscData(fp string, d map[int]float64) error
ToAscData converts a map referenced to cell id to an ASCII grid
func (*Definition) ToBIL ¶
func (gd *Definition) ToBIL(fp string, f32 []float32)
func (*Definition) ToCrawler ¶
func (gd *Definition) ToCrawler(cardinalOnly bool) *Crawler
func (*Definition) ToHDR ¶
func (gd *Definition) ToHDR(fp string, nbands, nbits int) error
ToHDR creates an ESRI-grid based on grid definition header
func (*Definition) ToHDRfloat ¶
func (gd *Definition) ToHDRfloat(fp string, nbands, nbits int) error
ToHDRfloat creates an ESRI-grid based on grid definition header for float arrays
func (*Definition) ToVertex ¶
func (gd *Definition) ToVertex() *Vertex
type Face ¶
type Face struct { GD *Definition CellFace, FaceCell map[int][]int Nfaces int // contains filtered or unexported fields }
Face definition struct collection of cell IDs surrounding grid faces EXAMPLE: 4x5 cells = 2*(4x5)+4+5 = 49 faces gd1 := Definition("test", 4, 5)
o---o---o---o---o---o o-0-o-1-o-2-o-3-o-4-o o---o---o---o---o---o | 0 | 1 | 2 | 3 | 4 | | | | | | | 25 26 27 28 29 30 North-east | o---o---o---o---o---o o-5-o-6-o-7-o-8-o-9-o o---o---o---o---o---o ^ positive from | to | 5 | 6 | 7 | 8 | 9 | | | | | | | 31 32 33 34 35 36 /|\ | o---o---o---o---o---o --> o-10o-11o-12o-13o-14o & o---o---o---o---o---o | | 10| 11| 12| 13| 14| | | | | | | 37 38 39 40 41 42 | + to o---o---o---o---o---o o-15o-16o-17o-18o-19o o---o---o---o---o---o |_________\ ------ | 15| 16| 17| 18| 19| | | | | | | 43 44 45 46 47 48 / from o---o---o---o---o---o o-20o-21o-22o-23o-24o o---o---o---o---o---o
func (*Face) IsUpwardFace ¶
IsUpwardFace returns whether the orientation of the face is normal to the vertical
func (*Face) RightFaces ¶
RightFaces returns the face indices of all 'right' faces
type Indx ¶
type Indx struct { GD *Definition A map[int]int }
Indx data type array of integers
func (*Indx) ToTiles ¶
ToTiles take a categorical grid and builds a set of raster/image tiles for webmapping
func (*Indx) UniqueValues ¶
UniqueValues returns the value of a given cell ID
type PolygonRasterizer ¶
type PolygonRasterizer struct {
// contains filtered or unexported fields
}
func (*PolygonRasterizer) InteriorCellIDs ¶
func (pr *PolygonRasterizer) InteriorCellIDs(GD *Definition, Polygon [][]float64) ([]int, int)
type Real ¶
type Real struct { GD *Definition A map[int]float64 }
Real data type array
func (*Real) ImportRaster ¶
func (*Real) ResetToGDEF ¶
type SWS ¶
type SWS struct { GD *Definition SwsC, Usws map[int][]int // SwsC: [swsID]cellID; Usws: [downstream_swsID]upstream_swsID CSws, Dsws map[int]int // CSws: [cellID]swsID; Dsws: [upstream_swsID]downstream_swsID }
func CollectSWS ¶
func CollectSWS(swsFP string, gd *Definition) *SWS
type Tile ¶
type Tile struct{ Z, X, Y int }