Skip to content

Commit

Permalink
Merge branch 'main' into antenna-calibration-202310
Browse files Browse the repository at this point in the history
  • Loading branch information
aleks-spes authored Apr 11, 2024
2 parents 07a4cb9 + f509923 commit f879043
Show file tree
Hide file tree
Showing 62 changed files with 3,460 additions and 734 deletions.
7 changes: 6 additions & 1 deletion assets/dataloggers.csv
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Campbell Scientific,CR6,11301,,
Campbell Scientific,CR6,11303,,
Campbell Scientific,CR6,11770,,
Campbell Scientific,CR6,15365,,
Campbell Scientific,CR6,15366,,
Campbell Scientific,CR6,15366,404990,
Campbell Scientific,CR6,15367,,
Campbell Scientific,CR6,15368,,
Campbell Scientific,CR6,15370,,
Expand All @@ -30,6 +30,7 @@ Campbell Scientific,CR6,20467,,
Campbell Scientific,CR6,20468,,
Campbell Scientific,CR6,20469,,
Campbell Scientific,CR6,20470,,
Campbell Scientific,CR6,20474,411210,
Campbell Scientific,CR6,20475,,
Galitzin-Wilip,GALITZIN-WILIP,WEL_1,,
Guralp,GURALP-SAM-RECORDER,S0125,,
Expand Down Expand Up @@ -653,6 +654,7 @@ Nanometrics,Centaur CTR4-6S,9894,,
Nanometrics,Centaur CTR4-6S,9895,,
Nanometrics,Centaur CTR4-6S,9899,,
Nanometrics,Centaur CTR4-6S,9901,,
Nanometrics,Centaur CTR4-6S,9902,,
Nanometrics,Centaur CTR4-6S,9903,,
Nanometrics,Centaur CTR4-6S,9904,,
Nanometrics,Centaur CTR4-6S,9906,,
Expand All @@ -674,6 +676,9 @@ Nanometrics,Centaur CTR4-6S,10233,,
Nanometrics,Centaur CTR4-6S,10234,,
Nanometrics,Centaur CTR4-6S,10235,,
Nanometrics,Centaur CTR4-6S,10236,,
Nanometrics,Centaur CTR4-6S,10840,,
Nanometrics,Centaur CTR4-6S,10956,,
Nanometrics,Centaur CTR4-6S,10961,,
Nanometrics,ORION,0144,,
Nanometrics,ORION,0145,,
Nanometrics,ORION,0160,,
Expand Down
1 change: 1 addition & 0 deletions assets/receivers.csv
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ Trimble Navigation Ltd.,TRIMBLE ALLOY,6222R40136,,
Trimble Navigation Ltd.,TRIMBLE ALLOY,6223R40055,,
Trimble Navigation Ltd.,TRIMBLE ALLOY,6225R40007,,
Trimble Navigation Ltd.,TRIMBLE ALLOY,6225R40025,,
Trimble Navigation Ltd.,TRIMBLE ALLOY,6402R40041,,
Trimble Navigation Ltd.,TRIMBLE NETR5,4737K07041,,
Trimble Navigation Ltd.,TRIMBLE NETR9,5014K66721,13986,
Trimble Navigation Ltd.,TRIMBLE NETR9,5014K66722,14078,
Expand Down
12 changes: 12 additions & 0 deletions assets/recorders.csv
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,7 @@ Canterbury Seismic Instruments,EQR120,46540,,
Canterbury Seismic Instruments,EQR120,46541,,
Canterbury Seismic Instruments,EQR120,46542,,
Canterbury Seismic Instruments,EQR120,46543,,
Canterbury Seismic Instruments,EQR120,46571,,
Canterbury Seismic Instruments,EQR120,46594,,
Canterbury Seismic Instruments,EQR120,46595,,
Canterbury Seismic Instruments,EQR120,46596,,
Expand All @@ -663,6 +664,7 @@ Canterbury Seismic Instruments,EQR120,46603,,
Canterbury Seismic Instruments,EQR120,46604,,
Canterbury Seismic Instruments,EQR120,46605,,
Canterbury Seismic Instruments,EQR120,46607,,
Canterbury Seismic Instruments,EQR120,46608,,
Canterbury Seismic Instruments,EQR120,46609,,
Canterbury Seismic Instruments,EQR120,46610,,
Canterbury Seismic Instruments,EQR120,46611,,
Expand All @@ -672,19 +674,23 @@ Canterbury Seismic Instruments,EQR120,46614,,
Canterbury Seismic Instruments,EQR120,46615,,
Canterbury Seismic Instruments,EQR120,46617,,
Canterbury Seismic Instruments,EQR120,46618,,
Canterbury Seismic Instruments,EQR120,46619,,
Canterbury Seismic Instruments,EQR120,46621,,
Canterbury Seismic Instruments,EQR120,46622,,
Canterbury Seismic Instruments,EQR120,46623,,
Canterbury Seismic Instruments,EQR120,46624,,
Canterbury Seismic Instruments,EQR120,46625,,
Canterbury Seismic Instruments,EQR120,46626,,
Canterbury Seismic Instruments,EQR120,46627,,
Canterbury Seismic Instruments,EQR120,46628,,
Canterbury Seismic Instruments,EQR120,46629,,
Canterbury Seismic Instruments,EQR120,46631,,
Canterbury Seismic Instruments,EQR120,46647,,
Canterbury Seismic Instruments,EQR120,46648,,
Canterbury Seismic Instruments,EQR120,46649,,
Canterbury Seismic Instruments,EQR120,46650,,
Canterbury Seismic Instruments,EQR120,46651,,
Canterbury Seismic Instruments,EQR120,46652,,
Canterbury Seismic Instruments,EQR120,46653,,
Canterbury Seismic Instruments,EQR120,46654,,
Canterbury Seismic Instruments,EQR120,46655,,
Expand Down Expand Up @@ -1131,7 +1137,13 @@ Nanometrics,TitanSMA,002181,,
Nanometrics,TitanSMA,002183,,
Nanometrics,TitanSMA,002184,,
Nanometrics,TitanSMA,002185,,
Nanometrics,TitanSMA,002199,,
Nanometrics,TitanSMA,002203,,
Nanometrics,TitanSMA,002204,,
Nanometrics,TitanSMA,002205,,
Nanometrics,TitanSMA,002208,,
Nanometrics,TitanSMA,002210,,
Nanometrics,TitanSMA,002211,,
Physics and Engineering Laboratory DSIR,MO1,0001,,
Physics and Engineering Laboratory DSIR,MO1,0002,,
Physics and Engineering Laboratory DSIR,MO1,0003,,
Expand Down
14 changes: 13 additions & 1 deletion assets/sensors.csv
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ Campbell Scientific,107 temperature probe,411941,,
Campbell Scientific,107 temperature probe,411942,,
Campbell Scientific,107 temperature probe,411943,,
Campbell Scientific,107 temperature probe,411944,,
Campbell Scientific,107 temperature probe,412277,,
Campbell Scientific,107 temperature probe,412427,,
Campbell Scientific,LevelVUE B10,1048,,
Campbell Scientific,LevelVUE B10,1064,,
Campbell Scientific,Pulse radar water-level sensor CS475A,43460111,,
Expand All @@ -39,6 +41,10 @@ Campbell Scientific,Titanium pressure transducer CS456,14010302,,
Campbell Scientific,Titanium pressure transducer CS456,70010135,,
Campbell Scientific,Titanium pressure transducer CS456,70010240,,
Campbell Scientific,Titanium pressure transducer CS456,70010248,,
City Technology,T3H H2S sensor,01.44557167 112,,
City Technology,T3H H2S sensor,01.44865262 112,,
City Technology,T3STF SO2 sensor,01.45929880 013,,
City Technology,T3STF SO2 sensor,01.45929894 013,,
Danish Meteorological Institute,FGE,S0257-E0299,,fluxgate
Danish Meteorological Institute,FGE,S0263-S0308,,fluxgate
Danish Meteorological Institute,FGE,S0330-E0397,,fluxgate
Expand Down Expand Up @@ -257,6 +263,8 @@ Geospace Technologies,GS-11D seismometer,MRP012,,
Geospace Technologies,GS-11D seismometer,MRP013,,
Geospace Technologies,GS-11D seismometer,MRP014,,
Geospace Technologies,Geospace sensor GS-20DM,DFDP#2,,
Gill Instruments,Gill WindSonic WS60 OPT4,22370069,,
Gill Instruments,Gill WindSonic WS60 OPT4,22490065,,
GNS Science,LM35,T001,,
GNS Science,LM35,T002,,
GNS Science,SDP,A1,,
Expand Down Expand Up @@ -455,7 +463,6 @@ Intech,Platinum resistance thermometer,001,,
Intech,Platinum resistance thermometer,002,,
Intech,Platinum resistance thermometer,003,,
Intech,Platinum resistance thermometer,004,,
Kinemetrics,EpiSensor 2,185,,
Kinemetrics,FBA-23,25073,,
Kinemetrics,FBA-23,45577,,
Kinemetrics,FBA-23,WEL_WLN,,
Expand Down Expand Up @@ -663,7 +670,10 @@ Lennartz Electronic,LE-3DliteMkIII,J-0937,,
Lennartz Electronic,LE-3DliteMkIII,J-0940,,
Lennartz Electronic,LE-3DliteMkIII,J-0941,,
Lennartz Electronic,LE-3DliteMkIII,J-0942,,
Lennartz Electronic,LE-3DliteMkIII,J-0943,,
Lennartz Electronic,LE-3DliteMkIII,J-0946,,
Licor,Li-850 CO2/H2O Gas Analyzer,HGA-06812,,
Licor,Li-850 CO2/H2O Gas Analyzer,HGA-06920,,
Nanometrics,Titan TACCL-N1,2590,,
Nanometrics,Titan TACCL-BH1,2363,,
Nanometrics,Trillium 120PA,730,,
Expand Down Expand Up @@ -766,7 +776,9 @@ Nanometrics,Trillium Horizon TH120-2,2584,,
Nanometrics,Trillium Horizon TH120-2,2692,,
Nanometrics,Trillium Horizon TH120-2,2745,,
Nanometrics,Trillium Horizon TH120-2,2836,,
Nanometrics,Trillium Horizon TH120-2,2837,,
Nanometrics,Trillium Horizon TH120-2,2838,,
Nanometrics,Trillium Horizon TH120-2,3356,,
OTT Hydromet,Compact Bubbler Sensor USGS model,002,,
OTT Hydromet,Compact Bubbler Sensor USGS model,407895,16026,
OTT Hydromet,Compact Bubbler Sensor USGS model,422837,,
Expand Down
73 changes: 73 additions & 0 deletions cmd/chart-config/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# chart-config

