model

package
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: 11 Imported by: 21

Documentation

Overview

Package model implements paleogeographic reconstruction models using a pixelation based on an equal area pixelation and discrete time stages.

There are different model types depending on how is expected the reconstruction model will be used.

To build a model, type PixPlate is used to provide associations between tectonic plates (which rotations are defined in a rotation file) and the pixels of that plate.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PixAge

type PixAge struct {
	// Name of the feature that contains the pixel
	Name string

	// ID of the pixel
	// (using an isolatitude pixelation)
	ID int

	// Plate ID of the plate that contains the pixel
	Plate int

	// Temporal range of the pixel
	// in years
	Begin int64
	End   int64
}

A PixAge is a pixel with a defined time range.

type PixPlate

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

A PixPlate is a collection of pixels associated to tectonic plates.

func NewPixPlate

func NewPixPlate(pix *earth.Pixelation) *PixPlate

NewPixPlate creates a new plate pixelation from an isolatitude pixelation.

func ReadPixPlate

func ReadPixPlate(r io.Reader, pix *earth.Pixelation) (*PixPlate, error)

ReadPixPlate reads a tectonic plates pixelation from a TSV file.

The TSV file must have the following columns:

  • equator, for the number of pixels at the equator
  • plate, the ID of a tectonic plate
  • pixel, the ID of a pixel (from a pixelation)
  • begin, the oldest age of the pixel (in years)
  • end, the youngest age of the pixel (in years)

Optionally, it can include the following fields:

  • name, name of the tectonic feature

Here is an example file:

# tectonic plates pixelation
equator	plate	pixel	name	begin	end
360	202	29611	Parana	600000000	0
360	802	41257	Antarctica	600000000	0

If no pixelation is given, a new pixelation will be created.

func (*PixPlate) Add

func (pp *PixPlate) Add(plate int, name string, lat, lon float64, begin, end int64)

Add adds a geographic location to a plate in a given time frame (in years).

func (*PixPlate) AddPixels

func (pp *PixPlate) AddPixels(plate int, name string, pixels []int, begin, end int64)

AddPixels adds an slice of pixel IDs to a plate in a given time frame (in years).

func (*PixPlate) Pixel

func (pp *PixPlate) Pixel(plate, pixel int) PixAge

Pixel returns a pixel with of a plate with the indicated ID.

func (*PixPlate) Pixelation

func (pp *PixPlate) Pixelation() *earth.Pixelation

Pixelation returns the underlying pixelation of the pixel collection.

func (*PixPlate) Pixels

func (pp *PixPlate) Pixels(plate int) []int

Pixels return the pixel IDs of a plate.

func (*PixPlate) Plates

func (pp *PixPlate) Plates() []int

Plates return an slice with plate IDs of a plate pixelation.

func (*PixPlate) TSV

func (pp *PixPlate) TSV(w io.Writer) error

TSV encodes a plate pixelation into a TSV file.

type Recons

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

A Recons is an editable plate motion model based on an equal area pixelation and using discrete time stages.

The model is based on tectonic plates so a time pixel should be retrieved by its plate.

func NewRecons

func NewRecons(pix *earth.Pixelation) *Recons

NewRecons creates a new reconstruction model with a given pixelation.

func ReadReconsTSV

func ReadReconsTSV(r io.Reader, pix *earth.Pixelation) (*Recons, error)

ReadReconsTSV reads a plate motion model from a TSV file.

The TSV file must contains the following columns:

  • equator, for the number of pixels at the equator
  • plate, the ID of a tectonic plate
  • pixel, the ID of a pixel (in an equal area pixelation)
  • age, the age of the time stage (in years)
  • stage-pixel, the pixel ID at the time stage

Here is an example file:

equator	plate	pixel	age	stage-pixel
360	59999	17051	100000000	19051
360	59999	17051	140000000	20051
360	59999	17055	100000000	19055
360	59999	17055	140000000	20055
360	59999	17055	140000000	20056

If no pixelation is given, a new pixelation will be created.

func (*Recons) Add

func (rec *Recons) Add(plate int, locations map[int][]int, age int64)

