Skip to content

Commit

Permalink
refactor: project layout
Browse files Browse the repository at this point in the history
  • Loading branch information
lvisei committed Dec 8, 2020
1 parent 8a312e8 commit ff2546b
Show file tree
Hide file tree
Showing 14 changed files with 13 additions and 14 deletions.
File renamed without changes.
File renamed without changes.
Binary file removed data/fonts/source-han-sans-sc/light.ttf
Binary file not shown.
Binary file removed data/fonts/source-han-sans-sc/medium.ttf
Binary file not shown.
Binary file removed data/fonts/source-han-sans-sc/regular.ttf
Binary file not shown.
10 changes: 5 additions & 5 deletions examples/csv/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (

"runtime/pprof"

"github.com/liuvigongzuoshi/go-kriging/internal/canvas"
"github.com/liuvigongzuoshi/go-kriging/internal/ordinary"
"github.com/liuvigongzuoshi/go-kriging/canvas"
"github.com/liuvigongzuoshi/go-kriging/ordinary"
"github.com/liuvigongzuoshi/go-kriging/pkg/json"
)

Expand Down Expand Up @@ -46,7 +46,7 @@ func main() {
}
defer timeCost()("训练模型加插值总耗时")

ordinaryKriging := ordinary.NewOrdinary(data["values"], data["lons"], data["lats"])
ordinaryKriging := ordinary.NewOrdinary(data["values"], data["x"], data["y"])
_ = ordinaryKriging.Train(ordinary.Spherical, 0, 100)

gridPlot(ordinaryKriging, polygon)
Expand All @@ -72,7 +72,7 @@ func gridPlot(ordinaryKriging *ordinary.Variogram, polygon ordinary.PolygonCoord

subTitle := &canvas.TextConfig{
Text: "球面半变异函数模型",
FontName: "data/fonts/source-han-sans-sc/regular.ttf",
FontName: "testdata/fonts/source-han-sans-sc/regular.ttf",
FontSize: 28,
Color: color.RGBA{R: 0, G: 0, B: 0, A: 255},
OffsetX: 252,
Expand Down Expand Up @@ -156,7 +156,7 @@ func readCsvFile(filePath string) (map[string][]float64, error) {
values = append(values, value)
}

data := map[string][]float64{"values": values, "lats": lats, "lons": lons}
data := map[string][]float64{"values": values, "x": lons, "y": lats}

//fmt.Printf("values %#v\n lons %#v\n lats %#v\n", values, lons, lats)

Expand Down
2 changes: 1 addition & 1 deletion examples/wasm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"syscall/js"

"github.com/liuvigongzuoshi/go-kriging/internal/ordinary"
"github.com/liuvigongzuoshi/go-kriging/ordinary"
)

func main() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package ordinary_test
import (
"fmt"

"github.com/liuvigongzuoshi/go-kriging/internal/ordinary"
"github.com/liuvigongzuoshi/go-kriging/ordinary"
)

var (
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion internal/ordinary/ordinary.go → ordinary/ordinary.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"math"
"sort"

"github.com/liuvigongzuoshi/go-kriging/internal/canvas"
"github.com/liuvigongzuoshi/go-kriging/canvas"
)

// Variogram ordinary kriging variogram
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"testing"
"time"

"github.com/liuvigongzuoshi/go-kriging/internal/ordinary"
"github.com/liuvigongzuoshi/go-kriging/ordinary"
)

const pngDirPath = "testdata"
Expand Down
File renamed without changes.
9 changes: 4 additions & 5 deletions internal/ordinary/type.go → ordinary/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ type ContourRectangle struct {
type PolygonCoordinates [][][2]float64

type PolygonGeometry struct {
Type string `json:"type"`
Coordinates PolygonCoordinates `json:"coordinates,omitempty"`
Type string `json:"type"` // Polygon
Coordinates PolygonCoordinates `json:"coordinates,omitempty"` // coordinates
}

type RGBA [4]uint8
Expand All @@ -94,7 +94,6 @@ func (c RGBA) RGBA() (r, g, b, a uint32) {
}

type GridLevelColor struct {
Value [2]float64 `json:"value"`

Color RGBA `json:"color"`
Value [2]float64 `json:"value"` // [0, 5]
Color RGBA `json:"color"` // [255, 255, 255, 255]
}

0 comments on commit ff2546b

Please sign in to comment.