Build a chart plotting stream config file from delta meta & response information.

## Overview

The chart plotting software currently uses miniseed data as its input for plotting. To convert this to meaningful data, and to allow
annotations some form of meta data is required.

Two forms of metadata are compiles: the station and network descriptions; and the stream's scaling response to convert signal values.

Extra streams can be provided, so long as the station details have been loaded into delta, this requires the stream srcname (NN_SSSS_LL_CCC)
and the sampling frequency (e.g. `IU_RAR_10_BHZ:40`).

## Usage:

./chart-config [options]

## Options:

-base string
delta base files
-channels value
channel selection regexp (default .*)
-exclude value
station exclusion regexp
-extra string
extra streams to include
-include value
station inclusion regexp
-locations value
location selection regexp (default .*)
-networks value
network selection regexp (default .*)
-output string
output chart configuration file
-primary string
add phase constituent for tsunami streams (default "M2")
-resp string
base directory for response xml files on disk
-single
only add one stream per station
-skip string
extra streams to exclude
-stations value
station selection regexp (default .*)

## Example

This is the output for the station `CAW` and the channel `EHZ`:

```
[
{
"srcname": "NZ_CAW_10_EHZ",
"network-code": "NZ",
"station-code": "CAW",
"location-code": "10",
"channel-code": "EHZ",
"station-name": "Cannon Point",
"internal-network": "WL",
"network-description": "Wellington regional seismic network",
"latitude": -41.107194232,
"longitude": 175.066438523,
"sampling-period": 10000000,
"sensitivity": 167772160,
"gain": 1,
"input_units": "m/s",
"output_units": "count"
}
]
```