Add adds a set of pixel locations at a time stage, in years, of a plate. Locations is a map in which the key is the pixel ID at the present time, and the value is an slice of pixel IDs of the locations of the pixel at the time stage (because the pixelation is a discrete representation of the continuous space, some reconstructions will produce multiple destinations for the same pixel).

func (*Recons) PixStage

func (rec *Recons) PixStage(plate int, age int64) map[int][]int

PixStage returns pixel locations at a time stage, in years. Locations is a map in which the key is the pixel ID at the present time, and the value is an slice of pixel IDs of the locations of the pixel at the time stage.

func (*Recons) Pixelation

func (rec *Recons) Pixelation() *earth.Pixelation

Pixelation returns the underlying equal area pixelation of the model.

func (*Recons) Pixels

func (rec *Recons) Pixels(plate int) []int

Pixels returns the pixel IDs of a plate at present time.

func (*Recons) Plates

func (rec *Recons) Plates() []int

Plates returns an slice with the plate IDs of the reconstruction model.

func (*Recons) Stages

func (rec *Recons) Stages() []int64

Stages returns the time stages, in years, defined for a reconstruction model.

func (*Recons) TSV

func (rec *Recons) TSV(w io.Writer) error

TSV encodes a plate motion model as a TSV file.

type Rotation

type Rotation struct {
	// Ages (in years) of the rotation
	From int64
	To   int64

	// pixels at 'from' time rotate to 'to' time
	Rot map[int][]int
}

A Rotation is a rotation of a pixel to another time stage.

type StageRot

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

StageRot is a collection of stage rotations.

An stage rotation is a rotation from a pixel at a time stage to another time stage. In this case the time stages are the neighbor time stages defined by a tectonic reconstruction model.

func NewStageRot

func NewStageRot(rec *Recons) *StageRot

NewStageRot returns a collection of stage rotations from a reconstruction model.

func ReadStageRot

func ReadStageRot(r io.Reader, pix *earth.Pixelation) (*StageRot, error)

ReadStageRot reads a collection of stage rotations from a TSV file that contains a plate motion model.

The TSV file is a paleogeographic reconstruction model and must contains the following columns:

The TSV file is a paleogeographic reconstruction model file and must contain the following columns:

  • equator, for the number of pixels at the equator
  • plate, the ID of a tectonic plate
  • pixel, the ID of a pixel (in the isolatitude pixelation)
  • age, the age of the time stage (in years)
  • stage-pixel, the pixel ID at the time stage

Here is an example file:

# paleogeographic reconstruction model
equator	plate	pixel	age	stage-pixel
360	59999	17051	100000000	19051
360	59999	17051	140000000	20051
360	59999	17055	100000000	19055
360	59999	17055	140000000	20055
360	59999	17055	140000000	20056

If no pixelation is given, a new pixelation will be created.

func (*StageRot) ClosestStageAge

func (s *StageRot) ClosestStageAge(age int64) int64

ClosestStageAge returns the closest stage age for a given time i.e. the age of the first time stage younger than the given age.

func (*StageRot) OldToYoung

func (s *StageRot) OldToYoung(oldStage int64) *Rotation

OldToYoung returns an stage rotation from an older stage to it most immediate younger stage. If there is no younger stage, it will return a nil map.

func (*StageRot) Stages

func (s *StageRot) Stages() []int64

Stages return the time stages defined for the stage rotation model.

func (*StageRot) YoungToOld

func (s *StageRot) YoungToOld(youngStage int64) *Rotation

YoungToOld returns an stage rotation from a younger stage to it most immediate older stage. If there is no older stage, it will return a nil map.

type TimePix

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

A TimePix is a pixelated set of values (for example, an environmental variable) at different time stages. Note that only positions and values are stored so the identity of the pixel in time is not preserved.

func NewTimePix

func NewTimePix(pix *earth.Pixelation) *TimePix

NewTimePix returns a new time pixelation based on an equal area pixelation.

func ReadTimePix

func ReadTimePix(r io.Reader, pix *earth.Pixelation) (*TimePix, error)

ReadTimePix reads values of a time pixelation from a TSV file.

The TSV must contain the following columns:

  • equator, for the number of pixels at the equator
  • age, the age of the time stage (in years)
  • stage-pixel, the pixel ID at the time stage
  • value, an integer value

