adflib

package module
v0.0.0-...-6d2c025 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2025 License: GPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DAY_TIME_SEC     uint32 = C.ADF_DAY
	WEEK_TIME_SEC    uint32 = C.ADF_WEEK
	MONTH28_TIME_SEC uint32 = C.ADF_MONTH_28
	MONTH29_TIME_SEC uint32 = C.ADF_MONTH_29
	MONTH30_TIME_SEC uint32 = C.ADF_MONTH_30
	MONTH31_TIME_SEC uint32 = C.ADF_MONTH_31
)

Variables

This section is empty.

Functions

func Unmarshal

func Unmarshal(bytes []byte) (Adf, *AdfError)

Types

type Additive

type Additive struct {
	Code          uint32
	Concentration float32
}

func NewAdditive

func NewAdditive(code uint32, concentration float32) Additive

type AdditiveList

type AdditiveList struct {
	Adds []Additive
}

func NewAdditiveList

func NewAdditiveList(adds []Additive) AdditiveList

func (*AdditiveList) Size

func (al *AdditiveList) Size() int

type Adf

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

func NewAdf

func NewAdf(header Header, periodSec uint32) Adf

func (*Adf) AddSeries

func (adf *Adf) AddSeries(series Series) *AdfError

func (*Adf) Dispose

func (adf *Adf) Dispose()

func (*Adf) GetVersion

func (adf *Adf) GetVersion() string

func (*Adf) Marshal

func (adf *Adf) Marshal() ([]byte, *AdfError)

func (*Adf) RemoveSeries

func (adf *Adf) RemoveSeries() *AdfError

func (*Adf) SizeBytes

func (adf *Adf) SizeBytes() uint32

func (*Adf) UpdateSeries

func (adf *Adf) UpdateSeries(series Series, time uint64) *AdfError

type AdfError

type AdfError struct {
	Code uint16
	Err  error
}

func (*AdfError) Error

func (r *AdfError) Error() string

type ErrorCode

type ErrorCode uint16
const (
	OK                   ErrorCode = C.ADF_OK
	HEADER_CORRUPTED     ErrorCode = C.ADF_HEADER_CORRUPTED
	METADATA_CORRUPTED   ErrorCode = C.ADF_METADATA_CORRUPTED
	SERIES_CORRUPTED     ErrorCode = C.ADF_SERIES_CORRUPTED
	ZERO_REPEATED_SERIES ErrorCode = C.ADF_ZERO_REPEATED_SERIES
	EMPTY_SERIES         ErrorCode = C.ADF_EMPTY_SERIES
	TIME_OUT_OF_BOUND    ErrorCode = C.ADF_TIME_OUT_OF_BOUND
	ADDITIVE_OVERFLOW    ErrorCode = C.ADF_ADDITIVE_OVERFLOW
	NULL_HEADER_SOURCE   ErrorCode = C.ADF_NULL_HEADER_SOURCE
	NULL_HEADER_TARGET   ErrorCode = C.ADF_NULL_HEADER_TARGET
	NULL_META_SOURCE     ErrorCode = C.ADF_NULL_META_SOURCE
	NULL_META_TARGET     ErrorCode = C.ADF_NULL_META_TARGET
	NULL_SERIES_SOURCE   ErrorCode = C.ADF_NULL_SERIES_SOURCE
	NULL_SERIES_TARGET   ErrorCode = C.ADF_NULL_SERIES_TARGET
	NULL_SOURCE          ErrorCode = C.ADF_NULL_SOURCE
	NULL_TARGET          ErrorCode = C.ADF_NULL_TARGET
	NULL_ADDITIVE_SOURCE ErrorCode = C.ADF_NULL_ADDITIVE_SOURCE
	NULL_ADDITIVE_TARGET ErrorCode = C.ADF_NULL_ADDITIVE_TARGET
	RUNTIME_ERROR        ErrorCode = C.ADF_RUNTIME_ERROR
)
type Header struct {
	Version    uint16           `json:"version"`
	FarmingTec FarmingTechnique `json:"farmingTec"`
	WInfo      WaveInfo         `json:"waveInfo"`
	SInfo      SoilDepthInfo    `json:"soilInfo"`
	RedInfo    ReductionInfo    `json:"reductionInfo"`
	PrecInfo   PrecisionInfo    `json:"precisonInfo"`
	NChunks    uint32           `json:"nChunks"`
}

func NewHeader

func NewHeader(farmingTec FarmingTechnique, wInfo WaveInfo, sInfo SoilDepthInfo,
	redInfo ReductionInfo, precInfo PrecisionInfo, nChunks uint32) Header