81 changes: 81 additions & 0 deletions cmd/chart-config/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
package main

import (
"bytes"
"encoding/json"
"io"
"os"
"time"
)

// Stream is used to identify and describe streams that may be used for chart drawing.
type Stream struct {
// Srcname is the Stream identification encoded as per NN_SSSS_LL_CCC.
Srcname string `json:"srcname"`
// NetworkCode is the short code of Stream network (NN).
NetworkCode string `json:"network-code"`
// StationCode is the short code of the Stream station (SSSS).
StationCode string `json:"station-code"`
// LocationCode is the short code of the Stream site location (LL).
LocationCode string `json:"location-code"`
// ChannelCode is the short code of the Stream channel (CCC).
ChannelCode string `json:"channel-code"`
// StationName is the long name of the Stream station.
StationName string `json:"station-name"`
// InternalNetwok is the shore code of the Stream network lookup.
InternalNetwork string `json:"internal-network"`
// NetworkDescription is the long name of the Stream internal network.
NetworkDescription string `json:"network-description,omitempty"`
// Latitude is the Stream site latitude in decimal degrees.
Latitude float64 `json:"latitude"`
// Longitude is the Stream site longitude in decimal degrees.
Longitude float64 `json:"longitude"`
// Elevation is the Stream site height in meters above sea level.
Elevation float64 `json:"elevation,omitempty"`
// Depth is the Stream site depth in meters below water level.
Depth float64 `json:"depth,omitempty"`
// SamplingPeriod is the time interval between samples, in nanoseconds.
SamplingPeriod time.Duration `json:"sampling-period,omitempty"`
// TidalLag is lag of the primary tide for the site if appropriate.
TidalLag float64 `json:"tidal-lag,omitempty"`
// Sensitivity is the initial conversion factor to convert from counts to the desired units, or volts.
Sensitivity float64 `json:"sensitivity,omitempty"`
// Gain is an optional factor to convert from, usually, volts to the desired units.
Gain float64 `json:"gain,omitempty"`
// Bias is an optional factor to add to the output after scaling to offset the signal.
Bias float64 `json:"bias,omitempty"`
// InputUnits describes the expected input signal units.
InputUnits string `json:"input_units,omitempty"`
// OutputUnits describes the expected output signal units, which is usually counts.
OutputUnits string `json:"output_units,omitempty"`
}

