meta

package
v0.0.0-...-f0b4dbc Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RadiansToDegrees = 57.2957795
	DegreesToKm      = math.Pi * 6371.0 / 180.0
	RadiansToKm      = RadiansToDegrees * DegreesToKm
)
View Source
const (
	AssetFiles = "assets/*.csv"

	DartsFile     = "network/darts.csv"
	MarksFile     = "network/marks.csv"
	MonumentsFile = "network/monuments.csv"
	MountsFile    = "network/mounts.csv"
	NetworksFile  = "network/networks.csv"
	PointsFile    = "network/points.csv"
	SamplesFile   = "network/samples.csv"
	SitesFile     = "network/sites.csv"
	StationsFile  = "network/stations.csv"
	ViewsFile     = "network/views.csv"

	AntennasFile     = "install/antennas.csv"
	CalibrationsFile = "install/calibrations.csv"
	CamerasFile      = "install/cameras.csv"
	ChannelsFile     = "install/channels.csv"
	ComponentsFile   = "install/components.csv"
	ConnectionsFile  = "install/connections.csv"
	DataloggersFile  = "install/dataloggers.csv"
	DoasesFile       = "install/doases.csv"
	FirmwareFile     = "install/firmware.csv"
	GainsFile        = "install/gains.csv"
	MetsensorsFile   = "install/metsensors.csv"
	PolaritiesFile   = "install/polarities.csv"
	PreampsFile      = "install/preamps.csv"
	RadomesFile      = "install/radomes.csv"
	ReceiversFile    = "install/receivers.csv"
	RecordersFile    = "install/recorders.csv"
	SensorsFile      = "install/sensors.csv"
	SessionsFile     = "install/sessions.csv"
	StreamsFile      = "install/streams.csv"
	TelemetriesFile  = "install/telemetries.csv"
	TimingsFile      = "install/timings.csv"

	ClassesFile      = "environment/classes.csv"
	ConstituentsFile = "environment/constituents.csv"
	FeaturesFile     = "environment/features.csv"
	GaugesFile       = "environment/gauges.csv"
	PlacenamesFile   = "environment/placenames.csv"
	VisibilityFile   = "environment/visibility.csv"

	CitationsFile = "references/citations.csv"
)
View Source
const DateTimeFormat = "2006-01-02T15:04:05Z"

DateTimeFormat is the standard date and time storage format used in the CSV files, it is assumed to have resolution of one second and that times are in UTC.

Variables

View Source
var ErrInvalidDOI = errors.New("invalid DOI reference")

Functions

func DecodeList

func DecodeList(data [][]string, l ListDecoder) error

DecodeList converts a slice of string slices into a type that implements the ListDecoder interface, it returns a non empty error otherwise.

func EncodeList

func EncodeList(l ListEncoder) [][]string

EncodeList converts a type that implements the ListEncoder interface into a slice of string slices.

func Format

func Format(t time.Time) string

Format outputs a Time using the DateTimeFormat format.

func LoadList

func LoadList(path string, l ListDecoder) error

LoadList reads and decodes a file into a type that implements the ListDecoder interface, it returns a non empty error otherwise.

func MarshalList

func MarshalList(l ListEncoder) ([]byte, error)

MarshalList converts a type that implements the ListEncoder interface into a byte slice, or returns an error otherwise.

func ParseFloat64

func ParseFloat64(s string) (float64, error)

ParseFloat64 converts a string into a float64 value. After trimming spaces, an empty string will return zero, otherwise the converted number is returned or an error if the conversion failed.

func ParseInt

func ParseInt(s string) (int, error)

ParseInt converts a string into a int value. After trimming spaces, an empty string will return zero, otherwise the converted number is returned or an error if the conversion failed.

func ParseSamplingRate

func ParseSamplingRate(s string) (float64, error)

ParseSamplingRate converts a string into a float64 value representing a sampling rate. After trimming spaces, an empty string will return zero, otherwise the converted sample rate is returned or an error if the float64 conversion failed. For initial sampling rates that are found to be negative the inverse of the negative sampling rate is returned, the negative number indicates that the value is actually a sampling period.

func StoreList

func StoreList(path string, l ListEncoder) error

StoreList encodes and writes into a file the contents of a type that implements the ListEncoder interface, it returns a non empty error otherwise.

func UnmarshalList

func UnmarshalList(b []byte, l ListDecoder) error

UnmarshalList decodes a byte slice into a type that implements the ListDecoder interface, it returns a non empty error otherwise.

Types

type Asset

type Asset struct {
	Equipment
	Number string
	Notes  string
}

func LoadAssets

func LoadAssets(path string) ([]Asset, error)

type AssetList

type AssetList []Asset

func (AssetList) Len

func (a AssetList) Len() int

func (AssetList) Less

func (a AssetList) Less(i, j int) bool

func (AssetList) Swap

func (a AssetList) Swap(i, j int)

type Calibration

type Calibration struct {
	Install

	ScaleFactor   float64
	ScaleBias     float64
	ScaleAbsolute float64
	Frequency     float64
	Number        int
	// contains filtered or unexported fields
}

Calibration defines times where sensor scaling or offsets are needed, these will be overwrite the existing values, i.e. A + BX => A' + B' X, where A' and B' are the given bias and scaling factors.

func LoadCalibrations

func LoadCalibrations(path string) ([]Calibration, error)

LoadCalibrations reads a CSV formatted file and returns a slice of Calibration types.

func (Calibration) Id

func (c Calibration) Id() string

Id returns a unique string which can be used for sorting or checking.

func (Calibration) Less

func (s Calibration) Less(calibration Calibration) bool

Less returns whether one Calibration sorts before another.

type CalibrationList

type CalibrationList []Calibration

CalibrationList is a slice of Calibration types.

func (CalibrationList) Len

func (c CalibrationList) Len() int

func (CalibrationList) Less

func (c CalibrationList) Less(i, j int) bool