type Matrix

type Matrix[T any] struct {
	// contains filtered or unexported fields
}

func NewEmptyMatrix

func NewEmptyMatrix[T any](rows uint32, columns uint32) (Matrix[T], error)

func NewMatrix

func NewMatrix[T any](columns uint32) (Matrix[T], error)

func (*Matrix[T]) AddRow

func (m *Matrix[T]) AddRow(row []T)

func (*Matrix[T]) At

func (m *Matrix[T]) At(row uint32, column uint32) T

func (*Matrix[T]) Shape

func (m *Matrix[T]) Shape(row uint32, column uint32) (uint32, uint32)

type PrecisionInfo

type PrecisionInfo struct {
	SoilDensity   float32 `json:"soilDensity"`
	Pressure      float32 `json:"pressure"`
	LightExposure float32 `json:"lightExposure"`
	WaterUse      float32 `json:"waterUse"`
	SoilTemp      float32 `json:"soilTemp"`
	EnvTemp       float32 `json:"environmentTemp"`
	AdditiveConc  float32 `json:"additiveConcentration"`
}

func NewDefaultPrecisionInfo

func NewDefaultPrecisionInfo() PrecisionInfo

func NewPrecisionInfo

func NewPrecisionInfo(soilDensity float32, pressure float32, lightExposure float32,
	waterUse float32, soilTemp float32, envTemp float32, additiveConc float32) PrecisionInfo

type ReductionCode

type ReductionCode int8
const (
	NONE           ReductionCode = C.ADF_RM_NONE
	AVERAGE        ReductionCode = C.ADF_RM_AVG
	MOVING_AVERAGE ReductionCode = C.ADF_RM_MAVG
)

type ReductionInfo

type ReductionInfo struct {
	SoilDensity   ReductionCode `json:"soilDensity"`
	Pressure      ReductionCode `json:"pressure"`
	LightExposure ReductionCode `json:"lightExposure"`
	WaterUse      ReductionCode `json:"waterUse"`
	SoilTemp      ReductionCode `json:"soilTemp"`
	EnvTemp       ReductionCode `json:"envTemp"`
	AdditiveConc  ReductionCode `json:"additive"`
}

func NewDefaultReductionInfo

func NewDefaultReductionInfo() ReductionInfo

func NewReductionInfo

func NewReductionInfo(soilDensity ReductionCode, pressure ReductionCode,
	lightExposure ReductionCode, waterUse ReductionCode, soilTemp ReductionCode,
	envTemp ReductionCode, additiveConc ReductionCode) ReductionInfo

type Series

type Series struct {
	LightExposure   Matrix[float32] `json:"lightExposure"`
	SoilTempC       Matrix[float32] `json:"soilTempC"`
	EnvTempC        []float32       `json:"envTempC"`
	WaterUseMl      []float32       `json:"waterUseMl"`
	PH              uint8           `json:"pH"`
	PBar            float32         `json:"pBar"`
	SoilDensityKgM3 float32         `json:"soilDensityKgM3"`
	SoilAdditives   AdditiveList    `json:"soilAdditives"`
	AtmAdditives    AdditiveList    `json:"atmAdditives"`
	Repeated        uint32          `json:"repeated"`
}

func NewSeries

func NewSeries(lightExposure Matrix[float32], soilTempC Matrix[float32],
	envTempC []float32, waterUseMl []float32, pH uint8, pBar float32,
	soilDensityKgM3 float32, soilAdditives AdditiveList, atmAdditives AdditiveList,
	repeated uint32) Series

func (*Series) DisposeSeries

func (s *Series) DisposeSeries()

type SoilDepthInfo

type SoilDepthInfo struct {
	TransY         uint16 `json:"translationY"`
	MaxSoilDepthMm uint16 `json:"maxSoilDepthMm"`
	NDepth         uint16 `json:"nDepth"`
}

func NewSoilDepthInfo

func NewSoilDepthInfo(transY uint16, maxSoilDepthMm uint16, nDepth uint16) SoilDepthInfo

type WaveInfo

type WaveInfo struct {
	MinWavelenNm uint16 `json:"minWavelenNm"`
	MaxWavelenNm uint16 `json:"maxWavelenNm"`
	NWavelengths uint16 `json:"nWavelengths"`
}

func NewWaveInfo

func NewWaveInfo(minWavelenNm uint16, maxWavelenNm uint16, nWavelengths uint16) WaveInfo

Jump to

Keyboard shortcuts

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