// Config is a slice of Stream vales.
type Config []Stream

// Write sends a JSON encoded byte array to a Writer interface.
func (c Config) Write(wr io.Writer) error {
enc := json.NewEncoder(wr)

return enc.Encode(c)
}

// Marshal converts a Config into a JSON encoded byte array.
func (c Config) Marshal() ([]byte, error) {
var buf bytes.Buffer
if err := c.Write(&buf); err != nil {
return nil, err
}
return buf.Bytes(), nil
}

// Write sends a JSON encoded byte array to a file.
func (c Config) WriteFile(path string) error {
file, err := os.Create(path)
if err != nil {
return err
}
defer file.Close()

return c.Write(file)
}
45 changes: 45 additions & 0 deletions cmd/chart-config/config_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package main

import (
"os"
"testing"

"github.com/google/go-cmp/cmp"
)

func TestConfig(t *testing.T) {

config := Config([]Stream{
{
Srcname: "NZ_CAW_10_EHZ",
NetworkCode: "NZ",
StationCode: "CAW",
LocationCode: "10",
ChannelCode: "EHZ",
StationName: "Cannon Point",
InternalNetwork: "WL",
NetworkDescription: "Wellington regional seismic network",
Latitude: -41.107194232,
Longitude: 175.066438523,
SamplingPeriod: 10000000,
Sensitivity: 167772160,
Gain: 1,
InputUnits: "m/s",
OutputUnits: "count",
},
})

raw, err := os.ReadFile("./testdata/config.json")
if err != nil {
t.Fatal(err)
}

data, err := config.Marshal()
if err != nil {
t.Fatal(err)
}

if !cmp.Equal(raw, data) {
t.Errorf("unexpected content -got/+exp\n%s", cmp.Diff(raw, data))
}
}
Loading

0 comments on commit f879043

Please sign in to comment.