met

package
v0.0.0-...-0f7942d Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Temperature = 1 << iota
	MaxDailyT
	MinDailyT
	Precipitation
	Rainfall
	Snowfall
	Snowdepth
	SnowpackSWE
	SnowMelt
	AtmosphericYield
	AtmosphericDemand
	Radiation
	RadiationSW
	RadiationLW
	CloudCover
	RH
	AtmosphericPressure
	Windspeed
	Windgust
	WindDirection
	HeatDegreeDays
	CoolDegreeDays
	Unspecified23
	HeadStage
	Flux
	UnitDischarge
	Unspecified27
	Unspecified28
	Unspecified29
	Unspecified30
	Storage
	SnowPackCover
	SnowPackLWC
	SnowPackAlbedo
	SnowSurfaceTemp
	Unspecified36
	Unspecified37
	DepressionWaterContent
	InterceptionWaterContent
	SoilSurfaceTemp
	SoilSurfaceRH
	SoilMoistureContent
	SoilMoisturePressure
	Unspecified44
	Unspecified45
	Unspecified46
	Unspecified47
	Evaporation
	Transpiration
	Evapotranspiration
	Infiltration
	Runoff
	Recharge
	TotalHead
	PressureHead
	SubSurfaceLateralFlux
	FluxLeft
	FluxRight
	FluxFront
	FluxBack
	FluxBottom
	FluxTop
	OutgoingRadiationLW
	Reserved
)

WaterBalanceDataType (bit-wise type code)

Variables

This section is empty.

Functions

func ReadBigMET

func ReadBigMET(fp string, print bool) (*Header, *Coll, error)

ReadBigMET reads a .met blob in chunks to be more memory-conservative

func ReadMET

func ReadMET(fp string, print bool) (*Header, *Coll, error)

ReadMET reads a .met blob

func WBcodeToMap

func WBcodeToMap(wbdc uint64) map[uint64]string

WBcodeToMap converts a wbdc into a list of metrics

Types

type Coll

type Coll struct {
	T []time.Time   // [date ID]
	D [][][]float64 // D [date ID][location ID][type ID] or [cell ID][date ID][type ID]
}

Coll holds met data

func (*Coll) Get

func (c *Coll) Get(loc, col int) ([]time.Time, []float64)

Get returns a column of values

func (*Coll) Print

func (c *Coll) Print(wbl []string)

Print prints the data in tabular form

type Header struct {
	Locations map[int][]interface{}

	WBCD uint64 // waterbalance data code

	ESPG uint32
	// contains filtered or unexported fields
}

Header contains metadata for the .met file

func NewHeader

func NewHeader(dtb, dte time.Time, intvl, nloc, prc int) Header

NewHeader returns a header

func ReadRaw

func ReadRaw(fp string, print bool) (*Header, map[time.Time]map[int]float64, error)

ReadRaw reads raw binary, returning a map

func (*Header) AddLocationIndex

func (h *Header) AddLocationIndex(iid int)

AddLocationIndex adds locations of code 1

func (*Header) BeginEndInterval

func (h *Header) BeginEndInterval() (time.Time, time.Time, int64)

BeginEndInterval returns the begining and end dates

func (*Header) Copy

func (h *Header) Copy() *Header

Copy creates a deep copy of a Header

func (*Header) HasWBDC

func (h *Header) HasWBDC(wbdc uint64) bool

HasWBDC checks whether a certain datatype is present

func (*Header) IntervalSec

func (h *Header) IntervalSec() float64

IntervalSec returns the time interval of the .met file

func (*Header) LocationCode

func (h *Header) LocationCode() int

LocationCode returns the location code of the .met file

func (*Header) Nloc

func (h *Header) Nloc() int

Nloc returns the number of locations in the .met file

func (*Header) Nstep

func (h *Header) Nstep() int

Nstep returns the number of timesteps in the .met file

func (*Header) Print

func (h *Header) Print()

Print .met metadata

func (*Header) SetWBDC

func (h *Header) SetWBDC(wbdc uint64)

SetWBDC changes the water budget data code

func (*Header) WBDCkeys

func (h *Header) WBDCkeys() ([]uint64, int)

WBDCkeys returns an ordered key index associated with the waterbalance codes

func (*Header) WBDCxr

func (h *Header) WBDCxr() map[string]int

WBDCxr return the zero-order array index of the waterbalance codes

func (*Header) WBlist

func (h *Header) WBlist() []string

WBlist return the slice the waterbalance codes

type Writer

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

Writer is a struct used to write .met files

func NewWriter

func NewWriter(filepath string, h *Header) (*Writer, error)

NewWriter creates a new writer struct

func (*Writer) Add

func (w *Writer) Add(data ...interface{}) error

Add adds data to file

func (*Writer) Close

func (w *Writer) Close()

Close met.Writer

Jump to

Keyboard shortcuts

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