hazards

package
v0.0.0-...-cd09ded Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: MIT Imports: 5 Imported by: 5

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArrivalDepthandDurationEvent

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

ArrivalandDurationEvent describes an event with an arrival time, depth and a duration in days

func (ArrivalDepthandDurationEvent) ArrivalTime

func (h ArrivalDepthandDurationEvent) ArrivalTime() time.Time

func (ArrivalDepthandDurationEvent) DV

func (ArrivalDepthandDurationEvent) Depth

func (ArrivalDepthandDurationEvent) Duration

func (ArrivalDepthandDurationEvent) Erosion

func (ArrivalDepthandDurationEvent) Has

Has implements the HazardEvent Interface

func (ArrivalDepthandDurationEvent) MarshalJSON

func (d ArrivalDepthandDurationEvent) MarshalJSON() ([]byte, error)

func (ArrivalDepthandDurationEvent) Parameters

func (ad ArrivalDepthandDurationEvent) Parameters() Parameter

Parameters implements the HazardEvent interface

func (ArrivalDepthandDurationEvent) Qualitative

func (h ArrivalDepthandDurationEvent) Qualitative() string

func (ArrivalDepthandDurationEvent) Salinity

func (h ArrivalDepthandDurationEvent) Salinity() bool

func (*ArrivalDepthandDurationEvent) SetArrivalTime

func (h *ArrivalDepthandDurationEvent) SetArrivalTime(t time.Time)

func (*ArrivalDepthandDurationEvent) SetDepth

func (h *ArrivalDepthandDurationEvent) SetDepth(d float64)

func (*ArrivalDepthandDurationEvent) SetDuration

func (h *ArrivalDepthandDurationEvent) SetDuration(d float64)

func (ArrivalDepthandDurationEvent) Velocity

func (ArrivalDepthandDurationEvent) WaveHeight

func (h ArrivalDepthandDurationEvent) WaveHeight() float64

type ArrivalandDurationEvent

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

ArrivalandDurationEvent describes an event with an arrival time and a duration in days

func (ArrivalandDurationEvent) ArrivalTime

func (h ArrivalandDurationEvent) ArrivalTime() time.Time

func (ArrivalandDurationEvent) DV

func (ArrivalandDurationEvent) Depth

func (h ArrivalandDurationEvent) Depth() float64

func (ArrivalandDurationEvent) Duration

func (h ArrivalandDurationEvent) Duration() float64

func (ArrivalandDurationEvent) Erosion

func (h ArrivalandDurationEvent) Erosion() float64

func (ArrivalandDurationEvent) Has

Has implements the HazardEvent Interface

func (ArrivalandDurationEvent) MarshalJSON

func (d ArrivalandDurationEvent) MarshalJSON() ([]byte, error)

func (ArrivalandDurationEvent) Parameters

func (ad ArrivalandDurationEvent) Parameters() Parameter

Parameters implements the HazardEvent interface

func (ArrivalandDurationEvent) Qualitative

func (h ArrivalandDurationEvent) Qualitative() string

func (ArrivalandDurationEvent) Salinity

func (h ArrivalandDurationEvent) Salinity() bool

func (*ArrivalandDurationEvent) SetArrivalTime

func (h *ArrivalandDurationEvent) SetArrivalTime(t time.Time)

func (*ArrivalandDurationEvent) SetDuration

func (h *ArrivalandDurationEvent) SetDuration(d float64)

func (ArrivalandDurationEvent) Velocity

func (h ArrivalandDurationEvent) Velocity() float64

func (ArrivalandDurationEvent) WaveHeight

func (h ArrivalandDurationEvent) WaveHeight() float64

type CoastalEvent

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

CoastalEvent describes a coastal event

func NewCoastalEvent

func NewCoastalEvent(c CoastalEvent) *CoastalEvent

func (CoastalEvent) ArrivalTime

func (h CoastalEvent) ArrivalTime() time.Time

func (CoastalEvent) DV

func (h CoastalEvent) DV() float64

func (CoastalEvent) Depth

func (h CoastalEvent) Depth() float64

func (CoastalEvent) Duration

func (h CoastalEvent) Duration() float64

func (CoastalEvent) Erosion

func (h CoastalEvent) Erosion() float64

func (CoastalEvent) Has

func (ad CoastalEvent) Has(p Parameter) bool

Has implements the HazardEvent Interface

func (CoastalEvent) MarshalJSON

func (d CoastalEvent) MarshalJSON() ([]byte, error)