Here is an example file:

equator	age	stage-pixel	value
360	100000000	19051	1
360	100000000	19055	2
360	100000000	19409	1
360	140000000	20051	1
360	140000000	20055	2
360	140000000	20056	3

If no pixelation is given, a new pixelation will be created.

func (*TimePix) At

func (tp *TimePix) At(age int64, pixel int) (int, bool)

At returns the value for a pixel at a time in a time pixelation. If the pixel was never defined, it will return the default value (i.e. 0).

If the time stage is not defined for the time pixelation if will return 0 and false. If a pixel value in the closer time stage is wanted, use AtCloser.

func (*TimePix) AtClosest

func (tp *TimePix) AtClosest(age int64, pixel int) int

AtClosest returns the value for a pixel at the closest time stage (i.e. the age of the oldest stage younger than the indicated age). If the pixel was never defined, it will return the default value (i.e. 0).

func (*TimePix) Bounds

func (tp *TimePix) Bounds(age int64) (old, young int64)

Bounds return the age bounds for the stage of the given age in million years.

func (*TimePix) ClosestStageAge

func (tp *TimePix) ClosestStageAge(age int64) int64

ClosestStageAge returns the closest stage age for a time (i.e. the age of the oldest stage younger than the indicated age).

func (*TimePix) Del

func (tp *TimePix) Del(age int64, pixel int)

Del removes a pixel value at a time in a time pixelation.

func (*TimePix) Pixelation

func (tp *TimePix) Pixelation() *earth.Pixelation

Pixelation returns the underlying equal area pixelation.

func (*TimePix) Set

func (tp *TimePix) Set(age int64, pixel, value int)

Set sets a value for a pixel at a time in a time pixelation.

func (*TimePix) Stage

func (tp *TimePix) Stage(age int64) map[int]int

Stage returns the values for all pixels at a given age (in years).

func (*TimePix) Stages

func (tp *TimePix) Stages() []int64

Stages returns the time stages defined for a time pixelation.

func (*TimePix) TSV

func (tp *TimePix) TSV(w io.Writer) error

TSV encodes a time pixelation as a TSV file.

type Total

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

Total is a collection of total rotations for pixels at present time moved to a given time stage.

func NewTotal

func NewTotal(rec *Recons) *Total

NewTotal returns a collection of total rotations build from a tectonic reconstruction model.

func ReadTotal

func ReadTotal(r io.Reader, pix *earth.Pixelation, inverse bool) (*Total, error)

ReadTotal reads a collection of total rotations from a TSV file that contains a plate motion model. A total rotation is a rotation of a pixel in present time to a given time stage.

If no pixelation is given a new pixelation will be created.

If inverse is true, an inverse rotation will be returned. In an inverse rotation, the reference pixel are at the given time stage an rotate it to their present locations.

func (*Total) ClosestStageAge

func (t *Total) ClosestStageAge(age int64) int64

ClosestStageAge returns the closest stage age for a given time age (i.e. the age of the oldest time stage that is youngest than the given age). This stage age is the one used by Rotation method.

func (*Total) Inverse

func (t *Total) Inverse() *Total

Inverse returns an inverse total rotation, a collection of pixels in past time moved to current time.

func (*Total) IsInverse

func (t *Total) IsInverse() bool

IsInverse returns true in the total rotation is inverse i.e. is from past pixels to present pixels.

func (*Total) Pixelation

func (t *Total) Pixelation() *earth.Pixelation

Pixelation returns the underlying pixelation of a total rotation model.

func (*Total) Rotation

func (t *Total) Rotation(age int64) map[int][]int

Rotation returns a pixel location at a given time stage. Locations is a map in which the key is the pixel ID at present time, and the value is an slice of pixel IDs of the locations of the key pixel at the time stage.

If the age given is not a defined time stage, the returned locations will be from the oldest time stage that is youngest that the given age. For example, the defined stages are [0, 10_000_000, 100_000_000], if asked for the stage 19_843_211 it will return the pixel locations at 10_000_000.

func (*Total) Stages

func (t *Total) Stages() []int64

Stages return the time stages defined for the total rotation model.

Jump to

Keyboard shortcuts

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