earth

package module
v0.0.0-...-26dca7e Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: BSD-2-Clause Imports: 5 Imported by: 16

README

Earth

Package earth implements an spherical model of the Earth.

Authorship and license

Copyright © 2022 J. Salvador Arias jsalarias@gmail.com. All rights reserved. Distributed under BSD2 licenses that can be found in the LICENSE file.

Documentation

Overview

Package earth implements an spherical model of the Earth.

Index

Constants

View Source
const (
	// Arithmetic mean radius of Earth in meters
	// after Moritz (1980) Geodetic Reference System 1980
	// Resolution 1 at the XVII General Assembly of the IUGG.
	Radius = 6_371_008

	// Age of Earth in years.
	Age = 4_540_000_000
)

Variables

View Source
var NorthPole = NewPoint(90, 0)

Earth poles

View Source
var SouthPole = NewPoint(-90, 0)

Functions

func Bearing

func Bearing(p, q Point) float64

Bearing returns the direction angle between a meridian and the great circle line that connect two points, from the point p. The resulting angle is in radians, 0 being north, pi/2 east, pi south, and 3pi/2 west,

func Chord2

func Chord2(p, q Point) float64

Chord2 returns the square of the Euclidean chord distance.

func Distance

func Distance(p, q Point) float64

Distance returns the great circle distance, in radians, between two geographic points.

func ToDegree

func ToDegree(angle float64) float64

ToDegree transform a radian angle into degrees.

func ToRad

func ToRad(angle float64) float64

ToRad transform a degree angle into radians.

Types

type DistMat

type DistMat struct {
	// contains filtered or unexported fields
}

DistMat is a distance matrix for the pixels in a pixelation. It store not the real distance, but a distance suing an integer scale.

func NewDistMat

func NewDistMat(pix *Pixelation, scale uint16) (*DistMat, error)

NewDistMat creates a new distance matrix from the indicated pixelation. To save memory, only pixelations up to 255 pixels at the equator can be defined.

func NewDistMatRingScale

func NewDistMatRingScale(pix *Pixelation) (*DistMat, error)

NewDistMatRingScale returns a new distance matrix from the indicated pixelations, scaled with the number of rings in the pixelation. Then the distance is equal to the ring of each pixel if a reference pixel is rotated to the north pole.

func (*DistMat) At

func (dm *DistMat) At(x, y int) int

At returns the value of the ring distance between two pixel IDs.

func (*DistMat) Scale

func (dm *DistMat) Scale() int

Scale returns the scale factor used in the distance matrix.

type Pixel

type Pixel struct {
	// contains filtered or unexported fields
}

A Pixel is a pixel in a pixelation.

func (Pixel) ID

func (px Pixel) ID() int

ID returns the index used to identify a pixel in a pixelation.

func (Pixel) Point

func (px Pixel) Point() Point

Point returns the geographic point associate with a pixel.

func (Pixel) Ring

func (px Pixel) Ring() int

Ring returns the ring of the pixel.

type Pixelation

type Pixelation struct {
	// contains filtered or unexported fields
}

A Pixelation is an equal area isolatitude pixelation.

In this pixelation the Earth is divided in rings, and each ring is divided in pixels taking into account the diameter of the ring.

To reduce the alignment of pixels between rings at the 180° meridian, odd rings have an offset of the size of a half pixel.

func NewPixelation

func NewPixelation(eq int) *Pixelation

NewPixelation returns a new pixelation with a given number of pixels at the equatorial parallel.

func (*Pixelation) Equator

func (pix *Pixelation) Equator() int

Equator returns the number of pixels at the equatorial parallel.

func (*Pixelation) FirstPix

func (pix *Pixelation) FirstPix(ring int) Pixel

FirstPix returns the first pixel of a ring.

func (*Pixelation) FromVector

func (pix *Pixelation) FromVector(v r3.Vec) Pixel

FromVector returns a pixel from a 3D vector of a geographic point. It panics if the vector is not valid (i.e. its norm is different from 1).

func (*Pixelation) ID

func (pix *Pixelation) ID(id int) Pixel

ID returns a pixel by its ID.

