Skip to content

Commit

Permalink
add triggered field in streams file (GeoNet#273)
Browse files Browse the repository at this point in the history
* add triggered field in streams file

* updated test streams.csv files

* add triggered field in streams file

* updated test streams.csv files
  • Loading branch information
ozym authored May 15, 2018
1 parent 39aa20e commit aefdf99
Show file tree
Hide file tree
Showing 13 changed files with 2,273 additions and 2,260 deletions.
1 change: 1 addition & 0 deletions install/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ A list of _datalogger_ sampling configurations for a given _station_ and recordi
| _Sampling Rate_ | Nominal stream sampling rate | samples per second (_Hz_)
| _Axial_ | Whether the stream is configured for</br>axial coordinates (_Z12_) or geographic (_ZNE_) |_"yes"_ or _"no"_
| _Reversed_ | Whether the recorded signal should</br>be reversed over the time window|_"yes"_ or _"no"_
| _Triggered_ | Whether the stream represents</br>triggered recordings|_"yes"_ or _"no"_
| _Start_ | Stream start time|
| _Stop_ | Stream stop time|

Expand Down
4,420 changes: 2,210 additions & 2,210 deletions install/streams.csv

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions meta/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,7 @@ func TestList(t *testing.T) {
SamplingRate: 50.0,
Axial: true,
Reversed: false,
Triggered: true,
Span: meta.Span{
Start: func() time.Time {
v, _ := time.Parse(meta.DateTimeFormat, "2011-08-25T00:25:00Z")
Expand All @@ -883,6 +884,7 @@ func TestList(t *testing.T) {
SamplingRate: 200.0,
Axial: false,
Reversed: false,
Triggered: false,
Span: meta.Span{
Start: func() time.Time {
v, _ := time.Parse(meta.DateTimeFormat, "2007-05-02T22:00:01Z")
Expand Down
10 changes: 9 additions & 1 deletion meta/streams.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const (
streamSamplingRate
streamAxial
streamReversed
streamTriggered
streamStart
streamEnd
streamLast
Expand All @@ -27,6 +28,7 @@ type Stream struct {
SamplingRate float64
Axial bool
Reversed bool
Triggered bool
}

func (s Stream) Less(stream Stream) bool {
Expand Down Expand Up @@ -65,6 +67,7 @@ func (s StreamList) encode() [][]string {
"Sampling Rate",
"Axial",
"Reversed",
"Triggered",
"Start Date",
"End Date",
}}
Expand All @@ -75,6 +78,7 @@ func (s StreamList) encode() [][]string {
strings.TrimSpace(strconv.FormatFloat(v.SamplingRate, 'g', -1, 64)),
strings.TrimSpace(strconv.FormatBool(v.Axial)),
strings.TrimSpace(strconv.FormatBool(v.Reversed)),
strings.TrimSpace(strconv.FormatBool(v.Triggered)),
v.Start.Format(DateTimeFormat),
v.End.Format(DateTimeFormat),
})
Expand Down Expand Up @@ -104,20 +108,24 @@ func (c *StreamList) decode(data [][]string) error {
return err
}

var axial, reversed bool
var axial, reversed, triggered bool
if axial, err = strconv.ParseBool(v[streamAxial]); err != nil {
return err
}
if reversed, err = strconv.ParseBool(v[streamReversed]); err != nil {
return err
}
if triggered, err = strconv.ParseBool(v[streamTriggered]); err != nil {
return err
}

streams = append(streams, Stream{
Station: strings.TrimSpace(v[streamStation]),
Location: strings.TrimSpace(v[streamLocation]),
SamplingRate: rate,
Axial: axial,
Reversed: reversed,
Triggered: triggered,
Span: Span{
Start: start,
End: end,
Expand Down
6 changes: 3 additions & 3 deletions meta/testdata/streams.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Station,Location,Sampling Rate,Axial,Reversed,Start Date,End Date
AKSS,20,50,true,false,2011-08-25T00:25:00Z,9999-01-01T00:00:00Z
APZ,20,200,false,false,2007-05-02T22:00:01Z,9999-01-01T00:00:00Z
Station,Location,Sampling Rate,Axial,Reversed,Triggered,Start Date,End Date
AKSS,20,50,true,false,true,2011-08-25T00:25:00Z,9999-01-01T00:00:00Z
APZ,20,200,false,false,false,2007-05-02T22:00:01Z,9999-01-01T00:00:00Z
12 changes: 6 additions & 6 deletions tools/altus/testdata/install/streams.csv
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Station,Location,Sampling Rate,Axial,Reversed,Start Date,End Date
DCZ,20,200,false,false,2003-08-23T09:00:00Z,2003-09-07T23:00:00Z
DCZ,20,200,true,false,2003-09-07T23:00:01Z,2015-10-22T00:00:00Z
DCZ,20,200,false,false,2015-10-22T05:00:01Z,9999-01-01T00:00:00Z
DSZ,20,200,false,false,1998-10-15T00:00:00Z,9999-01-01T00:00:00Z
MISS,20,200,true,false,1999-07-22T02:00:00Z,9999-01-01T00:00:00Z
Station,Location,Sampling Rate,Axial,Reversed,Triggered,Start Date,End Date
DCZ,20,200,false,false,true,2003-08-23T09:00:00Z,2003-09-07T23:00:00Z
DCZ,20,200,true,false,true,2003-09-07T23:00:01Z,2015-10-22T00:00:00Z
DCZ,20,200,false,false,true,2015-10-22T05:00:01Z,9999-01-01T00:00:00Z
DSZ,20,200,false,false,true,1998-10-15T00:00:00Z,9999-01-01T00:00:00Z
MISS,20,200,true,false,true,1999-07-22T02:00:00Z,9999-01-01T00:00:00Z
16 changes: 8 additions & 8 deletions tools/amplitude/testdata/install/streams.csv
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Station,Location,Sampling Rate,Axial,Reversed,Start Date,End Date
FWVZ,10,0.1,false,false,1999-05-11T00:00:00Z,9999-01-01T00:00:00Z
FWVZ,10,1,false,false,1999-05-11T00:00:00Z,9999-01-01T00:00:00Z
FWVZ,10,40,false,false,1999-05-11T00:00:00Z,2004-09-12T23:00:30Z
FWVZ,10,100,false,false,1999-05-11T00:00:00Z,9999-01-01T00:00:00Z
FWVZ,30,1,false,false,2001-07-05T01:30:00Z,9999-01-01T00:00:00Z
FWVZ,30,40,false,false,2001-07-05T01:30:00Z,2004-09-12T23:00:30Z
FWVZ,30,100,false,false,2001-07-05T01:30:00Z,9999-01-01T00:00:00Z
Station,Location,Sampling Rate,Axial,Reversed,Triggered,Start Date,End Date
FWVZ,10,0.1,false,false,false,1999-05-11T00:00:00Z,9999-01-01T00:00:00Z
FWVZ,10,1,false,false,false,1999-05-11T00:00:00Z,9999-01-01T00:00:00Z
FWVZ,10,40,false,false,false,1999-05-11T00:00:00Z,2004-09-12T23:00:30Z
FWVZ,10,100,false,false,false,1999-05-11T00:00:00Z,9999-01-01T00:00:00Z
FWVZ,30,1,false,false,false,2001-07-05T01:30:00Z,9999-01-01T00:00:00Z
FWVZ,30,40,false,false,false,2001-07-05T01:30:00Z,2004-09-12T23:00:30Z
FWVZ,30,100,false,false,false,2001-07-05T01:30:00Z,9999-01-01T00:00:00Z
18 changes: 9 additions & 9 deletions tools/chart/testdata/install/streams.csv
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Station,Location,Sampling Rate,Axial,Reversed,Start Date,End Date
OTAT,40,1,false,false,2010-02-25T00:00:00Z,9999-01-01T00:00:00Z
OTAT,40,10,false,false,2010-02-25T00:00:00Z,9999-01-01T00:00:00Z
OTAT,41,1,false,false,2010-02-25T00:00:00Z,9999-01-01T00:00:00Z
OTAT,41,10,false,false,2010-02-25T00:00:00Z,9999-01-01T00:00:00Z
SUMT,40,1,false,false,2010-08-11T00:00:00Z,9999-01-01T00:00:00Z
SUMT,40,10,false,false,2010-08-11T00:00:00Z,9999-01-01T00:00:00Z
SUMT,41,1,false,false,2010-08-11T00:00:00Z,9999-01-01T00:00:00Z
SUMT,41,10,false,false,2010-08-11T00:00:00Z,9999-01-01T00:00:00Z
Station,Location,Sampling Rate,Axial,Reversed,Triggered,Start Date,End Date
OTAT,40,1,false,false,false,2010-02-25T00:00:00Z,9999-01-01T00:00:00Z
OTAT,40,10,false,false,false,2010-02-25T00:00:00Z,9999-01-01T00:00:00Z
OTAT,41,1,false,false,false,2010-02-25T00:00:00Z,9999-01-01T00:00:00Z
OTAT,41,10,false,false,false,2010-02-25T00:00:00Z,9999-01-01T00:00:00Z
SUMT,40,1,false,false,false,2010-08-11T00:00:00Z,9999-01-01T00:00:00Z
SUMT,40,10,false,false,false,2010-08-11T00:00:00Z,9999-01-01T00:00:00Z
SUMT,41,1,false,false,false,2010-08-11T00:00:00Z,9999-01-01T00:00:00Z
SUMT,41,10,false,false,false,2010-08-11T00:00:00Z,9999-01-01T00:00:00Z
6 changes: 3 additions & 3 deletions tools/cusp/testdata/install/streams.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Station,Location,Sampling Rate,Axial,Reversed,Start Date,End Date
ADCS,20,200,true,false,2002-06-26T21:00:00Z,9999-01-01T00:00:00Z
WTMC,20,200,true,false,2005-11-15T01:00:00Z,9999-01-01T00:00:00Z
Station,Location,Sampling Rate,Axial,Reversed,Triggered,Start Date,End Date
ADCS,20,200,true,false,true,2002-06-26T21:00:00Z,9999-01-01T00:00:00Z
WTMC,20,200,true,false,true,2005-11-15T01:00:00Z,9999-01-01T00:00:00Z
8 changes: 4 additions & 4 deletions tools/impact/testdata/install/streams.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Station,Location,Sampling Rate,Axial,Reversed,Start Date,End Date
KIW,10,100,false,false,2004-06-09T23:00:00Z,9999-01-01T00:00:00Z
DKHS,20,50,true,false,2014-09-08T05:00:00Z,9999-01-01T00:00:00Z
DKHS,20,200,true,false,2002-06-06T00:00:00Z,9999-01-01T00:00:00Z
Station,Location,Sampling Rate,Axial,Reversed,Triggered,Start Date,End Date
KIW,10,100,false,false,false,2004-06-09T23:00:00Z,9999-01-01T00:00:00Z
DKHS,20,50,true,false,false,2014-09-08T05:00:00Z,9999-01-01T00:00:00Z
DKHS,20,200,true,false,true,2002-06-06T00:00:00Z,9999-01-01T00:00:00Z
16 changes: 8 additions & 8 deletions tools/spectra/testdata/install/streams.csv
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Station,Location,Sampling Rate,Axial,Reversed,Start Date,End Date
FWVZ,10,0.1,false,false,1999-05-11T00:00:00Z,9999-01-01T00:00:00Z
FWVZ,10,1,false,false,1999-05-11T00:00:00Z,9999-01-01T00:00:00Z
FWVZ,10,40,false,false,1999-05-11T00:00:00Z,2004-09-12T23:00:30Z
FWVZ,10,100,false,false,1999-05-11T00:00:00Z,9999-01-01T00:00:00Z
FWVZ,30,1,false,false,2001-07-05T01:30:00Z,9999-01-01T00:00:00Z
FWVZ,30,40,false,false,2001-07-05T01:30:00Z,2004-09-12T23:00:30Z
FWVZ,30,100,false,false,2001-07-05T01:30:00Z,9999-01-01T00:00:00Z
Station,Location,Sampling Rate,Axial,Reversed,Triggered,Start Date,End Date
FWVZ,10,0.1,false,false,false,1999-05-11T00:00:00Z,9999-01-01T00:00:00Z
FWVZ,10,1,false,false,false,1999-05-11T00:00:00Z,9999-01-01T00:00:00Z
FWVZ,10,40,false,false,false,1999-05-11T00:00:00Z,2004-09-12T23:00:30Z
FWVZ,10,100,false,false,false,1999-05-11T00:00:00Z,9999-01-01T00:00:00Z
FWVZ,30,1,false,false,false,2001-07-05T01:30:00Z,9999-01-01T00:00:00Z
FWVZ,30,40,false,false,false,2001-07-05T01:30:00Z,2004-09-12T23:00:30Z
FWVZ,30,100,false,false,false,2001-07-05T01:30:00Z,9999-01-01T00:00:00Z
10 changes: 6 additions & 4 deletions tools/stationxml/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,14 @@ func (b *Builder) Construct(base string) ([]stationxml.Network, error) {
}

var types []stationxml.Type
types = append(types, func() stationxml.Type {
if stream.Triggered {
return stationxml.TypeTriggered
}
return stationxml.TypeContinuous
}())
for _, t := range response.Type {
switch t {
case 'c', 'C':
types = append(types, stationxml.TypeContinuous)
case 't', 'T':
types = append(types, stationxml.TypeTriggered)
case 'g', 'G':
types = append(types, stationxml.TypeGeophysical)
case 'w', 'W':
Expand Down
8 changes: 4 additions & 4 deletions tools/stationxml/testdata/install/streams.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Station,Location,Sampling Rate,Axial,Reversed,Start Date,End Date
CMWZ,10,100,false,false,2003-12-10T19:00:02Z,9999-01-01T00:00:00Z
CMWZ,20,50,false,false,2016-12-05T06:30:00Z,9999-01-01T00:00:00Z
CMWZ,20,200,false,false,2016-12-05T06:30:00Z,9999-01-01T00:00:00Z
Station,Location,Sampling Rate,Axial,Reversed,Triggered,Start Date,End Date
CMWZ,10,100,false,false,false,2003-12-10T19:00:02Z,9999-01-01T00:00:00Z
CMWZ,20,50,false,false,false,2016-12-05T06:30:00Z,9999-01-01T00:00:00Z
CMWZ,20,200,false,false,true,2016-12-05T06:30:00Z,9999-01-01T00:00:00Z

0 comments on commit aefdf99

Please sign in to comment.