func (CoastalEvent) Parameters

func (ad CoastalEvent) Parameters() Parameter

Parameters implements the HazardEvent interface

func (CoastalEvent) Qualitative

func (h CoastalEvent) Qualitative() string

func (CoastalEvent) Salinity

func (h CoastalEvent) Salinity() bool

func (*CoastalEvent) SetDepth

func (h *CoastalEvent) SetDepth(d float64)

func (*CoastalEvent) SetErosion

func (h *CoastalEvent) SetErosion(e float64)

func (*CoastalEvent) SetSalinity

func (h *CoastalEvent) SetSalinity(d bool)

func (*CoastalEvent) SetWaveHeight

func (h *CoastalEvent) SetWaveHeight(d float64)

func (CoastalEvent) Velocity

func (h CoastalEvent) Velocity() float64

func (CoastalEvent) WaveHeight

func (h CoastalEvent) WaveHeight() float64

type DepthEvent

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

DepthEvent describes a Hazard with Depth Only

Example
package main

import (
	"fmt"

	"github.com/USACE/go-consequences/hazards"
)

func main() {
	d := hazards.DepthEvent{}
	d.SetDepth(2.5)
	fmt.Println(d.Has(hazards.Depth))
	fmt.Println(d.Has(hazards.Velocity))
	fmt.Println(d.Depth())
}
Output:

true
false
2.5

func (DepthEvent) ArrivalTime

func (h DepthEvent) ArrivalTime() time.Time

func (DepthEvent) DV

func (h DepthEvent) DV() float64

func (DepthEvent) Depth

func (h DepthEvent) Depth() float64

func (DepthEvent) Duration

func (h DepthEvent) Duration() float64

func (DepthEvent) Erosion

func (h DepthEvent) Erosion() float64

func (DepthEvent) Has

func (h DepthEvent) Has(p Parameter) bool

Has implements the HazardEvent Interface

func (DepthEvent) MarshalJSON

func (d DepthEvent) MarshalJSON() ([]byte, error)

func (DepthEvent) Parameters

func (h DepthEvent) Parameters() Parameter

Parameters implements the HazardEvent interface

func (DepthEvent) Qualitative

func (h DepthEvent) Qualitative() string

func (DepthEvent) Salinity

func (h DepthEvent) Salinity() bool

func (*DepthEvent) SetDepth

func (h *DepthEvent) SetDepth(d float64)

func (DepthEvent) Velocity

func (h DepthEvent) Velocity() float64

func (DepthEvent) WaveHeight

func (h DepthEvent) WaveHeight() float64

type DepthandDVEvent

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

DepthandDVEvent describes an event with an arrival time and a duration in days

func (DepthandDVEvent) ArrivalTime

func (h DepthandDVEvent) ArrivalTime() time.Time

func (DepthandDVEvent) DV

func (h DepthandDVEvent) DV() float64

func (DepthandDVEvent) Depth

func (h DepthandDVEvent) Depth() float64

func (DepthandDVEvent) Duration

func (h DepthandDVEvent) Duration() float64

func (DepthandDVEvent) Erosion

func (h DepthandDVEvent) Erosion() float64

func (DepthandDVEvent) Has

func (ad DepthandDVEvent) Has(p Parameter) bool

Has implements the HazardEvent Interface

func (DepthandDVEvent) MarshalJSON

func (d DepthandDVEvent) MarshalJSON() ([]byte, error)

func (DepthandDVEvent) Parameters

func (ad DepthandDVEvent) Parameters() Parameter

Parameters implements the HazardEvent interface

func (DepthandDVEvent) Qualitative

func (h DepthandDVEvent) Qualitative() string

func (DepthandDVEvent) Salinity

func (h DepthandDVEvent) Salinity() bool

func (*DepthandDVEvent) SetDV

func (h *DepthandDVEvent) SetDV(value float64)

func (*DepthandDVEvent) SetDepth

func (h *DepthandDVEvent) SetDepth(value float64)

func (DepthandDVEvent) Velocity

func (h DepthandDVEvent) Velocity() float64

func (DepthandDVEvent) WaveHeight

func (h DepthandDVEvent) WaveHeight() float64

type HazardData

type HazardData struct {
	Depth       float64
	Velocity    float64
	ArrivalTime time.Time
	Erosion     float64
	Duration    float64
	WaveHeight  float64
	Salinity    bool
	Qualitative string
	DV          float64
}

type HazardEvent