func (CalibrationList) Swap

func (c CalibrationList) Swap(i, j int)

type Channel

type Channel struct {
	Make         string
	Model        string
	Type         string
	SamplingRate float64
	Response     string
	Number       int
	// contains filtered or unexported fields
}

Channel is used to describe a generic recording from a Datalogger.

func LoadChannels

func LoadChannels(path string) ([]Channel, error)

func (Channel) Description

func (c Channel) Description() string

Description returns a short label for the channel model family.

func (Channel) Less

func (c Channel) Less(comp Channel) bool

Less compares Channel structs suitable for sorting.

type ChannelList

type ChannelList []Channel

func (ChannelList) Len

func (c ChannelList) Len() int

func (ChannelList) Less

func (c ChannelList) Less(i, j int) bool

func (ChannelList) Swap

func (c ChannelList) Swap(i, j int)

type Citation

type Citation struct {
	Key       string
	Author    string
	Year      int
	Title     string
	Published string
	Volume    string
	Pages     string
	Doi       Doi
	Link      string
	Retrieved time.Time
	// contains filtered or unexported fields
}

func LoadCitations

func LoadCitations(path string) ([]Citation, error)

type CitationList

type CitationList []Citation

func (CitationList) Len

func (c CitationList) Len() int

func (CitationList) Less

func (c CitationList) Less(i, j int) bool

func (CitationList) Swap

func (c CitationList) Swap(i, j int)

type Class

type Class struct {
	Station       string
	SiteClass     string
	Vs30          float64
	Vs30Quality   string
	Tsite         Range
	TsiteMethod   string
	TsiteQuality  string
	BasementDepth float64
	DepthQuality  string
	Link          string
	Citations     []string
	Notes         string
}

func LoadClasses

func LoadClasses(path string) ([]Class, error)

func (Class) Less

func (c Class) Less(class Class) bool

type ClassList

type ClassList []Class

func (ClassList) Len

func (c ClassList) Len() int

func (ClassList) Less

func (c ClassList) Less(i, j int) bool

func (ClassList) Swap

func (c ClassList) Swap(i, j int)

type Collection

Collection describes the period where a sensor and a datalogger are co-located at a site with the associated streams.

func (Collection) Azimuth

func (c Collection) Azimuth(polarity *Polarity) float64

Azimuth returns the horizontal orientation of the recorded stream in degrees from north.

func (Collection) Code

func (c Collection) Code() string

Code returns the Channel code based on the Stream and Component values.

func (Collection) Dip

func (c Collection) Dip(polarity *Polarity) float64

Dip returns the vertical orientation of the recorded stream in degrees from the vertical, positive values are downwards.

func (Collection) Less

func (c Collection) Less(collection Collection) bool

Less compares whether one Collection will sort before another.

func (Collection) Subsource

func (c Collection) Subsource() string

Subsource returns the Subsource code based on the Stream and Component values.

type Compare

type Compare int
const (
	EqualTo Compare = iota
	LessThan
	GreaterThan
)

type Component

type Component struct {
	Make         string
	Model        string
	Type         string
	Number       int
	Source       string
	Subsource    string
	Dip          float64
	Azimuth      float64
	Types        string
	SamplingRate float64
	Response     string
	// contains filtered or unexported fields
}

func LoadComponents

func LoadComponents(path string) ([]Component, error)

func (Component) Description

func (c Component) Description() string

Description returns a short label for the channel model family.

func (Component) Less

func (c Component) Less(comp Component) bool

Less compares Component structs suitable for sorting.

type ComponentList

type ComponentList []Component

func (ComponentList) Len

func (c ComponentList) Len() int

func (ComponentList) Less

func (c ComponentList) Less(i, j int) bool

func (ComponentList) Swap

func (c ComponentList) Swap(i, j int)

type Connection

type Connection struct {
	Span

	Station  string
	Location string
	Place    string
	Role     string
	Number   int
	// contains filtered or unexported fields
}

func LoadConnections

func LoadConnections(path string) ([]Connection, error)

type ConnectionList

type ConnectionList []Connection

func (ConnectionList) Len

func (c ConnectionList) Len() int

func (ConnectionList) Less

func (c ConnectionList) Less(i, j int) bool

func (ConnectionList) Swap

func (c ConnectionList) Swap(i, j int)

type Constituent

type Constituent struct {
	Span

	Gauge     string
	Number    int
	Name      string
	Amplitude float64
	Lag       float64
	// contains filtered or unexported fields
}

func LoadConstituents

func LoadConstituents(path string) ([]Constituent, error)

type ConstituentList

type ConstituentList []Constituent

func (ConstituentList) Len

func (c ConstituentList) Len() int

func (ConstituentList) Less

func (c ConstituentList) Less(i, j int) bool

func (ConstituentList) Swap

func (c ConstituentList) Swap(i, j int)

type Correction

type Correction struct {
	Span

	Polarity              *Polarity
	Gain                  *Gain
	Preamp                *Preamp
	Telemetry             *Telemetry
	Timing                *Timing
	SensorCalibration     *Calibration
	DataloggerCalibration *Calibration
}

Correction contains adjustments to a Sensor and Datalogger instrument details to account for installation settings and changes.

type Dart

type Dart struct {
	Span

	Station       string
	Pid           string
	WmoIdentifier string
}

func LoadDarts

func LoadDarts(path string) ([]Dart, error)

type DartList

type DartList []Dart

func (DartList) Len

func (d DartList) Len() int

func (DartList) Less

func (d DartList) Less(i, j int) bool

func (DartList) Swap

func (d DartList) Swap(i, j int)

type DeployedDatalogger

type DeployedDatalogger struct {
	Install

	Place string
	Role  string
}

func LoadDeployedDataloggers

func LoadDeployedDataloggers(path string) ([]DeployedDatalogger, error)

type DeployedDataloggerList

type DeployedDataloggerList []DeployedDatalogger

func (DeployedDataloggerList) Len

