csvf

package
v0.0.0-...-a46f264 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package csvf writes comma-separated values (CSV) files using the LTER friendly format.

The friendly format has the header vertical and values in horizontal order. Here is an example of the friendly CSV output:

station,b1,b1,b1,b2,b2
landuse,me,me,me,me,me
latitude,46.6612188656,46.6612188656,46.6612188656,46.6862577024,46.6862577024
longitude,10.5902491243,10.5902491243,10.5902491243,10.5798451965,10.5798451965
elevation,990,990,990,1490,1490
parameter,precip_rt_nrt,snow_height,wind_dir,snow_height,wind_dir
depth,,,,,
aggregation,tot,smp,smp,smp,smp
unit,mm,,degrees,,degrees
2020-01-07 00:00:00,0,0.028,77,0.122,42
2020-01-07 00:15:00,0,0.027,115,0.128,83
2020-01-07 00:30:00,0,0.03,69,0.128,36
...

For more information see: https://gitlab.inf.unibz.it/lter/browser/-/issues/90

Index

Constants

View Source
const DefaultTimeFormat = "2006-01-02 15:04:05"

DefaultTimeFormat defines the default format to timestamp in the CSV output.

Variables

This section is empty.

Functions

This section is empty.

Types

type Writer

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

Writer writes a browser.TimeSeries as a friendly CSV file. It wraps a default csv.Writer.

func NewWriter

func NewWriter(w io.Writer) *Writer

NewWriter returns a new Writer that writes too w.

func (*Writer) Write

func (w *Writer) Write(ts browser.TimeSeries) error

Write writes the given browser.TimeSeries as friendly CSV file.

Jump to

Keyboard shortcuts

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