cdf

package
v0.0.0-...-5849c1f Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2023 License: MIT Imports: 13 Imported by: 1

Documentation

Overview

Package cdf supports v1 (classic), v2 (64-bit offset) and v5 file formats.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotCDF                = errors.New("not a CDF file")
	ErrUnsupportedVersion    = errors.New("unsupported CDF version")
	ErrUnknownVersion        = errors.New("unknown CDF version")
	ErrUnknownType           = errors.New("unknown type")
	ErrCorruptedFile         = errors.New("corrupted file")
	ErrNotFound              = errors.New("not found")
	ErrNoStreamingDimensions = errors.New("streaming dimensions not supported")
	ErrInternal              = errors.New("internal error")
	ErrDuplicateVariable     = errors.New("duplicate variable")
	ErrTooManyDimensions     = errors.New("too many dimensions")
	ErrFillValue             = errors.New("fill value not a scalar")
)
View Source
var (
	ErrUnlimitedMustBeFirst = errors.New("unlimited dimension must be first")
	ErrDimensionSize        = errors.New("dimension doesn't match size")
	ErrInvalidName          = errors.New("invalid name")
	ErrAttribute            = errors.New("invalid attribute")
	ErrEmptySlice           = errors.New("empty slice encountered")
)

Functions

func New

func New(file api.ReadSeekerCloser) (ag api.Group, err error)

New is the implementation of the API netcdf.New. Using netcdf.New is preferred over using this directly.

func Open

func Open(fname string) (api.Group, error)

Open is the implementation of the API netcdf.Open. Using netcdf.Open is preferred over using this directly.

func SetLogLevel

func SetLogLevel(level int) int

SetLogLevel sets the logging level to the given level, and returns the old level. This is for internal debugging use. The log messages are not expected to make much sense to anyone but the developers. The lowest level is 0 (no error logs at all) and the highest level is 3 (errors, warnings and debug messages).

Types

type CDF

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

func (*CDF) Attributes

func (cdf *CDF) Attributes() api.AttributeMap

Attributes returns the global attributes for this group.

func (*CDF) Close

func (cdf *CDF) Close()

Close closes this group and closes any underlying files if they are no longer being used by any other groups.

func (*CDF) GetDimension

func (cdf *CDF) GetDimension(name string) (uint64, bool)

GetDimension returns the value of the named dimension.

func (*CDF) GetGoType

func (cdf *CDF) GetGoType(name string) (string, bool)

GetGoType always returns false. There are no user-defined types in CDF

func (*CDF) GetGroup

func (cdf *CDF) GetGroup(group string) (g api.Group, err error)

GetGroup gets the given group or returns an error if not found. The group can start with "/" for absolute names, or relative.

func (*CDF) GetType

func (cdf *CDF) GetType(name string) (string, bool)

GetType always returns false. There are no user-defined types in CDF

func (*CDF) GetVarGetter

func (cdf *CDF) GetVarGetter(name string) (slicer api.VarGetter, err error)

GetVarGetter is an function that returns an interface that allows you to get smaller slices of a variable, in case the variable is very large and you want to reduce memory usage.

func (*CDF) GetVariable

func (cdf *CDF) GetVariable(name string) (v *api.Variable, err error)

GetVariable returns the named variable or sets the error if not found.

func (*CDF) ListDimensions

func (cdf *CDF) ListDimensions() []string

ListDimensions lists the names of the dimensions.

func (*CDF) ListSubgroups

func (cdf *CDF) ListSubgroups() []string

ListSubgroups returns the names of the subgroups of this group

func (*CDF) ListTypes

func (cdf *CDF) ListTypes() []string

ListTypes just returns an empty list because there are no user-defined types in CDF

func (*CDF) ListVariables

func (cdf *CDF) ListVariables() []string

ListVariables lists the variables in this group.

type CDFWriter

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

func OpenWriter

func OpenWriter(fileName string) (*CDFWriter, error)

OpenWriter creates the file and make it available for writing using AddVar and AddGlobalAttrs. The file must be closed to actually write it out.

func (*CDFWriter) AddGlobalAttrs

func (cw *CDFWriter) AddGlobalAttrs(attrs api.AttributeMap) error

AddGlobalAttrs adds global attributes to be written out. Use util.NewOrderedMap to create attribute maps.

func (*CDFWriter) AddVar

func (cw *CDFWriter) AddVar(name string, vr api.Variable) (err error)

AddVar adds a variable to be written out. Use util.NewOrderedMap to create attribute maps for the variable.

func (*CDFWriter) Close

func (cw *CDFWriter) Close() (err error)

Close writes all the data out and closes the file.

Jump to

Keyboard shortcuts

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