func (*Pixelation) Len

func (pix *Pixelation) Len() int

Len returns the number of pixels in the pixelation.

func (*Pixelation) PixPerRing

func (pix *Pixelation) PixPerRing(ring int) int

PixPerRing returns the number of pixels in a ring.

func (*Pixelation) Pixel

func (pix *Pixelation) Pixel(lat, lon float64) Pixel

Pixel returns a pixel from a latitude and longitude coordinate pair. It panics if the coordinates are not valid.

func (*Pixelation) RandInRing

func (pix *Pixelation) RandInRing(ring int) Pixel

RandInRing returns a random pixel at a given ring.

func (*Pixelation) Random

func (pix *Pixelation) Random() Pixel

Random returns a random pixel from the pixelation.

func (*Pixelation) RingLat

func (pix *Pixelation) RingLat(ring int) float64

RingLat returns the latitude of a ring.

func (*Pixelation) Rings

func (pix *Pixelation) Rings() int

Rings returns the number of rings in the pixelation.

func (*Pixelation) Step

func (pix *Pixelation) Step() float64

Step returns the size of a pixel in degrees at equator or its latitude size.

type Point

type Point struct {
	// contains filtered or unexported fields
}

A Point is a geographic point on the surface of the unit length sphere.

func Destination

func Destination(p Point, dist, bearing float64) Point

Destination returns the destination point of a trip starting at point p, given a bearing and a distance (in radians).

func NewPoint

func NewPoint(lat, lon float64) Point

NewPoint returns a geographic point from a pair of geographic coordinates. It panics if the coordinates are not valid.

func (Point) Latitude

func (p Point) Latitude() float64

Latitude returns the latitude of a point.

func (Point) Longitude

func (p Point) Longitude() float64

Longitude returns the longitude of a point.

func (Point) Vector

func (p Point) Vector() r3.Vec

Vector returns the 2D vector representation of a point.

Directories

