Giter Site home page Giter Site logo

Comments (5)

zacsketches avatar zacsketches commented on June 12, 2024

Some of the first steps toward this library might come from the

type aisRecord []string

implemented for the geo utility. This type wraps the return value of a csv.NewReader and adds a few methods helpful for dealing with AIS csv files. Function signatures implemented in geo are:

// contains provides a nice syntax record.contains("LAT") to ensure
// an aisRecord contains a value.  Returns the index and ok.
func (r aisRecord) contains(field string) (i int, ok bool) {
	for i, s := range r {
		if s == field {
			return i, true
		}
	}
	return 0, false
}

// parseFloat wraps strconv.ParseFloat with a method to return a
// float64 from the index value of a field in the AIS record.
// Useful for getting a LAT, LON, SOG or other numeric values
// from an aisRecord.
func (r aisRecord) parseFloat(index int) (float64, error) {
	s, err := strconv.ParseFloat(r[index], 64)
	if err != nil {
		return 0, err
	}
	return s, nil
}

from ais.

zacsketches avatar zacsketches commented on June 12, 2024

A simple early decision about the library should be its name. The name go-ais is already in the godoc claimed names so I am thinking aisutil or simply ais under a different import path than Paul T's version of the similar name.

from ais.

zacsketches avatar zacsketches commented on June 12, 2024

Initial test coverage for the ais package in commit e4c3f868af2f65bf029b4f7721b1281e110f6b53.

As stated in the commit message, this is just the start. This is in no way adequate coverage for the existing package and far from the eventually test driven development desired for future features of the package.

from ais.

zacsketches avatar zacsketches commented on June 12, 2024

Commit f66c944c60e08671ab2853f1fbe7373b168066c6 subtantially added to the package api that now includes the following capabilities:

const TimeLayout = `2006-01-02T15:04:05`
type Definition
type Headers
    func (h Headers) Contains(field string) (i int, ok bool)
    func (h Headers) String() string
    func (h Headers) Valid() bool
type PairHash
    func Hash64(a1, a2 Record, h Headers) (PairHash, error)
type Record
    func (r Record) Parse(h Headers) (Report, error)
    func (r Record) ParseFloat(index int) (float64, error)
    func (r Record) ParseInt(index int) (int64, error)
    func (r Record) ParseTime(index int) (time.Time, error)
type RecordSet
    func NewRecordSet(filename string) (*RecordSet, error)
    func (rs *RecordSet) Headers() Headers
    func (rs *RecordSet) Name() string
    func (rs *RecordSet) SetDictionary(blob []byte) error
type Report
    func (rep Report) HashData() []interface{}

Capabilities that may come next are

type Reader
   func NewReader(rs RecordSet) (*Reader, error)
   func (r Reader) Read() (Record, error)
   func (r Reader) Report() (Report, error)

from ais.

zacsketches avatar zacsketches commented on June 12, 2024

After opening up the repo for the community in mid-December 2019 it makes sense to let future direction for the package be driven by the community. So I am closing this issue and will look at a new issue of similar purpose once we have some experience reports.

from ais.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.