func (dd DeployedDataloggerList) Len() int

func (DeployedDataloggerList) Less

func (dd DeployedDataloggerList) Less(i, j int) bool

func (DeployedDataloggerList) Swap

func (dd DeployedDataloggerList) Swap(i, j int)

type DeployedReceiver

type DeployedReceiver struct {
	Install

	Mark string
}

func LoadDeployedReceivers

func LoadDeployedReceivers(path string) ([]DeployedReceiver, error)

type DeployedReceiverList

type DeployedReceiverList []DeployedReceiver

func (DeployedReceiverList) Len

func (dr DeployedReceiverList) Len() int

func (DeployedReceiverList) Less

func (dr DeployedReceiverList) Less(i, j int) bool

func (DeployedReceiverList) Swap

func (dr DeployedReceiverList) Swap(i, j int)

type Doi

type Doi string

func MustDoi

func MustDoi(doi string) Doi

MustDoi returns a Doi value, or panics. This is useful for testing with known values.

func NewDoi

func NewDoi(doi string) (Doi, error)

NewDoi returns a Doi value from a string after checking.

func (Doi) Equal

func (d Doi) Equal(doi Doi) bool

func (Doi) MarshalText

func (d Doi) MarshalText() ([]byte, error)

MarshalText implements the TextMarshaler interface.

func (Doi) String

func (d Doi) String() string

func (*Doi) UnmarshalText

func (d *Doi) UnmarshalText(data []byte) error

UnmarshalText implements the TextUnmarshaler interface.

type Equipment

type Equipment struct {
	// Make describes the manufacturer or equipment maker.
	Make string
	// Model describes the manufacturer's model name.
	Model string
	// Serial describes the manufacturer's identification of the device.
	Serial string
}

Equipment represents an indiviual piece of hardware.

func (Equipment) Less

func (e Equipment) Less(eq Equipment) bool

Less compares Equipment structs suitable for sorting.

func (Equipment) String

func (e Equipment) String() string

type Feature

type Feature struct {
	Span

	Station     string
	Location    string
	Sublocation string
	Property    string
	Description string
	Aspect      string
}

func LoadFeatures

func LoadFeatures(path string) ([]Feature, error)

func (Feature) Id

func (f Feature) Id() string

Id is a shorthand reference to the sample for debugging or testing.

func (Feature) Less

func (f Feature) Less(feature Feature) bool

Less allows samples to be sorted.

func (Feature) Overlaps

func (f Feature) Overlaps(feature Feature) bool

Overlaps allows samples to be tested.

type FeatureList

type FeatureList []Feature

func (FeatureList) Len

func (f FeatureList) Len() int

func (FeatureList) Less

func (f FeatureList) Less(i, j int) bool

func (FeatureList) Swap

func (f FeatureList) Swap(i, j int)

type Field

type Field map[int]int

Field is a mapping between the expected field entry and the csv file column number. This allows finding the desired column without being explicitly constrained by the column contents or order.

func (Field) Remap

func (f Field) Remap(data []string) map[int]string

Remap will convert a csv data row into a entry key map.

type FirmwareHistory

type FirmwareHistory struct {
	Install

	Version string
	Notes   string
}

func LoadFirmwareHistory

func LoadFirmwareHistory(path string) ([]FirmwareHistory, error)

type FirmwareHistoryList

type FirmwareHistoryList []FirmwareHistory

func (FirmwareHistoryList) Len

func (fh FirmwareHistoryList) Len() int

func (FirmwareHistoryList) Less

func (fh FirmwareHistoryList) Less(i, j int) bool

func (FirmwareHistoryList) Swap

func (fh FirmwareHistoryList) Swap(i, j int)

type Gain

type Gain struct {
	Span
	Scale

	Station     string
	Location    string
	Sublocation string
	Subsource   string
	Absolute    float64
	// contains filtered or unexported fields
}

Gain defines times where sensor installation scaling or offsets are needed, these will be applied to the existing values, i.e. A * X + B => A * A' * X + B * A' + A * B' + C where A' and B' are the gain scale factor and bias and C is the absolute bias.

func LoadGains

func LoadGains(path string) ([]Gain, error)

func (Gain) Gains

func (g Gain) Gains() []Gain

Gains returns a sorted slice of single Gain entries.

func (Gain) Id

func (g Gain) Id() string

Id returns a unique string which can be used for sorting or checking.

func (Gain) Less

func (g Gain) Less(gain Gain) bool

Less returns whether one Gain sorts before another.

func (Gain) Subsources

func (g Gain) Subsources() []string

Subsources returns a sorted slice of single defined components.

type GainList

type GainList []Gain

func (GainList) Len

func (g GainList) Len() int

func (GainList) Less

func (g GainList) Less(i, j int) bool

func (GainList) Swap

func (g GainList) Swap(i, j int)

type Gauge

type Gauge struct {
	Span
	Reference
	Position

	Number   string
	TimeZone float64
	Crex     string
	// contains filtered or unexported fields
}

func LoadGauges

func LoadGauges(path string) ([]Gauge, error)

type GaugeList

type GaugeList []Gauge

func (GaugeList) Len

func (g GaugeList) Len() int

func (GaugeList) Less

func (g GaugeList) Less(i, j int) bool

func (GaugeList) Swap

func (g GaugeList) Swap(i, j int)
type Header map[string]int

Header is used to manage the encoding and decoding of csv formatted files by using their column headers. This allows adding or removing columns in the file without breaking existing applications that may not understand or expect extra columns.

An example usage where data is a slice of csv rows.

var headers Header = map[string]int{
  "Label":    labelId,
  ...
}

fields := headers.Fields(data[0])
for _, v := range data[1:] {
  d := fields.Remap(v)

  label :=  d[labelId]

  ...
}

func (Header) Columns

func (h Header) Columns() []string

Columns will return the csv column headers in the sorted order of the Header values.

func (Header) Fields