Path Synopsis
cmd
eqpart
EqPart is a tool to work with a pixelation based on an equal area partitioning.
EqPart is a tool to work with a pixelation based on an equal area partitioning.
eqpart/ids
Package ids implement a command to retrieve the pixel IDs of all pixels in an equal area pixelation.
Package ids implement a command to retrieve the pixel IDs of all pixels in an equal area pixelation.
eqpart/lencmd
Package lencmd implements a command to get the number of pixels in a pixelation based on equal area partitioning.
Package lencmd implements a command to get the number of pixels in a pixelation based on equal area partitioning.
eqpart/mapcmd
Package mapcmd implements a command to draw a pixelation as an image map.
Package mapcmd implements a command to draw a pixelation as an image map.
eqpart/pixel
Package pixel implements a command to get the a pixel location in a pixelation based on an equal area partitioning.
Package pixel implements a command to get the a pixel location in a pixelation based on an equal area partitioning.
eqpart/variance
Package variance implements a command to report the variance of a spherical normal.
Package variance implements a command to report the variance of a spherical normal.
plates
Plates is a tool to manipulate paleogeographic reconstruction models.
Plates is a tool to manipulate paleogeographic reconstruction models.
plates/mapcmd
Package mapcmd implements a command to draw a plate motion model as an image map.
Package mapcmd implements a command to draw a plate motion model as an image map.
plates/pixels
Package pixels is a metapackage for commands that dealt with pixelated plates files.
Package pixels is a metapackage for commands that dealt with pixelated plates files.
plates/pixels/add
Package add implements a command to add locations to a plate pixelation.
Package add implements a command to add locations to a plate pixelation.
plates/pixels/cat
Package cat implements a command to merge several plate pixelation files into a single file.
Package cat implements a command to merge several plate pixelation files into a single file.
plates/pixels/importcmd
Package importcmd implements a command to import features from a GPlates GPML file into an equal area pixelation.
Package importcmd implements a command to import features from a GPlates GPML file into an equal area pixelation.
plates/pixels/list
Package list implements a command to list plates from a plate pixelation file.
Package list implements a command to list plates from a plate pixelation file.
plates/pixels/mapcmd
Package mapcmd implements a command to draw a pixelation as an image map.
Package mapcmd implements a command to draw a pixelation as an image map.
plates/rotate
Package rotate implements a command to add new pixel rotations (i.e.
Package rotate implements a command to add new pixel rotations (i.e.
plates/rotmod
Package rotmod is a metapackage for commands that dealt with rotation models.
Package rotmod is a metapackage for commands that dealt with rotation models.
plates/rotmod/euler
Package euler implements a command to print the Euler rotations of a plate.
Package euler implements a command to print the Euler rotations of a plate.
plates/rotmod/plates
Package plates implements a command to print the plate IDs defined for a rotation model.
Package plates implements a command to print the plate IDs defined for a rotation model.
plates/stages
Package stages implements a command to print the time stages defined in a plate motion model.
Package stages implements a command to print the time stages defined in a plate motion model.
plates/timepix
Package timepix is a metapackage for commands that dealt with time pixelations.
Package timepix is a metapackage for commands that dealt with time pixelations.
plates/timepix/add
Package add implements a command to add pixel values to a time pixelation.
Package add implements a command to add pixel values to a time pixelation.
plates/timepix/change
Package change implements a command to change pixel values of a time pixelation model.
Package change implements a command to change pixel values of a time pixelation model.
plates/timepix/mapcmd
Package mapcmd implements a command to draw a time pixelation model as an image map.
Package mapcmd implements a command to draw a time pixelation model as an image map.
plates/timepix/rotate
Package rotate implements a command to rotate a time pixelation model.
Package rotate implements a command to rotate a time pixelation model.
plates/timepix/set
Package set implements a command to set pixel values to a time pixelation.
Package set implements a command to set pixel values to a time pixelation.
plates/timepix/stages
Package stages implements a command to print the time stages defined in a time pixelation model.
Package stages implements a command to print the time stages defined in a time pixelation model.
plates/timepix/values
Package values implement a command to print the pixel values defined in a time pixelation model.
Package values implement a command to print the pixel values defined in a time pixelation model.
platesgui
PlatesGUI is a graphic tool to manipulate paleogeographic reconstruction models.
PlatesGUI is a graphic tool to manipulate paleogeographic reconstruction models.
platesgui/timepix
Package timepix implements a command to view and edit a time pixelation model.
Package timepix implements a command to view and edit a time pixelation model.
examples
distmat
DistMat benchmarks the calculation of the spherical normal using ring distances and a distance matrix.
DistMat benchmarks the calculation of the spherical normal using ring distances and a distance matrix.
pixdist
PixDist plots the number of pixels at a given distance from a pixel, across multiple latitude rings.
PixDist plots the number of pixels at a given distance from a pixel, across multiple latitude rings.
randnorm
RandNorm produce random points using an spherical normal.
RandNorm produce random points using an spherical normal.
skde
sKDE outputs an spherical KDE.
sKDE outputs an spherical KDE.
variance
Variance plots the variance of an spherical normal relative to the concentration parameter used to define the spherical normal.
Variance plots the variance of an spherical normal relative to the concentration parameter used to define the spherical normal.
Package model implements paleogeographic reconstruction models using a pixelation based on an equal area pixelation and discrete time stages.
Package model implements paleogeographic reconstruction models using a pixelation based on an equal area pixelation and discrete time stages.
Package rotation implements a plate tectonic rotation model.
Package rotation implements a plate tectonic rotation model.
Package stat provides general statistical functions.
Package stat provides general statistical functions.
dist
Package dist provides spherical distribution types.
Package dist provides spherical distribution types.
pixprob
Package pixprob associates a pixelation raster value with a probability for a pixel.
Package pixprob associates a pixelation raster value with a probability for a pixel.
rawdist
Package rawdist provide discretized spherical distribution types, that are un-normalized, that is, they do not sum to one, and its the responsibility of the caller to make the appropriate integration.
Package rawdist provide discretized spherical distribution types, that are un-normalized, that is, they do not sum to one, and its the responsibility of the caller to make the appropriate integration.
Package vector implements geological features using a vectorial data model.
Package vector implements geological features using a vectorial data model.

Jump to

Keyboard shortcuts

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