data

package
v0.0.0-...-62531ef Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2022 License: GPL-3.0 Imports: 11 Imported by: 4

Documentation

Index

Constants

View Source
const DateFmt date.ParseFmt = "2016 12 05"

Variables

View Source
var DateParse = date.Format("2016 12 05").Ref(date.DefaultFormatParser)
View Source
var DefaultKeys = ParamKeys{
	Range:   "range_samples",
	Azimuth: "azimuth_lines",
	Type:    "image_format",
	Date:    "date",
}

Functions

func WrongType

func WrongType(dtype Kind, data string) error

Types

type Complex

type Complex struct {
	File
}

func LoadComplex

func LoadComplex(l Loader, p PathWithPar) (c Complex, err error)

func (Complex) Validate

func (c Complex) Validate() (err error)

type CreatedBy

type CreatedBy struct {
	Mode CreationMode `json:"mode"`
	Cmd  string       `json:"command"`
}

func CreationUnknown

func CreationUnknown() (c CreatedBy)

func (CreatedBy) Command

func (c CreatedBy) Command() (cmd string, b bool)

func (CreatedBy) Decsribe

func (c CreatedBy) Decsribe() (s string, err error)

func (CreatedBy) DescribeTo

func (c CreatedBy) DescribeTo(w io.Writer) (n int, err error)

func (*CreatedBy) MarshalJSON

func (c *CreatedBy) MarshalJSON() (b []byte, err error)

func (*CreatedBy) UnmarshalJSON

func (c *CreatedBy) UnmarshalJSON(b []byte) (err error)

type CreationMode

type CreationMode int
const (
	CreationNone CreationMode = iota
	CreationCommand
)

func (CreationMode) Some

func (c CreationMode) Some() (b bool)

type DimMismatchError

type DimMismatchError struct {
	One, Two RngAzi
}

func (DimMismatchError) Error

func (d DimMismatchError) Error() (s string)

type File

type File struct {
	DataFile Path `json:"data_path"`
	Meta     Meta `json:"meta"`
}

func LoadAndValidate

func LoadAndValidate(l Loader, p PathWithPar, pk ParamKeys, v MetaValidator) (f File, err error)

func LoadDefault

func LoadDefault(l Loader, p PathWithPar, v MetaValidator) (f File, err error)

func (File) AsFile

func (f File) AsFile() (F File)

func (File) Azi

func (f File) Azi() (azi uint64)

func (File) MustSameDim

func (f File) MustSameDim(other File) (err error)

func (File) Rng

func (f File) Rng() (rng uint64)

func (File) SameDim

func (f File) SameDim(other File) (b bool)

type FileWithPar

type FileWithPar struct {
	Parameter `json:"parameter"`
	File      `json:"file"`
}

type GetterMaker

type GetterMaker interface {
	MakeGetter() parser.MutGetter
	PutGetter(parser.MutGetter)
}

type GetterPool

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

func NewGetterPool

func NewGetterPool() (gp *GetterPool)

func (*GetterPool) MakeGetter

func (m *GetterPool) MakeGetter() (mg parser.MutGetter)

func (*GetterPool) PutGetter

func (m *GetterPool) PutGetter(mg parser.MutGetter)

type IntMeta

type IntMeta struct {
	Size bit.Size
	Base bit.Base
}

func (IntMeta) IntVar

func (im IntMeta) IntVar(p parser.Parser) (pi parsableInt)

func (IntMeta) ParseInt

func (im IntMeta) ParseInt(s string, p parser.Parser, ii *int64) (err error)

func (IntMeta) ParseUint

func (im IntMeta) ParseUint(s string, p parser.Parser, ui *uint64) (err error)

func (IntMeta) UintVar

func (im IntMeta) UintVar(p parser.Parser) (pu parsableUint)

type Kind

type Kind int
const (
	KindFloat Kind = iota
	KindDouble
	KindShortCpx
	KindFloatCpx
	KindRaster
	KindUChar
	KindShort
	KindUnknown
	KindAny
)

func (*Kind) Set

func (t *Kind) Set(s string) error

func (*Kind) SetCli

func (k *Kind) SetCli(c *cli.Cli)

func (Kind) String

func (k Kind) String() string

func (Kind) WrongType

func (k Kind) WrongType(purpose string) error

type Like

type Like interface {
	AsFile() File
}

type Loader

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

func DefaultLoader

func DefaultLoader() (l Loader)

func (Loader) LoadFile

func (l Loader) LoadFile(p PathWithPar, mp MetaParser) (f File, err error)

func (Loader) MetaFromFile

func (l Loader) MetaFromFile(path string, mp MetaParser) (m Meta, err error)

func (Loader) OpenParamGetter

func (l Loader) OpenParamGetter(path string, fn UseParamFunc) (err error)

func (Loader) ParseMeta

func (l Loader) ParseMeta(r io.Reader, mp MetaParser) (m Meta, err error)

func (Loader) WithParamGetter

func (l Loader) WithParamGetter(r io.Reader, fn UseParamFunc) (err error)

type Meta

type Meta struct {
	DataType  Kind      `json:"data_type"`
	RngAzi    RngAzi    `json:"range_azimuth"`
	Date      date.Date `json:"date"`
	CreatedBy CreatedBy `json:"created_by"`
}

func (Meta) IsComplex

func (m Meta) IsComplex() (b bool)

func (Meta) IsReal

func (m Meta) IsReal() (b bool)

func (Meta) IsType

func (m Meta) IsType(dtypes ...Kind) (b bool)

func (Meta) MustBeComplex

func (m Meta) MustBeComplex() (err error)

func (Meta) MustBeOfType

func (m Meta) MustBeOfType(dtypes ...Kind) (err error)

func (Meta) MustBeReal

func (m Meta) MustBeReal() (err error)

type MetaParser

type MetaParser interface {
	ParseMeta(parser.Getter, parser.Parser) (Meta, error)
}

type MetaValidator

type MetaValidator interface {
	ValidateMeta(Meta) error
}

type ParamKeys

type ParamKeys struct {
	Range   string `json:"range"`
	Azimuth string `json:"azimuth"`
	Type    string `json:"type"`
	Date    string `json:"date"`
}

ParamKeys holds the keys for different fields for Meta.

func (ParamKeys) ParseMeta

func (pk ParamKeys) ParseMeta(g parser.Getter, p parser.Parser) (m Meta, err error)

type Parameter

type Parameter struct {
	ParFile path.ValidFile `json:"parfile"`
}

func (*Parameter) SetParFile

func (p *Parameter) SetParFile(vf path.ValidFile)

type ParseAndValidate

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

func (ParseAndValidate) ParseMeta

func (pv ParseAndValidate) ParseMeta(g parser.Getter, p parser.Parser) (m Meta, err error)

type ParserWithGetter

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

func WithGetter

func WithGetter(p parser.Parser, g parser.Getter) (pg ParserWithGetter)

func (ParserWithGetter) ParseFloat

func (p ParserWithGetter) ParseFloat(key string, size bit.Size) (fl float64, err error)

func (ParserWithGetter) ParseInt

func (p ParserWithGetter) ParseInt(key string, base bit.Base, size bit.Size) (ii int64, err error)

func (ParserWithGetter) ParseUint

func (p ParserWithGetter) ParseUint(key string, base bit.Base, size bit.Size) (ui uint64, err error)

func (ParserWithGetter) ParseVar

func (p ParserWithGetter) ParseVar(key string, v Var) (err error)

type Path

type Path struct {
	DataFile string
}

func New

func New(file string) (p Path)

func (Path) MarshalJSON

func (p Path) MarshalJSON() (b []byte, err error)

func (*Path) UnmarshalJSON

func (p *Path) UnmarshalJSON(b []byte) (err error)

func (Path) WithParFile

func (p Path) WithParFile(file string) (pp PathWithPar)

type PathWithPar

type PathWithPar struct {
	Path    Path
	ParFile string
}

func (PathWithPar) WithPar

func (p PathWithPar) WithPar(file string) (pp PathWithPar)

type Real

type Real struct {
	File
}

func LoadReal

func LoadReal(l Loader, p PathWithPar) (r Real, err error)

func (Real) Validate

func (r Real) Validate() (err error)

type RngAzi

type RngAzi struct {
	Rng uint64 `json:"range"`
	Azi uint64 `json:"azimuth"`
}

func (RngAzi) MustSameCols

func (r RngAzi) MustSameCols(other RngAzi) (err error)

func (RngAzi) MustSameRows

func (r RngAzi) MustSameRows(other RngAzi) (err error)

func (RngAzi) MustSameShape

func (r RngAzi) MustSameShape(other RngAzi) (err error)

func (RngAzi) SameCols

func (r RngAzi) SameCols(other RngAzi) (b bool)

func (RngAzi) SameRows

func (r RngAzi) SameRows(other RngAzi) (b bool)

func (RngAzi) SameShape

func (r RngAzi) SameShape(other RngAzi) (b bool)

type ShapeMismatchError

type ShapeMismatchError struct {
	Along    string
	One, Two uint64
}

func (ShapeMismatchError) Error

func (s ShapeMismatchError) Error() string

type TypeEnsurer

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

func NewTypeEnsurer

func NewTypeEnsurer(dtypes ...Kind) (t TypeEnsurer)

func (TypeEnsurer) ValidateMeta

func (t TypeEnsurer) ValidateMeta(m Meta) (err error)

type TypeMismatchError

type TypeMismatchError struct {
	Expected string
	Got      Kind
	// contains filtered or unexported fields
}

func (TypeMismatchError) Error

func (e TypeMismatchError) Error() string

func (TypeMismatchError) Unwrap

func (e TypeMismatchError) Unwrap() error

type UnknownTypeError

type UnknownTypeError struct {
	Kind
	Err error
}

func (UnknownTypeError) Error

func (e UnknownTypeError) Error() string

func (UnknownTypeError) Unwrap

func (e UnknownTypeError) Unwrap() error

type UseParamFunc

type UseParamFunc func(parser.Getter) error

type Var

type Var interface {
	Set(string) error
}

type WrongTypeError

type WrongTypeError struct {
	Kind
	// contains filtered or unexported fields
}

func (WrongTypeError) Error

func (e WrongTypeError) Error() string

func (WrongTypeError) Unwrap

func (e WrongTypeError) Unwrap() error

Jump to

Keyboard shortcuts

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