func (h Header) Fields(columns []string) Field

Fields converts a csv header row into a Column for use with field name lookups.

type Install

type Install struct {
	// Equipment respresents the actual installed equipment.
	Equipment
	// Span describes the installed time period.
	Span
}

Install is a compounded struct the represents the installation of a piece of equipment over a given time period.

func (Install) Less

func (i Install) Less(in Install) bool

Less compares Install structs suitable for sorting.

type InstalledAntenna

type InstalledAntenna struct {
	Install
	Offset

	Mark    string
	Azimuth float64
	// contains filtered or unexported fields
}

func LoadInstalledAntennas

func LoadInstalledAntennas(path string) ([]InstalledAntenna, error)

type InstalledAntennaList

type InstalledAntennaList []InstalledAntenna

func (InstalledAntennaList) Len

func (ia InstalledAntennaList) Len() int

func (InstalledAntennaList) Less

func (ia InstalledAntennaList) Less(i, j int) bool

func (InstalledAntennaList) Swap

func (ia InstalledAntennaList) Swap(i, j int)

type InstalledCamera

type InstalledCamera struct {
	Install
	Orientation
	Offset

	Mount string
	View  string
	Notes string
}

func LoadInstalledCameras

func LoadInstalledCameras(path string) ([]InstalledCamera, error)

type InstalledCameraList

type InstalledCameraList []InstalledCamera

func (InstalledCameraList) Len

func (ic InstalledCameraList) Len() int

func (InstalledCameraList) Less

func (ic InstalledCameraList) Less(i, j int) bool

func (InstalledCameraList) Swap

func (ic InstalledCameraList) Swap(i, j int)

type InstalledDoas

type InstalledDoas struct {
	Install
	Orientation
	Offset

	Mount string
	View  string
}

func LoadInstalledDoass

func LoadInstalledDoass(path string) ([]InstalledDoas, error)

type InstalledDoasList

type InstalledDoasList []InstalledDoas

func (InstalledDoasList) Len

func (id InstalledDoasList) Len() int

func (InstalledDoasList) Less

func (id InstalledDoasList) Less(i, j int) bool

func (InstalledDoasList) Swap

func (id InstalledDoasList) Swap(i, j int)

type InstalledMetSensor

type InstalledMetSensor struct {
	Install
	Position

	Mark       string
	IMSComment string
	Accuracy   MetSensorAccuracy
}

func LoadInstalledMetSensors

func LoadInstalledMetSensors(path string) ([]InstalledMetSensor, error)

type InstalledMetSensorList

type InstalledMetSensorList []InstalledMetSensor

func (InstalledMetSensorList) Len

func (ims InstalledMetSensorList) Len() int

func (InstalledMetSensorList) Less

func (ims InstalledMetSensorList) Less(i, j int) bool

func (InstalledMetSensorList) Swap

func (ims InstalledMetSensorList) Swap(i, j int)

type InstalledRadome

type InstalledRadome struct {
	Install

	Mark string
}

func LoadInstalledRadomes

func LoadInstalledRadomes(path string) ([]InstalledRadome, error)

type InstalledRadomeList

type InstalledRadomeList []InstalledRadome

func (InstalledRadomeList) Len

func (ir InstalledRadomeList) Len() int

func (InstalledRadomeList) Less

func (ir InstalledRadomeList) Less(i, j int) bool

func (InstalledRadomeList) Swap

func (ir InstalledRadomeList) Swap(i, j int)

type InstalledRecorder

type InstalledRecorder struct {
	InstalledSensor

	DataloggerModel string
}

func LoadInstalledRecorders

func LoadInstalledRecorders(path string) ([]InstalledRecorder, error)

type InstalledRecorderList

type InstalledRecorderList []InstalledRecorder

func (InstalledRecorderList) Len

func (ir InstalledRecorderList) Len() int

func (InstalledRecorderList) Less

func (ir InstalledRecorderList) Less(i, j int) bool

func (InstalledRecorderList) Swap

func (ir InstalledRecorderList) Swap(i, j int)

type InstalledSensor

type InstalledSensor struct {
	Install
	Orientation
	Offset
	Scale

	Station  string
	Location string
}

func LoadInstalledSensors

func LoadInstalledSensors(path string) ([]InstalledSensor, error)

type InstalledSensorList

type InstalledSensorList []InstalledSensor

func (InstalledSensorList) Len

func (is InstalledSensorList) Len() int

func (InstalledSensorList) Less

func (is InstalledSensorList) Less(i, j int) bool

func (InstalledSensorList) Swap

func (is InstalledSensorList) Swap(i, j int)

type List

type List interface {
	ListEncoder
	ListDecoder

	sort.Interface
}

List is an interface the encapsulates the ListEncoder, ListDecoder and sort.Interface interfaces, suitable for reading and writing CSV files.

type ListDecoder

type ListDecoder interface {
	// contains filtered or unexported methods
}

ListDecoder is an interface for decoding a slice of string slices into a type, suitable for reading from a CSV file.

type ListEncoder

type ListEncoder interface {
	// contains filtered or unexported methods
}

ListEncoder is an interface for encoding a type into a slice of string slices, suitable for storing in a CSV file.

type Mark

type Mark struct {
	Reference
	Position
	Span

	Igs bool
}

func LoadMarks

func LoadMarks(path string) ([]Mark, error)

type MarkList

type MarkList []Mark

func (MarkList) Len

func (m MarkList) Len() int

func (MarkList) Less

func (m MarkList) Less(i, j int) bool

func (MarkList) Swap

func (m MarkList) Swap(i, j int)

type MetSensorAccuracy

type MetSensorAccuracy struct {
	Humidity    float64
	Pressure    float64
	Temperature float64
	// contains filtered or unexported fields
}

type Monument

type Monument struct {
	Span

	Mark               string
	DomesNumber        string
	MarkType           string
	Type               string
	GroundRelationship float64
	FoundationType     string
	FoundationDepth    float64
	Bedrock            string
	Geology            string
	// contains filtered or unexported fields
}

