From 2e5f8e5b645a8ea1f3c90fb4b519e460fd109ecd Mon Sep 17 00:00:00 2001 From: "Jordan K. Wilson" Date: Tue, 22 Oct 2024 21:37:08 +1300 Subject: [PATCH 1/2] feat: add GNSS as a domain --- cmd/tilde-config/gnss.go | 34 ++++++++++++++++++++++++++++++++++ cmd/tilde-config/main.go | 5 +++++ 2 files changed, 39 insertions(+) create mode 100644 cmd/tilde-config/gnss.go diff --git a/cmd/tilde-config/gnss.go b/cmd/tilde-config/gnss.go new file mode 100644 index 000000000..9c0c2813b --- /dev/null +++ b/cmd/tilde-config/gnss.go @@ -0,0 +1,34 @@ +package main + +import ( + "fmt" + "math" + + "github.com/GeoNet/delta/meta" +) + +func (t *Tilde) Gnss(set *meta.Set) error { + var stns []Station + + // all marks are GNSS stations + for _, m := range set.Marks() { + stns = append(stns, Station{ + Code: m.Code, + Description: m.Name, + Start: toTimePtr(m.Start), + End: toTimePtr(m.End), + Latitude: toFloat(fmt.Sprintf("%0.4f", m.Latitude)), + Longitude: toFloat(fmt.Sprintf("%0.4f", m.Longitude)), + Elevation: toFloat(fmt.Sprintf("%0.0f", math.Round(m.Elevation))), + }) + } + + // update domains + t.Domains = append(t.Domains, Domain{ + Name: "gnss", + Description: "Global Navigation Satellite System Sensors", + Stations: stns, + }) + + return nil +} diff --git a/cmd/tilde-config/main.go b/cmd/tilde-config/main.go index b8416c10d..d91662341 100644 --- a/cmd/tilde-config/main.go +++ b/cmd/tilde-config/main.go @@ -100,6 +100,11 @@ func main() { log.Fatalf("unable to build scandoas configuration: %v", err) } + // update gnss gomain + if err := tilde.Gnss(set); err != nil { + log.Fatalf("unable to build gnss configuration: %v", err) + } + switch { case settings.output != "": // output file has been given From 121fc30498df4b5f6c132aea63e539f880195a2d Mon Sep 17 00:00:00 2001 From: "Jordan K. Wilson" Date: Wed, 23 Oct 2024 11:44:39 +1300 Subject: [PATCH 2/2] nfc: update help description --- cmd/tilde-config/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/tilde-config/main.go b/cmd/tilde-config/main.go index d91662341..812635639 100644 --- a/cmd/tilde-config/main.go +++ b/cmd/tilde-config/main.go @@ -48,7 +48,7 @@ func main() { flag.StringVar(&settings.geomag, "geomag", "GM", "geomagnetic network code") flag.StringVar(&settings.scandoas, "scandoas", "EN", "scandoas network code") flag.StringVar(&settings.extra, "extra", "GM=SM_SMHS_50", "attach extra stations and locations to a network, e.g. GM=SM_SMHS_50") - flag.StringVar(&settings.output, "output", "", "output dart configuration file") + flag.StringVar(&settings.output, "output", "", "output tilde configuration file") flag.Parse()