type HazardEvent interface {
	//parameters?
	Depth() float64
	Velocity() float64
	ArrivalTime() time.Time
	Erosion() float64
	Duration() float64
	WaveHeight() float64
	Salinity() bool
	Qualitative() string
	DV() float64
	//values?
	//hazardType?
	Parameters() Parameter
	Has(p Parameter) bool
}

HazardEvent is an interface I am trying to make to describe all Hazard Events

type Parameter

type Parameter uint //switch to uint64 if we hit 32 slots and need another.

Parameter is a bitflag enum

const (
	Default          Parameter = 0    //0
	Depth            Parameter = 1    //1
	Velocity         Parameter = 2    //2
	ArrivalTime      Parameter = 4    //3
	ArrivalTime2ft   Parameter = 8    //4
	Erosion          Parameter = 16   //5
	Duration         Parameter = 32   //6
	WaveHeight       Parameter = 64   //7
	MediumWaveHeight Parameter = 128  //8
	HighWaveHeight   Parameter = 256  //9
	Salinity         Parameter = 512  //10
	Qualitative      Parameter = 1024 //11
	DV               Parameter = 2048 //12
)

Parameter types describe different parameters for hazards

func SetHasArrivalTime

func SetHasArrivalTime(h Parameter) Parameter

SetHasArrivalTime turns on a bitflag for the Parameter Arrival Time

func SetHasDV

func SetHasDV(h Parameter) Parameter

func SetHasDepth

func SetHasDepth(h Parameter) Parameter

SetHasDepth turns on a bitflag for the Parameter Depth

func SetHasDuration

func SetHasDuration(h Parameter) Parameter

SetHasDuration turns on a bitflag for the Parameter Duration

func SetHasErosion

func SetHasErosion(h Parameter) Parameter

SetHasErosion turns on a bitflag for the Parameter Erosion

func SetHasHighWaveHeight

func SetHasHighWaveHeight(h Parameter) Parameter

func SetHasMediumWaveHeight

func SetHasMediumWaveHeight(h Parameter) Parameter

func SetHasQualitative

func SetHasQualitative(h Parameter) Parameter

SetHasSalinity turns on a bitflag for the Parameter Salinity

func SetHasSalinity

func SetHasSalinity(h Parameter) Parameter

SetHasSalinity turns on a bitflag for the Parameter Salinity

func SetHasVelocity

func SetHasVelocity(h Parameter) Parameter

SetHasVelocity turns on a bitflag for the Parameter Velocity

func SetHasWaveHeight

func SetHasWaveHeight(h Parameter) Parameter

SetHasWaveHeight turns on a bitflag for the Parameter WaveHeight

func (Parameter) MarshalJSON

func (p Parameter) MarshalJSON() ([]byte, error)

MarshalJSON marshals the enum as a quoted json string

func (Parameter) String

func (p Parameter) String() string

func (*Parameter) UnmarshalJSON

func (p *Parameter) UnmarshalJSON(b []byte) error

UnmarshalJSON unmashals a quoted, comma separated string to the parameter value

type QualitativeEvent

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

ArrivalandDurationEvent describes an event with an arrival time, depth and a duration in days

func (QualitativeEvent) ArrivalTime

func (h QualitativeEvent) ArrivalTime() time.Time

func (QualitativeEvent) DV

func (h QualitativeEvent) DV() float64

func (QualitativeEvent) Depth

func (h QualitativeEvent) Depth() float64

func (QualitativeEvent) Duration

func (h QualitativeEvent) Duration() float64

func (QualitativeEvent) Erosion

func (h QualitativeEvent) Erosion() float64

func (QualitativeEvent) Has

func (q QualitativeEvent) Has(p Parameter) bool

Has implements the HazardEvent Interface

func (QualitativeEvent) MarshalJSON

func (d QualitativeEvent) MarshalJSON() ([]byte, error)

func (QualitativeEvent) Parameters

func (q QualitativeEvent) Parameters() Parameter

Parameters implements the HazardEvent interface

func (QualitativeEvent) Qualitative

func (h QualitativeEvent) Qualitative() string

func (QualitativeEvent) Salinity

func (h QualitativeEvent) Salinity() bool

func (*QualitativeEvent) SetQualitative

func (h *QualitativeEvent) SetQualitative(message string)

func (QualitativeEvent) Velocity

func (h QualitativeEvent) Velocity() float64

func (QualitativeEvent) WaveHeight

func (h QualitativeEvent) WaveHeight() float64

Jump to

Keyboard shortcuts

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