func LoadMonuments

func LoadMonuments(path string) ([]Monument, error)

type MonumentList

type MonumentList []Monument

func (MonumentList) Len

func (m MonumentList) Len() int

func (MonumentList) Less

func (m MonumentList) Less(i, j int) bool

func (MonumentList) Swap

func (m MonumentList) Swap(i, j int)

type Mount

type Mount struct {
	Reference
	Position
	Span

	Description string
}

func LoadMounts

func LoadMounts(path string) ([]Mount, error)

type MountList

type MountList []Mount

func (MountList) Len

func (m MountList) Len() int

func (MountList) Less

func (m MountList) Less(i, j int) bool

func (MountList) Swap

func (m MountList) Swap(i, j int)

type Network

type Network struct {
	Code        string
	External    string
	Description string
	Restricted  bool
}

func LoadNetworks

func LoadNetworks(path string) ([]Network, error)

type NetworkList

type NetworkList []Network

func (NetworkList) Len

func (n NetworkList) Len() int

func (NetworkList) Less

func (n NetworkList) Less(i, j int) bool

func (NetworkList) Swap

func (n NetworkList) Swap(i, j int)

type Offset

type Offset struct {
	// Vertical represents an adjustment up or down, the exact interpretation will depend on the use case,
	// although it is assumed to have units of meters.
	Vertical float64
	// North can be used to offset the installation to northwards, it is asusmed to have units of meters.
	North float64
	// East can be used to offset the installation to eastwards, it is asusmed to have units of meters.
	East float64
	// contains filtered or unexported fields
}

Offset can be used to adjust an equipment installation relative to a given Position.

func (Offset) EastOk

func (o Offset) EastOk() (float64, bool)

EastOk returns the East offset and whether it has been set.

func (Offset) NorthOk

func (o Offset) NorthOk() (float64, bool)

NorthOk returns the North offset and whether it has been set.

func (Offset) VerticalOk

func (o Offset) VerticalOk() (float64, bool)

VerticalOk returns the Vertical offset and whether it has been set.

type Orientation

type Orientation struct {
	// Dip represents the vertical deployment, with a zero value representing a horizontal installation,
	// a positive value indicating a installation downwards, whereas a negative value indicates an upward
	// facing installation.
	Dip float64
	// Azimuth represents an equipment installation bearing, ideally with reference to true north.
	Azimuth float64
	// Method can be used to indicate the method or measuring the azimuth.
	Method string
	// contains filtered or unexported fields
}

Orientation is used to describe how a piece of installed equipment is aligned.

func (Orientation) AzimuthOk

func (o Orientation) AzimuthOk() (float64, bool)

AzimuthOk returns the Azimuth and whether it has been set.

func (Orientation) DipOk

func (o Orientation) DipOk() (float64, bool)

DipOk returns the Dip and whether it has been set.

type Placename

type Placename struct {
	Name      string
	Latitude  float64
	Longitude float64
	Level     int
	// contains filtered or unexported fields
}

Placename is used to describe distances and azimuths to known places.

func LoadPlacenames

func LoadPlacenames(path string) ([]Placename, error)

func (Placename) Azimuth

func (p Placename) Azimuth(lat, lon float64) float64

Azimuth returns the azimuth in degrees from the given latitude and longitude to the Placename.

func (Placename) BackAzimuth

func (p Placename) BackAzimuth(lat, lon float64) float64

BackAzimuth returns the back-azimuth in degrees from the given latitude and longitude to the Placename.

func (Placename) Compass

func (p Placename) Compass(lat, lon float64) string

Compass returns a text representation of the azimuth from the given latitude and longitude to the Placename.

func (Placename) Distance

func (p Placename) Distance(lat, lon float64) float64

Distance returns the distance in kilometres from the given latitude and longitude to the Placename.

type PlacenameList

type PlacenameList []Placename

func (PlacenameList) Closest

func (p PlacenameList) Closest(lat, lon float64) (Placename, bool)

Closest returns the Placename which is the closest to the given latitude and longitude taking into account the Placename level. The level is used to avoid small places taking precident over larger places at longer distances. Currently level three addresses will be used for distances within 20 km, level two within 100 km, level one within 500km, and level zero has no distance threshold.

func (PlacenameList) Description

func (p PlacenameList) Description(lat, lon float64) string

Description returns a string representation of where a point location is relative to the nearest place.

func (PlacenameList) Len

func (p PlacenameList) Len() int

func (PlacenameList) Less

func (p PlacenameList) Less(i, j int) bool

func (PlacenameList) Swap

func (p PlacenameList) Swap(i, j int)

type Point

type Point struct {
	Position
	Span

	Sample   string
	Location string
	Survey   string
}

func LoadPoints

func LoadPoints(path string) ([]Point, error)

func (Point) Less

func (s Point) Less(point Point) bool

type PointList

type PointList []Point

func (PointList) Len

func (s PointList) Len() int

func (PointList) Less

func (s PointList) Less(i, j int) bool

func (PointList) Swap

func (s PointList) Swap(i, j int)

type Polarity

type Polarity struct {
	Span

	Station     string
	Location    string
	Sublocation string
	Subsource   string
	Primary     bool
	Reversed    bool
	Method      string
	Citation    string
	// contains filtered or unexported fields
}

func LoadPolarities

func LoadPolarities(path string) ([]Polarity, error)

func (Polarity) Less

func (p Polarity) Less(polarity Polarity) bool

type PolarityList

type PolarityList []Polarity

func (PolarityList) Len

func (p PolarityList) Len() int

func (PolarityList) Less

func (p PolarityList) Less(i, j int) bool

func (PolarityList) Swap

func (p PolarityList) Swap(i, j int)

type Position

type Position struct {
	// Latitude represents the location latitude, with negative values representing southern latitudes.
	Latitude float64
	// Longitude represents the location longitude, with negative values representing western longitudes.
	Longitude float64
	// Elevation represents the location height relative to the given datum.
	Elevation float64
	// Datum can be used to indicate the location measurement reference.
	Datum string
	// Depth measures the depth of water at the measurement position, if appropriate.
	Depth float64
	// contains filtered or unexported fields
}

Position describes a measurement location geographically.

func (Position) DepthOk

func (p Position) DepthOk() (float64, bool)

DepthOk returns the Depth and whether it has been set.

func (Position) ElevationOk

func (p Position) ElevationOk() (float64, bool)

ElevationOk returns the Elevation and whether it has been set.

type Preamp

type Preamp struct {
	Span

	Station     string
	Location    string
	Subsource   string
	ScaleFactor float64
	// contains filtered or unexported fields
}

Preamp describes when a datalogger is using an analogue pre-amplification gain setting to boost the input signal.

func LoadPreamps

func LoadPreamps(path string) ([]Preamp, error)

func (Preamp) Id

func (p Preamp) Id() string

Id returns a unique string which can be used for sorting or checking.

func (Preamp) Less

func (p Preamp) Less(preamp Preamp) bool

Less returns whether one Preamp sorts before another.

func (Preamp) Preamps

func (p Preamp) Preamps() []Preamp

Preamps returns a sorted slice of single Preamp entries by unpacking multiple subsources if present.

func (Preamp) Subsources

func (p Preamp) Subsources() []string

Subsources returns a sorted slice of single byte defined components which allows unpacking multiple subsources.

type PreampList

type PreampList []Preamp

func (PreampList) Len

func (p PreampList) Len() int

func (PreampList) Less

func (p PreampList) Less(i, j int) bool

func (PreampList) Swap

func (p PreampList) Swap(i, j int)

type Range

type Range struct {
	Value   float64
	Compare Compare
}

func NewRange

func NewRange(s string) (Range, error)

func (Range) String

func (r Range) String() string

type Reference

type Reference struct {
	// Code is used to identify the measurement location.
	Code string
	// Network can be used to group multiple measurement locations.
	Network string
	// Name is used to label the measurement location.
	Name string
}

Reference describes a location where measurements can be taken.

type Sample

type Sample struct {
	Reference
	Position
	Span
}

Sample represents the location and time span of where data was manually collected.

func LoadSamples

func LoadSamples(path string) ([]Sample, error)

func (Sample) Id

func (s Sample) Id() string

Id is a shorthand reference to the sample for debugging or testing.

func (Sample) Less

func (s Sample) Less(sample Sample) bool

Less allows samples to be sorted.

func (Sample) Overlaps

func (s Sample) Overlaps(sample Sample) bool

Overlaps allows samples to be tested.

type SampleList

type SampleList []Sample

SampleList is a slice of Samples and generally maps the associated file content.

func (SampleList) Len

func (s SampleList) Len() int

func (SampleList) Less

func (s SampleList) Less(i, j int) bool

func (SampleList) Swap

func (s SampleList) Swap(i, j int)

type Scale

type Scale struct {
	// Factor can be used to represent a change of scale of the recorded value.
	Factor float64
	// Bias can be used to represent an offset to the recorded value.
	Bias float64
	// contains filtered or unexported fields
}

Scale can be used to represent a non-linear installation, such as a pressure sensor installed in sea water rather than fresh water.

func (Scale) BiasOk

func (s Scale) BiasOk() (float64, bool)

BiasOk returns the Bias and whether it has been set.

func (Scale) FactortOk

func (s Scale) FactortOk() (float64, bool)

FactorOk returns the Factor and whether it has been set.

type Session

type Session struct {
	Span

	Mark            string
	Operator        string
	Agency          string
	Model           string
	SatelliteSystem string
	Interval        time.Duration
	ElevationMask   float64
	HeaderComment   string
	Format          string
	// contains filtered or unexported fields
}

func LoadSessions

func LoadSessions(path string) ([]Session, error)

func (Session) Less

func (s Session) Less(session Session) bool

type SessionList

type SessionList []Session

func (SessionList) Len

func (s SessionList) Len() int

func (SessionList) Less

func (s SessionList) Less(i, j int) bool

func (SessionList) Swap

func (s SessionList) Swap(i, j int)

type Set

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

Set allows for extracting and unmarshalling the base delta csv files, optional SetPathMap functions can be given to alter the expected default file paths prior to reading from the FS set. This is useful for testing or using a non-standard file layout.

func NewSet

func NewSet(fsys fs.FS, maps ...SetPathMap) (*Set, error)

NewSet returns a Set pointer for the given FS and optional SetPathMap functions to manipulate the internal csv file paths.

func (Set) Asset

func (s Set) Asset(make, model, serial string) (Asset, bool)

Asset is a helper function to return a Asset value and true if one exists.

func (Set) Assets

func (s Set) Assets() []Asset

Assets is a helper function to return a slice copy of Asset values.

func (Set) Calibrations

func (s Set) Calibrations() []Calibration

Calibrations is a helper function to return a slice copy of Calibration values.

func (Set) Channels

func (s Set) Channels() []Channel

Channels is a helper function to return a slice copy of Channel values.

func (Set) Citation

func (s Set) Citation(key string) (Citation, bool)

Citation is a helper function to return a Citation value and true if one exists.

func (Set) Citations

func (s Set) Citations() []Citation

Citations is a helper function to return a slice copy of Citation values.

func (Set) Class

func (s Set) Class(station string) (Class, bool)

Class is a helper function to return a Class value and true if one exists.

func (Set) Classes

func (s Set) Classes() []Class

Classes is a helper function to return a slice copy of Class values.

func (*Set) Collections

func (s *Set) Collections(site Site) []Collection

Collections decodes the stored sensor and datalogger installation times and builds a slice of overlapping time spans for the given site.

func (Set) Components

func (s Set) Components() []Component

