ordinarykriging

package
v0.0.1-alpha.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 8, 2022 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultLegendColor = []color.Color{
		NewRGBA(40, 146, 199, 255),
		NewRGBA(96, 163, 181, 255),
		NewRGBA(140, 184, 164, 255),
		NewRGBA(177, 204, 145, 255),
		NewRGBA(215, 227, 125, 255),
		NewRGBA(250, 250, 100, 255),
		NewRGBA(252, 207, 81, 255),
		NewRGBA(252, 164, 63, 255),
		NewRGBA(242, 77, 31, 255),
		NewRGBA(232, 16, 20, 255),
	}
	DefaultGridLevelColor = []GridLevelColor{
		{Color: NewRGBA(40, 146, 199, 255), Value: [2]float64{-30, -15}},
		{Color: NewRGBA(96, 163, 181, 255), Value: [2]float64{-15, -10}},
		{Color: NewRGBA(140, 184, 164, 255), Value: [2]float64{-10, -5}},
		{Color: NewRGBA(177, 204, 145, 255), Value: [2]float64{-5, 0}},
		{Color: NewRGBA(215, 227, 125, 255), Value: [2]float64{0, 5}},
		{Color: NewRGBA(250, 250, 100, 255), Value: [2]float64{5, 10}},
		{Color: NewRGBA(252, 207, 81, 255), Value: [2]float64{10, 15}},
		{Color: NewRGBA(252, 164, 63, 255), Value: [2]float64{15, 20}},
		{Color: NewRGBA(247, 122, 45, 255), Value: [2]float64{20, 25}},
		{Color: NewRGBA(242, 77, 31, 255), Value: [2]float64{25, 30}},
		{Color: NewRGBA(232, 16, 20, 255), Value: [2]float64{30, 40}},
	}
)

Functions

func NewRGBA

func NewRGBA(r, g, b, a uint8) color.RGBA

Types

type ContourRectangle

type ContourRectangle struct {
	Contour     []float64  `json:"contour"`
	XWidth      int        `json:"xWidth"`
	YWidth      int        `json:"yWidth"`
	Xlim        [2]float64 `json:"xLim"`
	Ylim        [2]float64 `json:"yLim"`
	Zlim        [2]float64 `json:"zLim"`
	XResolution float64    `json:"xResolution"`
	YResolution float64    `json:"yResolution"`
}

type DistanceList

type DistanceList [][2]float64

func (DistanceList) Len

func (t DistanceList) Len() int

func (DistanceList) Less

func (t DistanceList) Less(i, j int) bool

func (DistanceList) Swap

func (t DistanceList) Swap(i, j int)

type GridLevelColor

type GridLevelColor struct {
	Value [2]float64 `json:"value"` // 值区间 [0, 5]
	Color color.RGBA `json:"color"` // RGBA颜色 {255, 255, 255, 255}
}

type GridMatrices

type GridMatrices struct {
	Data        [][]float64 `json:"data"`
	Width       float64     `json:"width"`
	Xlim        [2]float64  `json:"xLim"`
	Ylim        [2]float64  `json:"yLim"`
	Zlim        [2]float64  `json:"zLim"`
	NodataValue float64     `json:"nodataValue"`
}

type ModelType

type ModelType string
const (
	Gaussian    ModelType = "gaussian"
	Exponential ModelType = "exponential"
	Spherical   ModelType = "spherical"
)

type Point

type Point [2]float64 // example [103.614373, 27.00541]

type PolygonCoordinates

type PolygonCoordinates []Ring

type PolygonGeometry

type PolygonGeometry struct {
	Type        string `json:"type" default:"Polygon"` // Polygon
	Coordinates []Ring `json:"coordinates,omitempty"`  // coordinates
}

type PredictDate

type PredictDate struct {
	X     int
	Y     int
	Value float64
}

type Ring

type Ring []Point

type Variogram

type Variogram struct {
	Nugget float64 `json:"nugget"`
	Range  float64 `json:"range"`
	Sill   float64 `json:"sill"`
	A      float64 `json:"A"`
	N      int     `json:"n"`

	K []float64 `json:"K"`
	M []float64 `json:"M"`
	// contains filtered or unexported fields
}

Variogram ordinary kriging variogram

func NewOrdinary

func NewOrdinary(t, x, y []float64) *Variogram

func (*Variogram) Contour

func (variogram *Variogram) Contour(xWidth, yWidth int) *ContourRectangle

Contour contour paths 根据宽高度生成轮廓数据

func (*Variogram) ContourWithBBox

func (variogram *Variogram) ContourWithBBox(bbox [4]float64, width float64) *ContourRectangle

ContourWithBBox contour paths 根据 bbox 生成轮廓数据

func (*Variogram) Grid

func (variogram *Variogram) Grid(polygon PolygonCoordinates, width float64) *GridMatrices

Grid gridded matrices or contour paths 根据 PolygonCoordinates 生成裁剪过的矩阵网格数据 这里 polygon 是一个三维数组,可以变相的支持的多个面,但不符合 Polygon 规范 PolygonCoordinates [[[x,y]],[[x,y]]] 两个面

func (*Variogram) Plot

func (variogram *Variogram) Plot(gridMatrices *GridMatrices, width, height int, xlim, ylim [2]float64, colors []GridLevelColor) *canvas.Canvas

Plot plotting on the canvas 绘制裁剪过的矩阵网格数据到 canvas 上

func (*Variogram) PlotPng

func (variogram *Variogram) PlotPng(rectangleGrids *ContourRectangle) *image.RGBA

PlotPng plot to png

func (*Variogram) PlotRectangleGrid

func (variogram *Variogram) PlotRectangleGrid(contourRectangle *ContourRectangle, width, height int, xlim, ylim [2]float64, colors []color.Color) *canvas.Canvas

PlotRectangleGrid plot to canvas 绘制矩形网格到数据 canvas 上

func (*Variogram) Predict

func (variogram *Variogram) Predict(x, y float64) float64

Predict model prediction

func (*Variogram) Train

func (variogram *Variogram) Train(model ModelType, sigma2 float64, alpha float64) (*Variogram, error)

Train using gaussian processes with bayesian priors

func (*Variogram) Variance

func (variogram *Variogram) Variance(x, y float64)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL