Comments (5)
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.
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.
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.
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.
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)
- Profile results are needed about the utility of calling Flush() explicitly
- Update readme for changes made to Matching and Subset HOT 1
- Add package AIS to Zenodo when coverage and community feedback warrants publication
- coveralls.io badge is caching HOT 2
- Write tests for RecordSet: Open, Read, readFirst, Stash HOT 1
- Test RecordSet.AppendField
- Test RecordSet.SubsetLimit() HOT 1
- Add feature for RecordSet.Track(...) (*RecordSet, error) HOT 2
- Headers.Valid() fails on sets with InteractionFields as the header HOT 2
- Add example for RecordSet.Read()
- Write a doc.go for the package that introduces key types and methods
- Add Validate method to RecordSet
- UniqueVessels does not rewind the file pointer HOT 1
- SubsetLimit does not rewind the Read() pointer HOT 2
- ContainsMulti would be useful HOT 1
- Simplify the Headers struct HOT 1
- RecordSet.Write is missing HOT 1
- VesselSet should include the count of records in the set HOT 1
- Sort by geohash HOT 1
- ContainsMulti should return a safer map HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ais.