Components is a helper function to return a slice copy of Component values.

func (Set) Connections

func (s Set) Connections() []Connection

Connections is a helper function to return a slice copy of Connection values.

func (Set) Constituents

func (s Set) Constituents() []Constituent

Constituents is a helper function to return a slice copy of Constituent values.

func (*Set) Corrections

func (set *Set) Corrections(coll Collection) []Correction

Corrections returns a slice of Correction values for a given Collection.

func (Set) Dart

func (s Set) Dart(station string) (Dart, bool)

Dart is a helper function to return a Dart value and true if one exists.

func (Set) Darts

func (s Set) Darts() []Dart

Darts is a helper function to return a slice copy of Dart values.

func (*Set) DataloggerCalibrationCorrections

func (s *Set) DataloggerCalibrationCorrections(coll Collection) []Correction

DataloggerCalibrationCorrections returns a slice of Correction values to account for any changes in DeployedDatalogger Calibration.

func (Set) DeployedDataloggers

func (s Set) DeployedDataloggers() []DeployedDatalogger

DeployedDataloggers is a helper function to return a slice copy of DeployedDatalogger values.

func (Set) DeployedReceivers

func (s Set) DeployedReceivers() []DeployedReceiver

DeployedReceivers is a helper function to return a slice copy of DeployedReceiver values.

func (Set) Doases

func (s Set) Doases() []InstalledDoas

Doases is a helper function to return a slice copy of InstalledDoas values.

func (Set) Features

func (s Set) Features() []Feature

Features is a helper function to return a slice copy of Feature values.

func (Set) FirmwareHistory

func (s Set) FirmwareHistory() []FirmwareHistory

FirmwareHistory is a helper function to return a slice copy of FirmwareHistory values.

func (*Set) GainCorrections

func (s *Set) GainCorrections(coll Collection) []Correction

GainCorrections returns a slice of Correction values to account for any changes in Gain.

func (Set) Gains

func (s Set) Gains() []Gain

Gains is a helper function to return a slice copy of Gain values.

func (Set) Gauges

func (s Set) Gauges() []Gauge

Gauges is a helper function to return a slice copy of Gauge values.

func (Set) InstalledAntennas

func (s Set) InstalledAntennas() []InstalledAntenna

InstalledAntennas is a helper function to return a slice copy of InstalledAntenna values.

func (Set) InstalledCameras

func (s Set) InstalledCameras() []InstalledCamera

InstalledCameras is a helper function to return a slice copy of InstalledCamera values.

func (Set) InstalledMetSensors

func (s Set) InstalledMetSensors() []InstalledMetSensor

InstalledMetSensors is a helper function to return a slice copy of InstalledMetSensor values.

func (Set) InstalledRadomes

func (s Set) InstalledRadomes() []InstalledRadome

InstalledRadomes is a helper function to return a slice copy of InstalledRadome values.

func (Set) InstalledRecorders

func (s Set) InstalledRecorders() []InstalledRecorder

InstalledRecorders is a helper function to return a slice copy of InstalledRecorder values.

func (Set) InstalledSensors

func (s Set) InstalledSensors() []InstalledSensor

InstalledSensors is a helper function to return a slice copy of InstalledSensor values.

func (Set) Mark

func (s Set) Mark(code string) (Mark, bool)

Mark is a helper function to return a Mark value and true if one exists.

func (Set) Marks

func (s Set) Marks() []Mark

Marks is a helper function to return a slice copy of Mark values.

func (Set) Monument

func (s Set) Monument(mark string) (Monument, bool)

Monument is a helper function to return a Monument value and true if one exists.

func (Set) Monuments

func (s Set) Monuments() []Monument

Monuments is a helper function to return a slice copy of Monument values.

func (Set) Mount

func (s Set) Mount(code string) (Mount, bool)

Mount is a helper function to return a Mount value and true if one exists.

func (Set) Mounts

func (s Set) Mounts() []Mount

Mounts is a helper function to return a slice copy of Mount values.

func (Set) Network

func (s Set) Network(code string) (Network, bool)

Network is a helper function to return a Network value and true if one exists.

func (Set) Networks

func (s Set) Networks() []Network

Networks is a helper function to return a slice copy of Network values.

func (Set) Placename

func (s Set) Placename(name string) (Placename, bool)

Placename is a helper function to return a Placename value and true if one exists.

func (Set) Placenames

func (s Set) Placenames() []Placename

Placenames is a helper function to return a slice copy of Placename values.

func (Set) Point

func (s Set) Point(sample, location string) (Point, bool)

Point is a helper function to return a Point value and true if one exists.

func (Set) Points

func (s Set) Points() []Point

Points is a helper function to return a slice copy of Point values.

func (Set) Polarities

func (s Set) Polarities() []Polarity

Polarities is a helper function to return a slice copy of Polarity values.

func (*Set) PolarityCorrections

func (s *Set) PolarityCorrections(coll Collection) []Correction

PolarityCorrections returns a slice of Correction values to account for any changes in Polarity.

func (*Set) PreampCorrections

func (s *Set) PreampCorrections(coll Collection) []Correction

PreampCorrections returns a slice of Correction values to account for any changes in Preamp settings.

func (Set) Preamps

func (s Set) Preamps() []Preamp

Preamps is a helper function to return a slice copy of Preamp values.

func (Set) Sample

func (s Set) Sample(code string) (Sample, bool)

Sample is a helper function to return a Sample value and true if one exists.

func (Set) Samples

func (s Set) Samples() []Sample

Samples is a helper function to return a slice copy of Sample values.

func (*Set) SensorCalibrationCorrections

func (s *Set) SensorCalibrationCorrections(coll Collection) []Correction

SensornCalibrationCorrections returns a slice of Correction values to account for any changes in Sensor Calibration.

func (Set) Sessions

func (s Set) Sessions() []Session

Sessions is a helper function to return a slice copy of Session values.

func (Set) Site

func (s Set) Site(station, location string) (Site, bool)

Site is a helper function to return a Site value and true if one exists.

func (Set) Sites

func (s Set) Sites() []Site

Sites is a helper function to return a slice copy of Site values.

func (Set) Station

func (s Set) Station(code string) (Station, bool)

Station is a helper function to return a Station value and true if one exists.

func (Set) Stations

func (s Set) Stations() []Station

Stations is a helper function to return a slice copy of Station values.

func (Set) Streams

func (s Set) Streams() []Stream

Streams is a helper function to return a slice copy of Stream values.

func (Set) Telemetries

func (s Set) Telemetries() []Telemetry

Telemetries is a helper function to return a slice copy of Telemetry values.

func (*Set) TelemetryCorrections

func (s *Set) TelemetryCorrections(coll Collection) []Correction

TelemetryCorrections returns a slice of Correction values to account for any changes in Preamp settings.

func (*Set) TimingCorrections

func (s *Set) TimingCorrections(coll Collection) []Correction

TimingCorrections returns a slice of Correction values to account for any changes in Timing.

func (Set) Timings

func (s Set) Timings() []Timing

Timings is a helper function to return a slice copy of Timing values.

func (Set) View

func (s Set) View(mount, code string) (View, bool)

View is a helper function to return a View value and true if one exists.

func (Set) Views

func (s Set) Views() []View

Views is a helper function to return a slice copy of View values.

func (Set) Visibilities

func (s Set) Visibilities() []Visibility

Visibilities is a helper function to return a slice copy of Visibility values.

type SetPathMap

type SetPathMap func(s string) string

SetPathMap is used to manipulate the filepath inside the Set.

type Site

type Site struct {
	Position
	Span

	Station  string
	Location string
	Survey   string
}

func LoadSites

func LoadSites(path string) ([]Site, error)

func (Site) Less

func (s Site) Less(site Site) bool

type SiteList

type SiteList []Site

func (SiteList) Len

func (s SiteList) Len() int

func (SiteList) Less

func (s SiteList) Less(i, j int) bool

func (SiteList) Swap

func (s SiteList) Swap(i, j int)

type Span

type Span struct {
	// Start represents the beginning of the time window.
	Start time.Time
	// End represents the stop time of the window.
	End time.Time
}

Span represents a time window.

func (Span) Extent

func (s Span) Extent(spans ...Span) (Span, bool)

Extent returns the Span that is the sum of the given overlapping Span values, the extra boolean return value will be false if no window could be found. It is assumed that the end must be greater than the start of the resultant Span.

func (Span) Overlaps

func (s Span) Overlaps(span Span) bool

Overlaps returns whether the time range of the Span overlaps the given Span. It is assumed that the End time for a span can overlap with the start of another Span if they exactly match.

type Station

type Station struct {
	Reference
	Position
	Span
}

func LoadStations

func LoadStations(path string) ([]Station, error)

type StationList

type StationList []Station

func (StationList) Len

func (s StationList) Len() int

func (StationList) Less

func (s StationList) Less(i, j int) bool

func (StationList) Swap

func (s StationList) Swap(i, j int)

type Stream

type Stream struct {
	Span

	Station      string
	Location     string
	Band         string
	Source       string
	SamplingRate float64
	Axial        string
	Reversed     bool
	Triggered    bool
	// contains filtered or unexported fields
}

func LoadStreams

func LoadStreams(path string) ([]Stream, error)

func (Stream) Less

func (s Stream) Less(stream Stream) bool

type StreamList

type StreamList []Stream

func (StreamList) Len

func (s StreamList) Len() int

func (StreamList) Less

func (s StreamList) Less(i, j int) bool

func (StreamList) Swap

func (s StreamList) Swap(i, j int)

type Telemetry

type Telemetry struct {
	Span

	Station     string
	Location    string
	ScaleFactor float64
	// contains filtered or unexported fields
}

Telemetry describes when a datalogger is connected to a sensor via analogue telemetry (e.g. FM radio).

func LoadTelemetries

func LoadTelemetries(path string) ([]Telemetry, error)

func (Telemetry) Id

func (t Telemetry) Id() string

Id returns a unique string which can be used for sorting or checking.

func (Telemetry) Less

func (t Telemetry) Less(telemetry Telemetry) bool

Less returns whether one Telemetry sorts before another.

func (Telemetry) String

func (t Telemetry) String() string

String implements the Stringer interface.

type TelemetryList

type TelemetryList []Telemetry

func (TelemetryList) Len

func (t TelemetryList) Len() int

func (TelemetryList) Less

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

func (TelemetryList) Swap

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

type Timing

type Timing struct {
	Span

	Station    string
	Location   string
	Correction time.Duration
	// contains filtered or unexported fields
}

func LoadTimings

func LoadTimings(path string) ([]Timing, error)

func (Timing) Less

func (t Timing) Less(timing Timing) bool

type TimingList

type TimingList []Timing

func (TimingList) Len

func (t TimingList) Len() int

func (TimingList) Less

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

func (TimingList) Swap

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

type View

type View struct {
	Orientation
	Span

	Mount       string
	Code        string
	Label       string
	Description string
}

func LoadViews

func LoadViews(path string) ([]View, error)

type ViewList

type ViewList []View

func (ViewList) Len

func (v ViewList) Len() int

func (ViewList) Less

func (v ViewList) Less(i, j int) bool

func (ViewList) Swap

func (v ViewList) Swap(i, j int)

type Visibility

type Visibility struct {
	Span
	Code          string
	SkyVisibility string
}

func LoadVisibilities

func LoadVisibilities(path string) ([]Visibility, error)

type VisibilityList

type VisibilityList []Visibility

func (VisibilityList) Len

func (v VisibilityList) Len() int

func (VisibilityList) Less

func (v VisibilityList) Less(i, j int) bool

func (VisibilityList) Swap

func (v VisibilityList) Swap(i, j int)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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