diff --git a/bin/db/inwhichpolygons/LICENSE b/bin/db/inwhichpolygons/LICENSE
new file mode 100644
index 000000000..98eb59478
--- /dev/null
+++ b/bin/db/inwhichpolygons/LICENSE
@@ -0,0 +1,39 @@
+Copyright (c) 2003 Nikolaus Horn
+All rights reserved.
+
+This software is licensed under the New BSD license:
+
+Redistribution and use in source and binary forms,
+with or without modification, are permitted provided
+that the following conditions are met:
+
+* Redistributions of source code must retain the above
+copyright notice, this list of conditions and the
+following disclaimer.
+
+* Redistributions in binary form must reproduce the
+above copyright notice, this list of conditions and
+the following disclaimer in the documentation and/or
+other materials provided with the distribution.
+
+* Neither the name of Nikolaus Horn nor
+the names of its contributors may be used to endorse
+or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
diff --git a/bin/db/net_sim/net_sim.1 b/bin/db/net_sim/net_sim.1
index 743a4c5f4..dda0d9744 100644
--- a/bin/db/net_sim/net_sim.1
+++ b/bin/db/net_sim/net_sim.1
@@ -5,6 +5,7 @@ net_sim \- estimate network magnitude threshold
.nf
\fBnet_sim \fP[-v] [-n \fInsta\fP] [-p \fIpf\fP] [-i \fIsta\fP[,\fIsta2\fP]]
[-s \fIsnr\fP] [-r \fIrmsdb\fP | -R \fIrms\fP] [-t \fItime\fP]
+ [-c] [-b] [-m] [d]
[-S \fIsta/lat/lon/rms\fP] [-f \fIgridfilename\fP] \fIdbname\fP [\fIplotfile\fP]
.fi
@@ -35,6 +36,16 @@ Add a virtual station. Multiple stations can be specified by repeating the argum
specify \fIsnr\fP. This overrides the value from the paramter file.
.IP "-t time"
Time for \fIrms\fP values when a database is used to lookup the \fIrms\fP values. If not specified, the program looks for recent values. How recent exactly is infuenced by the \fIsnr_latency\fP from the parameter file.
+.IP "-c
+Plotting cities (from a table \fBplaces\fI) is enabled by configuring the optional parameters \fIcities_dbname\fP and \fIcities_subset\fP in the parameterfile.
+The commandline paramter c disables plotting of cities.
+.IP "-b
+Plotting borders (from a database with polygons) is enabled by configuring the optional parameters \fIplaces_dbname\fP and \fIplaces_subset\fP in the parameterfile.
+The commandline paramter b disables plotting of borders.
+.IP "-m"
+Don't plot magnitude thresholds.
+.IP "-d"
+Don't plot distances.
.IP "dbname"
Name of database with station coordinates in a site table. This argument is required.
.IP plotfilename
diff --git a/bin/db/net_sim/net_sim.pf b/bin/db/net_sim/net_sim.pf
index 02ddcdc4b..d5694d365 100644
--- a/bin/db/net_sim/net_sim.pf
+++ b/bin/db/net_sim/net_sim.pf
@@ -24,16 +24,37 @@ magtype Ml
# c0 0.52
# c1 1.66
+# Valid font sizes are xx-small, x-small, small, medium, large, x-large, xx-large, smaller, larger
+# or numerical font size in points
+title_fontsize medium
+label_fontsize x-small
#if these are not specified, the program uses the bounding box of the network
xmin
xmax
ymin
ymax
+
+# colorbar boundaries and contours
+number_contours
+mindist
+maxdist
+minmag
+maxmag
+
#use all stations by default
stations_used &Tbl{
}
stations_ignored &Tbl{
}
station_rms &Arr{
+# GILA 20
+# SQMD 3
}
+
+
+# additional labels and lines - mainly for orientation
+cities_dbname #/opt/antelope/local/data/database/ortsliste_kurz_utf8_aec_bin
+cities_subset #place=~/Wien
+borders_dbname #/opt/antelope/local/data/database/BekannteGrenzen
+borders_subset #ptype=~/pb/ || pname=~/Austria/
diff --git a/bin/db/net_sim/net_sim.xpy b/bin/db/net_sim/net_sim.xpy
index a1fb35b75..94e0c01b6 100644
--- a/bin/db/net_sim/net_sim.xpy
+++ b/bin/db/net_sim/net_sim.xpy
@@ -12,22 +12,26 @@ show a grid of minimum detectable magnitudes
"""
import getopt
-import numpy as np
import math
+import numpy as np
+import matplotlib
+import matplotlib.pyplot as plt
# Import Antelope modules
import antelope.datascope as ds
import antelope.stock as stock
import antelope.elog as elog
+
# Import contributed module
-sys.path.append(os.environ['ANTELOPE'] + "/contrib/data/python")
+sys.path.append(os.environ["ANTELOPE"] + "/contrib/data/python")
import zamg.utilities as zu
+
def usage(progname):
print(
progname,
- "[-v] [-n nsta] [-i sta[,sta2]] [-s snr] [-r rmsdb | -R rms] [-S sta/lat/lon/rms] [-f gridfilename] dbname [outfile]",
+ "[-v] [-t time] [-n nsta] [-i sta[,sta2]] [-s snr] [-r rmsdb | -R rms] [-S sta/lat/lon/rms] [-f gridfilename] dbname [outfile]",
)
@@ -56,8 +60,15 @@ def main():
snr = 4.0
nx = ny = 100
rms_latency = 120 # two minutes ago
+ title_fontsize = "small"
+ label_fontsize = "small"
+ plot_dist = True
+ plot_mags = True
+ plot_borders = False
+ plot_cities = False
+
try:
- opts, args = getopt.getopt(sys.argv[1:], "vf:h:i:n:p:r:R:s:S:t:", "")
+ opts, args = getopt.getopt(sys.argv[1:], "vf:i:n:p:r:R:s:S:t:dmcb", "")
except getopt.GetoptError:
usage(progname)
elog.die("Illegal option")
@@ -80,12 +91,58 @@ def main():
stations_used = pf["stations_used"]
stations_ignored = pf["stations_ignored"]
station_rms = pf["station_rms"]
+ if "cities_dbname" in list(pf.keys()) and pf["cities_dbname"] != "":
+ plot_cities = True
+ dbn = pf["cities_dbname"]
+ cities = ds.dbopen(dbn, "r")
+ cities = cities.lookup(table="places")
+ if "cities_subset" in list(pf.keys()) and pf["cities_subset"] != "":
+ expr = pf["cities_subset"]
+ cities = cities.subset(expr)
+ if "borders_dbname" in list(pf.keys()) and pf["borders_dbname"] != "":
+ plot_borders = True
+ dbn = pf["borders_dbname"]
+ borders = ds.dbopen(dbn, "r")
+ borders = borders.lookup(table="polygon")
+ if "borders_subset" in list(pf.keys()) and pf["borders_subset"] != "":
+ expr = pf["borders_subset"]
+ borders = borders.subset(expr)
+
+ if "title_fontsize" in list(pf.keys()) and pf["title_fontsize"] != "":
+ sz_str = pf["title_fontsize"]
+ if sz_str.isnumeric():
+ title_fontsize = int(sz_str)
+ else:
+ title_fontsize = sz_str
+
+ if "label_fontsize" in list(pf.keys()) and pf["label_fontsize"] != "":
+ sz_str = pf["label_fontsize"]
+ if sz_str.isnumeric():
+ label_fontsize = int(sz_str)
+ else:
+ label_fontsize = sz_str
+
+ params = {
+ "legend.fontsize": label_fontsize,
+ #'figure.figsize': (15, 5),
+ "axes.labelsize": label_fontsize,
+ "axes.titlesize": title_fontsize,
+ "xtick.labelsize": label_fontsize,
+ "ytick.labelsize": label_fontsize,
+ }
+ plt.rcParams.update(params)
for o, a in opts:
if o == "-v":
verbose = True
- elif o == "-h":
- histdbname = a
+ elif o == "-d":
+ plot_dist = False
+ elif o == "-m":
+ plot_mags = False
+ elif o == "-c":
+ plot_cities = False
+ elif o == "-b":
+ plot_borders = False
elif o == "-i":
i_list = a.replace("/", ",").split(",")
stations_to_ignore = stations_to_ignore + i_list
@@ -125,12 +182,10 @@ def main():
sys.exit(1)
dbname = args[0]
- import matplotlib
if len(args) > 1:
matplotlib.use("Agg")
plotfilename = args[1]
- import matplotlib.pyplot as plt
db = ds.dbopen(dbname, "r")
dbsite = db.lookup(table="site")
@@ -144,6 +199,8 @@ def main():
"sta", unique=True
) # similar to offdate == NULL, and always ok
# might improve by offdate==NULL || offdate >= OFFDATE_NOW
+ # this here is acceptable since stations shall not move by more than a few meters,
+ # otherwise a different station name should be used
if len(stations_used) > 0:
dbsite = dbsite.subset("sta=~/%s" % "|".join(stations_used))
if verbose:
@@ -259,6 +316,8 @@ def main():
rmss.append(xs["rms"] * snr)
number_sites += 1
+ n_off = len(off_stanames)
+
stalat = np.asarray(slats)
stalon = np.asarray(slons)
starms = np.asarray(rmss)
@@ -280,13 +339,29 @@ def main():
else:
lonmax = math.ceil(max(stalon))
+ number_contours = None
+ mindist = None
+ maxdist = None
+ minmag = None
+ maxmag = None
+ if "number_contours" in list(pf.keys()) and pf["number_contours"] != "":
+ number_contours = int(pf["number_contours"])
+ if "mindist" in list(pf.keys()) and pf["mindist"] != "":
+ mindist = float(pf["mindist"])
+ if "maxdist" in list(pf.keys()) and pf["maxdist"] != "":
+ maxdist = float(pf["maxdist"])
+ if "minmag" in list(pf.keys()) and pf["minmag"] != "":
+ minmag = float(pf["minmag"])
+ if "maxmag" in list(pf.keys()) and pf["maxmag"] != "":
+ maxmag = float(pf["maxmag"])
+
lats = np.linspace(latmin, latmax, num=ny)
lons = np.linspace(lonmin, lonmax, num=nx)
LA, LO = np.meshgrid(lats, lons)
dist = np.empty([number_sites, LA.shape[0], LA.shape[1]])
- gdist = np.empty([number_sites, LA.shape[0], LA.shape[1]])
- hdist = np.empty([number_sites, LA.shape[0], LA.shape[1]])
+ # gdist = np.empty([number_sites, LA.shape[0], LA.shape[1]])
+ # hdist = np.empty([number_sites, LA.shape[0], LA.shape[1]])
mag = np.empty([number_sites, LA.shape[0], LA.shape[1]])
for i in range(number_sites):
# distance in degrees
@@ -295,51 +370,124 @@ def main():
# convert to kilometers,
dist[i] *= 111.195
+ # distances to each station sorted, so
+ # dist[0] is the distance to the closest station,
+ # dist[1] is the distance to the second closest station ...
dist = np.sort(dist, axis=0)
+ if verbose:
+ min_stadist = np.min(dist[0])
+ max_sta_dist = np.max(dist[nsta_reqd - 1])
+ elog.notify(
+ "station spacings form %.1f km to %.1f km (%d stations)"
+ % (min_stadist, max_sta_dist, nsta_reqd)
+ )
mag = np.sort(mag, axis=0)
+
+ if plot_borders:
+ import zamg.polygon as p
+
+ pdata = p.readpolygon(borders)
+ if plot_cities:
+ clats = []
+ clons = []
+ cstrings = []
+ cities = cities.subset(
+ "lat > %f && lat < %f && lon > %f && lon < %f"
+ % (latmin, latmax, lonmin, lonmax)
+ )
+ for cities.record in range(cities.record_count):
+ [lat, lon, city] = cities.getv("lat", "lon", "place")
+ clats.append(lat)
+ clons.append(lon)
+ cstrings.append(city)
+ clat = np.asarray(clats)
+ clon = np.asarray(clons)
+
plt.figure()
- plt.subplot(2, 1, 1)
- contour = plt.contourf(LO, LA, dist[nsta_reqd - 1, :, :])
- n_off = len(off_stanames)
- if n_off > 0:
- plt.plot(off_lons, off_lats, "y.")
- for i in range(n_off):
- plt.text(off_lons[i], off_lats[i], off_stanames[i])
- plt.plot(stalon, stalat, "r+")
- for i in range(number_sites):
- if (
- stalon[i] > lonmin
- and stalon[i] < lonmax
- and stalat[i] > latmin
- and stalat[i] < latmax
- ):
- plt.text(stalon[i], stalat[i], stanames[i])
- plt.xlim(lonmin, lonmax)
- plt.ylim(latmin, latmax)
- plt.colorbar(contour)
-
- plt.title("minimum distance to %dth station (km)" % nsta_reqd)
-
- plt.subplot(2, 1, 2)
- mag_contour = plt.contourf(LO, LA, mag[nsta_reqd - 1, :, :])
- if n_off > 0:
- plt.plot(off_lons, off_lats, "y.")
- for i in range(n_off):
- plt.text(off_lons[i], off_lats[i], off_stanames[i])
-
- plt.plot(stalon, stalat, "r+")
- for i in range(number_sites):
- if (
- stalon[i] > lonmin
- and stalon[i] < lonmax
- and stalat[i] > latmin
- and stalat[i] < latmax
- ):
- plt.text(stalon[i], stalat[i], stanames[i])
- plt.xlim(lonmin, lonmax)
- plt.ylim(latmin, latmax)
- plt.colorbar(mag_contour)
- plt.title("%s detection threshold using %d stations" % (magtype, nsta_reqd))
+ if plot_dist and plot_mags:
+ plt.subplot(2, 1, 1)
+ if plot_dist:
+ if number_contours and mindist and maxdist:
+ levels = np.linspace(mindist, maxdist, number_contours)
+ contour = plt.contourf(LO, LA, dist[nsta_reqd - 1, :, :], levels=levels)
+ else:
+ contour = plt.contourf(LO, LA, dist[nsta_reqd - 1, :, :])
+ if n_off > 0:
+ plt.plot(off_lons, off_lats, "y.")
+ for i in range(n_off):
+ plt.text(off_lons[i], off_lats[i], off_stanames[i])
+ plt.plot(stalon, stalat, "r+")
+ for i in range(number_sites):
+ if (
+ stalon[i] > lonmin
+ and stalon[i] < lonmax
+ and stalat[i] > latmin
+ and stalat[i] < latmax
+ ):
+ plt.text(stalon[i], stalat[i], stanames[i])
+ plt.xlim(lonmin, lonmax)
+ plt.ylim(latmin, latmax)
+ plt.colorbar(contour)
+
+ plt.title(
+ "minimum distance to %dth station (km)" % nsta_reqd, fontsize=title_fontsize
+ )
+ if plot_cities:
+ plt.plot(clon, clat, "k8")
+ for i in range(len(cstrings)):
+ plt.text(clon[i], clat[i], cstrings[i])
+ if plot_borders:
+ for i in range(len(pdata)):
+ ndata = np.array(pdata[i])
+ plon, plat = ndata.T
+ plt.plot(plon, plat, "red")
+
+ if verbose:
+ min_mag = np.min(mag[0])
+ max_mag = np.max(mag[nsta_reqd - 1])
+ elog.notify(
+ "magnitude thresholds from %.1f to %.1f (%d stations)"
+ % (min_mag, max_mag, nsta_reqd)
+ )
+ if plot_dist and plot_mags:
+ plt.subplot(2, 1, 2)
+ if plot_mags:
+ if number_contours and minmag and maxmag:
+ levels = np.linspace(minmag, maxmag, number_contours)
+ mag_contour = plt.contourf(LO, LA, mag[nsta_reqd - 1, :, :], levels=levels)
+ else:
+ mag_contour = plt.contourf(LO, LA, mag[nsta_reqd - 1, :, :])
+ if n_off > 0:
+ plt.plot(off_lons, off_lats, "y.")
+ for i in range(n_off):
+ plt.text(off_lons[i], off_lats[i], off_stanames[i])
+
+ plt.plot(stalon, stalat, "r+")
+ for i in range(number_sites):
+ if (
+ stalon[i] > lonmin
+ and stalon[i] < lonmax
+ and stalat[i] > latmin
+ and stalat[i] < latmax
+ ):
+ plt.text(stalon[i], stalat[i], stanames[i])
+ if plot_borders:
+ for i in range(len(pdata)):
+ ndata = np.array(pdata[i])
+ plon, plat = ndata.T
+ plt.plot(plon, plat, "red")
+ if plot_cities:
+ plt.plot(clon, clat, "k8")
+ for i in range(len(cstrings)):
+ plt.text(clon[i], clat[i], cstrings[i])
+ plt.xlim(lonmin, lonmax)
+ plt.ylim(latmin, latmax)
+ plt.colorbar(mag_contour)
+ plt.title(
+ "%s detection threshold using %d stations" % (magtype, nsta_reqd),
+ fontsize=title_fontsize,
+ )
+ plt.tight_layout(pad=3.0)
if plotfilename != "":
plt.savefig(plotfilename)
diff --git a/bin/db/origin_quality/dboriginquality.1 b/bin/db/origin_quality/dboriginquality.1
index 0af2f9b3b..8546f4f1f 100644
--- a/bin/db/origin_quality/dboriginquality.1
+++ b/bin/db/origin_quality/dboriginquality.1
@@ -7,15 +7,20 @@ dboriginquality [-v] db [dbout]
.fi
.SH DESCRIPTION
-Some basic origin quality paramaters are missing in the css3.0 database definition and are thus not used.
-This script determines \fIazimuth gap\fP, \fIsecondary azimuth gap\fP, \fIminumum distance\fP, number of stations for various distances and time residuals from defining stations.
+Some basic origin quality parameters are missing in the css3.0 database definition and are thus not used.
+This script determines \fIazimuth gap\fP, \fIsecondary azimuth gap\fP, \fIminumum distance\fP, number of stations
+for various distances and time residuals from defining stations. Based on this, it is determined if the criteria for Ground Truth Events GT5 as defined by Bóndar et. al are met.
.SH OPTIONS
.IP "-v"
verbose flag
+.IP "-F"
+force reprocessing of all origins
+.IP "-S statefile"
+Start after last origin id from \fIstatefile\fP.
.IP "db"
Name of input database. This argument is required
.IP "dbout"
-Name of output database with the origqual table. If this is left out, the input database is used to save the quality paramaters.
+Name of output database with the origqual table. Default is to use input database.
.SH EXAMPLE
.nf
@@ -28,6 +33,7 @@ THis script requires the presence of the table origqual.
.SH "SEE ALSO"
.nf
antelope(1), and the database table \fBorigqual\fP.
+Bondár, Myers et al. (2004), GJI 156:483-496
.fi
.SH AUTHOR
.nf
diff --git a/bin/db/origin_quality/dboriginquality.xpy b/bin/db/origin_quality/dboriginquality.xpy
index 5cee08118..62f4ed8b7 100644
--- a/bin/db/origin_quality/dboriginquality.xpy
+++ b/bin/db/origin_quality/dboriginquality.xpy
@@ -23,7 +23,7 @@ import zamg.utilities as zu
def usage(progname):
- print(progname, "[-vn] [-F] [-p pf] [-S statefile] db [dbout]")
+ print(progname, "[-n] [-F] [-S statefile] db [dbout]")
def max_gap2(c_az):
@@ -84,7 +84,7 @@ def main():
verbose = False
try:
- opts, args = getopt.getopt(sys.argv[1:], "F:vnp:S:", "")
+ opts, args = getopt.getopt(sys.argv[1:], "vhF:S:", "")
except getopt.GetoptError:
usage(progname)
elog.die("Illegal option")
@@ -96,8 +96,6 @@ def main():
elif o == "-h":
usage(progname)
sys.exit(0)
- elif o == "-p":
- pfname = a
elif o == "-S":
statefile = a
elif o == "-F":
@@ -141,7 +139,7 @@ def main():
pattern2=["sta", "ondate::offdate"],
)
- dbj = dbj.subset("time >_2017-10-01_")
+ #dbj = dbj.subset("time >_2017-10-01_")
if statefile != "":
last_orid, last_time = zu.init_statefile(statefile)
@@ -232,7 +230,8 @@ def main():
azgap = max_gap(azimuths)
if n_times > 0:
tres_rms = math.sqrt(sqrsum / n_times)
- if nsta250 >= 10 and azgap < 110.0 and azgap2 < 160.0 and nsta30 > 0:
+ #Bondár, Myers et. al. (2004)
+ if nsta250 >= 10 and nsta30 > 0 and azgap < 110.0 and azgap2 < 160.0:
gt = 5
if dtype == "g":
if n_times > 3:
diff --git a/bin/export/db2kml_py/Makefile b/bin/export/db2kml_py/Makefile
index 3ba54b4f1..69ade9ff3 100644
--- a/bin/export/db2kml_py/Makefile
+++ b/bin/export/db2kml_py/Makefile
@@ -1,6 +1,13 @@
BIN = db2kml_py
-PF = $(BIN).pf
-MAN1 = $(BIN).1
+PF = db2kml_py.pf
+MAN1 = db2kml_py.1
+
+# images stored under $CONTRIB/data/icons
+#DATA=
+#DATADIR=
+
+#CLEAN = $(BIN) $(DATA)
SUBDIR=/contrib
+
include $(ANTELOPEMAKE)
diff --git a/bin/export/db2kml_py/db2kml_py.1 b/bin/export/db2kml_py/db2kml_py.1
index a98d5d4d8..808c883b4 100644
--- a/bin/export/db2kml_py/db2kml_py.1
+++ b/bin/export/db2kml_py/db2kml_py.1
@@ -1,91 +1,1186 @@
.TH DB2KML_PY 1 "$Date$"
.SH NAME
-db2kml_py \- pretty-print station and/or origin data as KML or KMZ
+db2kml_py \- plot station and/or origin data as KML or KMZ
.SH SYNOPSIS
.nf
-\fBdb2kml_py \fP[-vxt] [-p pf_file] dbname file.kml
+\fBdb2kml_py \fP[-dvqt] [-c {stations,origins,all}] [-p pf_file] [-opm field:model] [-z [-k] ] dbname kmlfile
.fi
.SH SUPPORT
Contributed: NO BRTT support -- please contact author.
.SH DESCRIPTION
-This text is grabbed pretty much verbatim from the db2kml manpage
-with a few changes when needed.
-
-\fBdb2kml_py\fP prints a file of placemarks in kml
-(Keyhole Markup Language) suitable for Google Earth and a growing
-number of other programs. The placemarks can be for origin or site
-information extracted from the specified database.
-
-In GE, each event will display its magnitude and date when moused
-over. Selecting the event will bring up a menu with more detailed
-information. Each point is also tagged with a kml tag.
-In recent versions of Google Earth (> v4.0) it is possible to "play"
-the events in time using the time slider bar. The time slider bar
-can also be used to adjust the start and end dates of the events
-being displayed. There is no limit on the number of sites or events
-that can be processed, however at present GE bogs down on more than
-a few thousand aplacemarks.
-
-The icons for the placemarks and the depth-magnitude scale must
-reside in a web accessible location. A provisional location is
-included in the parameter file though users are encouraged to modify
-this for any heavy use. Please read the note about servers below.
+\fBdb2kml_py\fP generates a KML (Keyhole Markup Language) file
+or zipped archive containing a KML file and associated image files.
+The output is suitable for Google Earth and other programs.
+Currently the placemarks are derived from origin or site
+information extracted from \fIdbname\fP, the specified database.
+
+The icons used for the placemarks for the stations and
+origins must either a) reside in a web accessible location:
+either on a locally run webserver or api, or served by some
+other web accessible location or b) be accessible images located
+on your file system. If the kml is to be used outside of your
+file system, for off-line users, or if it relies heavily on
+api generated placemarks, it is strongly recommended that the
+output you produce is a kmz file, which will include a bundle
+of all of the images. A provisional example api access point
+is included in the parameter file, however users are strongly
+encouraged to point at a more robust api for any heavy use.
+Some sample icons referred to in the parameter file are
+available under $ANTELOPE/contrib/data/icons/.
+
+The origin placemarks can be colored by depth and sized
+by magnitude if using an applicable api interface. Static images
+can be scaled by magnitude of the origin (if netmag.magnitude
+exists).
+
+When origin plotting has been chosen, each event displays
+its time, location, depth, magnitude and author when
+selected on the map as displayed in Google Earth.
+
+For station plotting, the snet_sta, staname, latitude, longitude,
+elevation, ondate, and offdate are shown when selected on the map.
+The option to show/hide station name labels is configurable in the
+\fIpf_file\fP.
+
+Each plotted event or site can be optionally tagged with a kml
+ tag. This makes it possible to "play" a time history
+of sites and origins using the time slider bar, or allows adjustment
+of the display to only show stations and events active during a
+chosen time window. Responsiveness may suffer if too many placemarks
+exist in your KML file.
+
+The parameter file is not backwards compatible with previous versions
+of \fIdb2kml_py\fP that ran using Python2. Many features of the output
+kml file are adjustable by modifying the parameter file. See the
+PARAMETER FILE section below for details.
+
.SH OPTIONS
-.IP -v
-verbose output
+.IP "-c stations|origins|all"
+Choose what to plot. If not specified, the default is to plot both
+stations and origins.
+
+.IP -d
+Debug, aka very verbose output. You really do not want to see
+all of this unless you are debugging the code.
-.IP -x
-debug aka very verbose output
+.IP -k
+Keep temporary directory of image files generated for kmz (useful only for
+debugging). Only valid if \fI-z\fP option is used.
-.IP -t
-file type to output - not currently implemented
+.IP "-opm field:model"
+Use a user configured set of parameters as defined in
+the {styles}{origins}{placemarks} section of the PARAMETER FILE. If not
+specified, the default settings are used (red cicrles).
+Currently the only options for field are \fIdepth\fP or \fImagnitude\fP.
+The model refers to the {styles}{origins}{placemarks}{field}{model} in
+the PARAMETER FILE (i.e. api_ms_dd). See EXAMPLES.
.IP "-p pf_file"
-use pf_file instead of the default pf file.
+Use \fIpf_file\fP instead of the default pf file. Note that whatever
+pf file you use, at the very least you must have edited the \fIheaders\fP
+section.
+
+.IP "-t"
+Interrupt creation of \fIkmlfile\fP to create output kmz called
+\fIlogotest.kmz\fP. Useful in combination with \fI-v\fP to debug
+logo/overlay placements as well as initial camera/zoom. The output
+file \fIlogotest.kmz\fP should be reviewed with Google Earth to
+verify that logos are placed as expected within map view. Cleanup
+is left to the user. NOTE: This is a debugging tool and the full
+KML/KMZ file, \fIkmlfile\fP will NOT be created!!!
+
+.IP -q
+Quiet all output from the script
+
+.IP -v
+Verbose output
+
+.IP -z
+Generate kmz archive format file, \fIkmlfile\fP.kmz. Images used for kmz
+file generation will be written to a temporary directory like
+/tmp/kmzimgs1a2b3c4 and removed after normal program exit, unless the
+\fI-k\fP option is used.
+
+.IP dbname
+Database descriptor file which should point to both station
+and event information. For station plotting, the script can take an
+optional \fIdeployment\fP table, but normally requires a site table.
+For event plotting, \fIorigin\fP, \fIevent\fP, and \fInetmag\fP tables are
+required.
+
+.IP kmlfile
+Name of output file to create. If no trailing .kml/.kmz is
+given, it will be added when file is written. When the
+\fI-z\fP option is programmed, it will take this output
+file name and generate \fIkmfile.kmz\fP, a KMZ archive.
.SH PARAMETER FILE
-The parameter file contains many more variables than currently
-available in db2kml. These various parameters allow the user
-to customize the metadata and output for their institution.
-The user can also define complex Datascope expressions for
-getting just the view they want. You can also choose to output
-a kmz file (compressed kml) rather than kml if desired, and define
-a network link if the kml source will update automatically and
-you want users of your file to have their content auto-update over
-the network.
+The parameter file contains many options that allow the user
+to customize the output kml. You must modify the default
+parameter file for your institution! In particular, the
+script will exit if you have not modified the \fIheaders\fP
+section.
+
+A default parameter file is included below, followed by a
+section-by-section more detailed explanation of the parameters.
+
+.LP
+The parameter file has three special functions and four main
+sections: \fIheaders\fP, \fIconfig\fP, \fIoverlays\fP,
+and \fIstyles\fP. Each section has components that may
+require customization.
+
+.LP
+The \fIheaders\fP section is unique to each
+individual data center. This is where the \fIname\fP and
+\fIdescription\fP of the information you are
+plotting is held. It also allows for configuration of a
+link for the user to auto-refresh their kml file if you
+regenerate the kml file regularly. If you have not modified
+the name and description fields, the script will exit with a
+fatal error.
+
+.LP
+There are two sections in the \fIconfig\fP portion of the
+parameter file: \fIstations\fP and \fIorigins\fP.
+In general, the \fIconfig\fP section puts limitations on what
+stations or origins will be plotted, whether or not to include
+time history availability (i.e. adds a time slider when viewing
+on Google Earth), label/text visibility of station name
+on the map view and precision of station coordinates. Styling
+for these placemarks/map points is controlled in the \fIstyles\fP section.
+
+.LP
+The \fIoverlays\fP section may look intimidating, but is a
+highly customizable method for displaying logos or images on the
+kml file you produce.
+
+.LP
+The \fIstyles\fP section contains configurable information for
+both the \fIorigins\fP and \fIstations\fP placemarks that
+are included in the kml file. The \fIstyles\fP section is
+where you could configure the color and shape of the icons
+used in the map view.
+
+.in 2c
+.ft CW
+.nf
+.ps 8
+
+# default db2kml.pf
+
+# special functions for later use in pf:
+antelope &env(ANTELOPE)
+
+# convenient shorthand for use in station and origin styles
+imagedir &{antelope}/contrib/data/icons # location for some default icons
+local_imagedir &{antelope}/contrib/data/icons # modify this to point to your own saved icon/image directory
+
+
+headers &Arr{
+ name Change Name Here or script will die!!
+ description &Literal{
+ Your network described here
+
+ Website: http://somewhere.edu
+ Author: db2kml_py
+ Contact:
+ }
+
+ network_link &Arr{
+ ignore yes # yes/no. no = include the network link, yes = do not include a network link
+ link somelinkhere
+ name A placeholder for now
+ expires 86400 # refresh daily, every 86400
+ }
+
+ camera &Arr{
+ # A default view when initially loaded, defaults are southern California
+ # may be different than the focal point chosen by look_at for stations and/or origins
+ latitude 31.9
+ longitude -116.6
+ altitude 280000 # height above sea level, in meters (unlike range in lookat)
+ tilt 30
+
+ }
+
+}
+
+config &Arr{
+ stations &Arr{
+ use_deployment no # use deployment table for active check, default is to use site table
+ display_inactive no
+ indicate_when yes # include a "when" based on ondate/offdate so slider bar/animation can be used
+ suppress_label no # don't include station name text on map
+ precision 4 # how many decimal places to display for station coordiantes
+ # i.e. precision 2 will produce XX.XX and XXX.XX
+ # i.e. precision 4 will produce XX.XXXX and XXX.XXXX as available
+
+ subsets &Tbl{
+ #sta =~ /.*/ && snet =~ /.*/
+ sta =~ /.*/ && snet != 'CI'
+ }
+ sort_fields &Tbl{
+ snet
+ sta
+ }
+ }
+
+
+ origins &Arr{
+
+ indicate_when no # include a "when" based on ondate/offdate so slider bar/animation can be used
+
+ prefor_only yes # only plot prefor origins, no = all origins will be plotted
+
+ subsets &Tbl{
+ #distance(lat,lon,33.3,-116.5) <= 5.0
+ time>='1/01/2023'
+ #magnitude>='1.5'
+ }
+ sort_fields &Tbl{
+ time
+ }
+ }
+}
+
+overlays &Arr{
+ logo &Arr{
+
+ plotthis yes
+
+ imgsrc &{imagedir}/google_map_anza_icon.png
+ name Anza logo
+ rotation 0 # value in degrees counterclockwise 0 = north, 90 = rotate left, -90 = rotate right
+
+ overlayXY &Arr{
+ # what point on your image is mapped to a screen coordinate
+ # (i.e. where you place the thumbtack in a piece of paper to be stuck to the bulletin board
+ # - not where you stick it on the board)
+ #
+ # See https://developers.google.com/kml/documentation/kmlreference#screenoverlay
+ # (x,y) = (0,0) would be lower left
+ x 0 # coordinate origin is lower left corner
+ y 0 # coordinate origin is lower left corner,
+ xunits fraction # fraction(x,y 0.0->1.0), pixels(number)
+ yunits fraction # fraction(x,y 0.0->1.0), pixels(number)
+ }
+ screenXY &Arr{
+ # where your image is mapped to
+ # (i.e. where your paper with the thumbtack in it is stuck on the bulletin board)
+ #
+ # See https://developers.google.com/kml/documentation/kmlreference#screenoverlay
+ # (x,y) = (0,0) would be lower left
+ x 0.5 # coordinate origin is lower left corner
+ y 0.90 # coordinate origin is lower left corner
+ xunits fraction # fraction(x,y 0.0->1.0), pixels(number)
+ yunits fraction # fraction(x,y 0.0->1.0), pixels(number)
+ }
+
+ size &Arr{
+ x 0 # -1 = native, 0 = maintain aspect ratio, n set value of dimension
+ y 0 # -1 = native, 0 = maintain aspect ratio, n set value of dimension
+ # to force image to recise to 100px by 500px, x = 100, y = 500, xunits,yunits = pixels
+ xunits pixels # fraction, pixels
+ yunits pixels # fraction, pixels
+
+ }
+
+ }
+
+ fancylogo &Arr{
+
+ plotthis yes
+
+ imgsrc &{imagedir}/ANZA-logo-small.png
+ name Fancy Anza logo
+ rotation 0 # value in degrees counterclockwise 0 = north, 90 = rotate left, -90 = rotate right
+
+ overlayXY &Arr{
+ # what point on your image is mapped to a screen coordinate
+ # (i.e. where you place the thumbtack in a piece of paper to be stuck to the bulletin board
+ # - not where you stick it on the board)
+ #
+ # See https://developers.google.com/kml/documentation/kmlreference#screenoverlay
+ # (x,y) = (0,0) would be lower left
+ x 0 # coordinate origin is lower left corner
+ y 0 # coordinate origin is lower left corner,
+ xunits fraction # fraction, pixels
+ yunits fraction # fraction, pixels
+ }
+ screenXY &Arr{
+ # where your image is mapped to
+ # (i.e. where your paper with the thumbtack in it is stuck on the bulletin board)
+ #
+ # See https://developers.google.com/kml/documentation/kmlreference#screenoverlay
+ # (x,y) = (0,0) would be lower left
+ x 15 # coordinate origin is lower left corner
+ y 15 # coordinate origin is lower left corner,
+ xunits pixels # fraction(x,y 0.0->1.0), pixels(number)
+ yunits pixels # fraction(x,y 0.0->1.0), pixels(number)
+ }
+
+ size &Arr{
+ x 0 # -1 = native, 0 = maintain aspect ratio, n set value of dimension
+ y 0 # -1 = native, 0 = maintain aspect ratio, n set value of dimension
+ # to force image to recise to 100px by 500px, x = 100, y = 500, xunits,yunits = pixels
+ xunits pixels # fraction, pixels
+ yunits pixels # fraction, pixels
+
+ }
+
+ }
+
+}
+
+
+styles &Arr{
+
+ stations &Arr{
+
+ look_at &Arr{
+ # Some default view when initially loaded, defaults are southern California
+ latitude 33.3
+ longitude -116.5
+ range 280000 # height above sea level
+ }
+
+ by_network &Arr{
+ # stations will be grouped by snet. Define your Arrays by snet (i.e. AZ, PY, XX, MA, etc.)
+ # do not completely remove the "others" defined array. Changing scale or imagesrc is ok
+ AZ &Arr{
+ scale 0.6
+ #imagesrc &{imagedir}/red_triangle.png
+ # api generated image instead of saved image
+ imagesrc http://anf.ucsd.edu/api/anza/mapimg/?transparency=1%26shape=triangle%26fillcolor=purple%26outline=yes26shadow=yes
+ }
+ PY &Arr{
+ scale 0.6
+ imagesrc &{imagedir}/yel_triangle.png
+ }
+ YN &Arr{
+ scale 0.6
+ imagesrc &{imagedir}/red_triangle.png
+ }
+ others &Arr{ # DO NOT rename this "others" network, changing scaling, imagepath or href is ok
+ scale 0.6
+ imagesrc &{imagedir}/wht_triangle.png
+ }
+ }
+ }
+
+ origins &Arr{
+
+ look_at &Arr{
+ # Some default view when initially loaded
+ latitude 33.3
+ longitude -116.5
+ range 280000 # height above sea level
+ }
+
+
+ # please change this to your own api. Access to the UCSD api may go away at any time
+ api_url http://anf.ucsd.edu/api/anza/mapimg/ # this gives a green (aaeeaa) triangle with a border (eww, but basic)
+
+ api_params &Arr{ # parameters in each named array are specific to the api in use
+
+ default &Arr{
+ # below are the params you can add to the api url to modify the symbol produced
+ bgcolor transparent # change to a color if you want icon to appear as square with filled in color
+ fillcolor red # colorname: for HSV colors, you can precede color code with "%23", i.e. %2340FFFF will be a light blue)
+ linecolor black # change to fillcolor if you want no outline for your symbol
+ size 24 # the default size is 24, use of magscale will alter this
+ transparency 0.75
+ shadow true # true/false
+ shape circle # valid shapes for UCSD api: circle, square, square-round, ellipse, diamond,
+ # star, triangle, equitrianagle, parallelogram, trapezoid
+ }
+
+ dynamic_depth &Arr{
+ # this is a special array that looks at the mappings of color to depth that are defined in depthcolor
+ bgcolor transparent # change to a color if you want icon to appear as square with filled in color
+ fillcolor depthcolor # colorname: for HSV colors, precede color code with "%23", i.e. %2340FFFF will be a light blue)
+ linecolor depthcolor # change to fillcolor if you want no outline for your symbol
+ size 24 # the default size is 24, use of magscale will alter this
+ transparency 0.75
+ shadow true # true/false
+ shape circle # valid shapes for UCSD api: circle, square, square-round, ellipse, diamond,
+ # star, triangle, equitrianagle, parallelogram, trapezoid
+ }
+
+ purple_star &Arr{
+ # below are the params you can add to the api line to modify the symbol produced
+ bgcolor transparent # change to a color if you want icon to appear as square with filled in color
+ fillcolor purple # colorname: for HSV colors, you can precede color code with "%23", i.e. %2340FFFF will be a light blue)
+ linecolor black # change to fillcolor if you want no outline for your symbol
+ size 24 # the default size is 24, use of magscale will alter this
+ transparency 0.75
+ shadow true # true/false
+ shape star # valid shapes for UCSD api: circle, square, square-round, ellipse, diamond,
+ # star, triangle, equitrianagle, parallelogram, trapezoid
+ }
+
+ red_square &Arr{
+ # below are the params you can add to the api line to modify the symbol produced
+ bgcolor transparent # change to a color if you want icon to appear as square with filled in color
+ fillcolor red # colorname: for HSV colors, you can precede color code with "%23", i.e. %2340FFFF will be a light blue)
+ linecolor black # change to fillcolor if you want no outline for your symbol
+ size 24 # the default size is 24, use of magscale will alter this
+ transparency 0.75
+ shadow true # true/false
+ shape square # valid shapes for UCSD api: circle, square, square-round, ellipse, diamond,
+ # star, triangle, equitrianagle, parallelogram, trapezoid
+ }
+
+ orange_circle &Arr{
+ # below are the params you can add to the api line to modify the symbol produced
+ bgcolor transparent # change to a color if you want icon to appear as square with filled in color
+ fillcolor orange # colorname: for HSV colors, you can precede color code with "%23", i.e. %2340FFFF will be a light blue)
+ linecolor black # change to fillcolor if you want no outline for your symbol
+ size 24 # the default size is 24, use of magscale will alter this
+ transparency 0.75
+ shadow true # true/false
+ shape circle # valid shapes for UCSD api: circle, square, square-round, ellipse, diamond,
+ # star, triangle, equitrianagle, parallelogram, trapezoid
+ }
+ }
+
+ depthcolor &Arr{ # dynamic depth colorization requires api, mag sizing does not
+ # depth fillcolor
+ -5 3F3F3F # grey, very negative depth
+ 0 BFFFFF
+ 6 00DFFF
+ 10 000080 # greyblue
+ 20 03ff03
+ 30 FFE800 # yellow-organge
+ 40 FE9400
+ 60 FF0000 # red
+ 100 FF00B2
+ 200 FF00F7 # fuchia
+ 300 B000B3
+ 400 8E00FE # purple
+ 600 4C0066 # dk. purple
+ 800 000000 # black
+ }
+
+
+ magscale &Arr{ # magnitude scaling can be applied to either api generated or static image
+ # magnitude scale_factor
+ -2 0.4 # this will also be used for events with no calculated magnitude
+ 0 0.6
+ 1 0.8
+ 2 1.0
+ 3 1.7
+ 4 2.2
+ 5 3.0
+ 6 3.6
+ 7 4.4
+ 8 5.5
+ 9 6.0
+ 10 6.2
+ }
+
+ placemarks &Arr{
+
+ default &Arr{
+ imgsrc &{imagedir}/vsm_red_circle.png
+ scale 0.7
+ }
+
+ depth &Arr{
+
+ # if depthcolor is used in the api_params (i.e. in dynamic_depth), but the listed depths
+ # do not have corresponding value defined in depthcolor, then:
+ # a best guess to the next closest color-depth mapping will be chosen.
+
+ api_ms_dd &Tbl{ # case1a - api image, mag scaling, dynamic depth colorization
+ #
+ # depth scalefactor imgsrc api_params(optional)
+ # #1 or magsacle #file or url for api # blank or api_params reference
+ -5 magscale &{api_url} dynamic_depth
+ 0 magscale &{api_url} dynamic_depth
+ 6 magscale &{api_url} dynamic_depth
+ 10 magscale &{api_url} dynamic_depth
+ 20 magscale &{api_url} dynamic_depth
+ 30 magscale &{api_url} dynamic_depth
+ 40 magscale &{api_url} dynamic_depth
+ 60 magscale &{api_url} dynamic_depth
+ 100 magscale &{api_url} dynamic_depth
+ 200 magscale &{api_url} dynamic_depth
+ 300 magscale &{api_url} dynamic_depth
+ 400 magscale &{api_url} dynamic_depth
+ 600 magscale &{api_url} dynamic_depth
+ 800 magscale &{api_url} dynamic_depth
+ }
+
+ api_no_ms &Tbl{ # case1b - api image, no mag scaling, dynamic depth colorization
+ #
+ # depth scalefactor imgsrc api_params(optional)
+ # #1 or magsacle #file or url for api # blank or api_params reference
+ -5 0.5 http://anf.ucsd.edu/api/anza/mapimg/ dynamic_depth
+ 0 0.5 http://anf.ucsd.edu/api/anza/mapimg/ dynamic_depth
+ 6 0.5 http://anf.ucsd.edu/api/anza/mapimg/ dynamic_depth
+ 10 0.5 http://anf.ucsd.edu/api/anza/mapimg/ dynamic_depth
+ 20 0.5 http://anf.ucsd.edu/api/anza/mapimg/ dynamic_depth
+ 30 0.5 http://anf.ucsd.edu/api/anza/mapimg/ dynamic_depth
+ 40 0.5 http://anf.ucsd.edu/api/anza/mapimg/ dynamic_depth
+ 60 0.5 http://anf.ucsd.edu/api/anza/mapimg/ dynamic_depth
+ 100 0.5 http://anf.ucsd.edu/api/anza/mapimg/ dynamic_depth
+ 200 0.5 http://anf.ucsd.edu/api/anza/mapimg/ dynamic_depth
+ 300 0.5 http://anf.ucsd.edu/api/anza/mapimg/ dynamic_depth
+ 400 0.5 http://anf.ucsd.edu/api/anza/mapimg/ dynamic_depth
+ 600 0.5 http://anf.ucsd.edu/api/anza/mapimg/ dynamic_depth
+ 800 0.5 http://anf.ucsd.edu/api/anza/mapimg/ dynamic_depth
+ }
+
+ static_ms &Tbl{ # case2a - static file (no depth colorization) + mag scaling
+ #
+ # depth scalefactor imgsrc api_params(optional)
+ # #1 or magscale #file or url for api # blank or api_params reference
+ -5 magscale &{imagedir}/red_star_nooutline.png
+ -4 magscale &{imagedir}/red_star_nooutline.png
+ 0 magscale &{imagedir}/red_star_nooutline.png
+ 6 magscale &{imagedir}/red_star_nooutline.png
+ 10 magscale &{imagedir}/red_star_nooutline.png
+ 20 magscale &{imagedir}/orange_star_nooutline.png
+ 30 magscale &{imagedir}/orange_star_nooutline.png
+ 40 magscale &{imagedir}/orange_star_nooutline.png
+ 60 magscale &{imagedir}/orange_star_nooutline.png
+ 100 magscale &{imagedir}/orange_star_nooutline.png
+ 200 magscale &{imagedir}/orange_star_nooutline.png
+ 300 magscale &{imagedir}/orange_star_nooutline.png
+ 400 magscale &{imagedir}/purple_star_nooutline.png
+ 600 magscale &{imagedir}/purple_star_nooutline.png
+ 800 magscale &{imagedir}/purple_star_nooutline.png
+ }
+
+ static_nos &Tbl{ # case2b - use canned/static images which vary in color (or not) for a given depth, no scaling
+
+ # depth scalefactor imgsrc api_params(optional)
+ -5 1 &{imagedir}/red_star_nooutline.png
+ -4 1 &{imagedir}/red_star_nooutline.png
+ 0 1 &{imagedir}/red_star_nooutline.png
+ 6 1 &{imagedir}/orange_star_nooutline.png
+ 10 1 &{imagedir}/yellow_star_nooutline.png
+ 20 1 &{imagedir}/yellow_star_nooutline.png
+ 30 1 &{imagedir}/green_star_nooutline.png
+ 40 1 &{imagedir}/green_star_nooutline.png
+ 60 1 &{imagedir}/green_star_nooutline.png
+ 100 1 &{imagedir}/purple_star_nooutline.png
+ 200 1 &{imagedir}/purple_star_nooutline.png
+ 300 1 &{imagedir}/purple_star_nooutline.png
+ 400 1 &{imagedir}/purple_star_nooutline.png
+ 600 1 &{imagedir}/purple_star_nooutline.png
+ 800 1 &{imagedir}/purple_star_nooutline.png
+ }
+
+ }
+
+ magnitude &Arr{
+
+ api_ms &Tbl{ # case3 - api dynamic scaling based on default magscale, no depth colorization, symbol shape/color differentiated via api call
+ # mag scalefactor imgsrc api_params(optional)
+ -3 magscale http://anf.ucsd.edu/api/anza/mapimg/ orange_circle
+ 0 magscale http://anf.ucsd.edu/api/anza/mapimg/ orange_circle
+ 1 magscale http://anf.ucsd.edu/api/anza/mapimg/ orange_circle
+ 2 magscale http://anf.ucsd.edu/api/anza/mapimg/ orange_circle
+ 3 magscale http://anf.ucsd.edu/api/anza/mapimg/ red_square
+ 4 magscale http://anf.ucsd.edu/api/anza/mapimg/ red_square
+ 5 magscale http://anf.ucsd.edu/api/anza/mapimg/ purple_star
+ 6 magscale http://anf.ucsd.edu/api/anza/mapimg/ purple_star
+ 7 magscale http://anf.ucsd.edu/api/anza/mapimg/ purple_star
+ 8 magscale http://anf.ucsd.edu/api/anza/mapimg/ purple_star
+ 9 magscale http://anf.ucsd.edu/api/anza/mapimg/ purple_star
+ 10 magscale http://anf.ucsd.edu/api/anza/mapimg/ purple_star
+ }
+
+ static_ms &Tbl{ # case4a - static file with dynamic scaling based on default magscale, no depth colorization
+ # mag scalefactor imgsrc api_params(optional)
+ -3 magscale &{imagedir}/orange_star_nooutline.png
+ 0 magscale &{imagedir}/orange_star_nooutline.png
+ 1 magscale &{imagedir}/orange_star_nooutline.png
+ 2 magscale &{imagedir}/orange_star_nooutline.png
+ 3 magscale &{imagedir}/red_star_nooutline.png
+ 4 magscale &{imagedir}/red_star_nooutline.png
+ 5 magscale &{imagedir}/red_star_nooutline.png
+ 6 magscale &{imagedir}/red_star_nooutline.png
+ 7 magscale &{imagedir}/red_star_nooutline.png
+ 8 magscale &{imagedir}/red_star_nooutline.png
+ 9 magscale &{imagedir}/red_star_nooutline.png
+ 10 magscale &{imagedir}/red_star_nooutline.png
+ }
+
+ static_nos &Tbl{ # case4b - static files (based on color or magnitude?), no magnitude scaling
+ # mag scalefactor imgsrc api_params(optional)
+ -3 1 &{imagedir}/orange_star_nooutline.png
+ 0 1 &{imagedir}/orange_star_nooutline.png
+ 1 1 &{imagedir}/orange_star_nooutline.png
+ 2 1 &{imagedir}/orange_star_nooutline.png
+ 3 1 &{imagedir}/red_star_nooutline.png
+ 4 1 &{imagedir}/red_star_nooutline.png
+ 5 1 &{imagedir}/red_star_nooutline.png
+ 6 1 &{imagedir}/red_star_nooutline.png
+ 7 1 &{imagedir}/red_star_nooutline.png
+ 8 1 &{imagedir}/red_star_nooutline.png
+ 9 1 &{imagedir}/red_star_nooutline.png
+ 10 1 &{imagedir}/red_star_nooutline.png
+ }
+
+ }
+
+
+ auth &Arr{ # not programmed yet, placeholder
+ static_auth_ms &Arr{
+ #
+ # auth scalefactor imgsrc
+ # #1 or magsacle #file or url for api
+ UCSD magscale &{imagedir}/orange_star_nooutline.png
+ USGS magscale &{imagedir}/red_star_nooutline.png
+ }
+ }
+ }
+ }
+}
+
+pf_revision_time 1681501519
+
+.ps
+.fi
+.ft R
+.in
+
+.LP
+The three speical pf functions are: \fIantelope\fP, \fIimagedir\fP,
+and \fIlocal_imagedir\fP. They use the rules described in pf(5) and
+are expanded when referenced later in the pf file.
+
+.IP \fIantelope\fP
+A way to pull in the current version of Antelope.
+
+.IP \fIimagedir\fP
+The default location for example icons available to \fBdb2kml_py\fR.
+This is normally $ANTELOPE/contrib/data/icons. Modifications
+to this may cause default plotting symbols to go missing. Instead,
+change \fIlocal_imagedir\fP.
+
+.IP \fIlocal_imagedir\fP
+A institution-specific default location for icons
+available to \fBdb2kml_py\fR. The default is set to be the
+same as \fIimagedir\fP as a placeholder. This can be
+referenced later when constructing styles for \fIstations\fP
+or \fIorigins\fP.
+
+.LP
+The \fIheaders\fP section must be customized for your data
+center to include a proper name and description. You MUST modify
+the \fIname\fP and \fIdescription\fP for your data center. If the default
+values are found in the parameter file, the script will exit.
+Use a \fInetwork_link\fP if you plan to make regular updates to
+the kml/kmz file. The \fInetwork_link\fP section must show up
+in the parameter file, but you can skip adding it to the kml file
+if \fIignore\fP is set. The \fIcamera\fP section forces the view
+to shift to a given coordinate upon opening the \fIkmlfile\fP in
+Google Earth.
+
+.IP \fIname\fP
+Descriptive string that will be used as the title of your kml
+file via the listview in Google Earth. No quotes needed. Required.
+
+.IP \fIdescription\fP
+Text information that will appear in a pop-up window giving further
+details about the kml file. Can be used to describe network, provide
+a url for further information, provide contact information, etc. Supports
+html markup. For example, to insert newlines at a particular place, include
+a as needed. Required.
+
+.IP \fInetwork_link\fP
+Details if an updated kml is maintained and you want users to
+have content auto-updated. Refresh mode is "on request".
+Minimum refresh request period is 300 seconds. Can be excluded from the
+headers section.
+
+.RS 0.5i
+.IP \fIignore\fP
+Skip adding any \fInetwork_link\fP to the ouput kml/kmz.
+
+.IP \fIlink\fP
+Accessible URL where updated versions of your kml reside.
+
+.IP \fIname\fP
+Descriptive name for the updating kml. Not required, but best
+practice would be to use something different than \fIname\fP in
+\fIheaders\fP.
+
+.IP \fIexpires\fP
+Time in seconds after script is run after which the link should
+be refreshed. Should likely coordinate with update interval
+for linked kml file. Link will refresh when time of script
+excecution + \fIexpires\fP is reached.
+
+.RE
+
+.IP \fIcamera\fP
+.RS 0.5i
+.IP \fIlatitude\fP|\fIlongitude\fP
+Coordinates in decimal degrees.
+.IP \fIaltitude\fP
+View height above sea level, in meters.
+.RE
+
+.LP
+The \fIconfig\fP section customzies what points will be included
+in the kml file for both \fIstations\fP and \fIorigins\fP. All
+of these parameters are required, but the \fIsubsets\fP section
+can be left blank or with commented out lines. Note that there
+are different parameters required for either \fIstations\fP or \fIorigins\fP.
+
+.LP
+Parameters from the \fIconfig:stations\fP section of the parameter file are:
+
+.IP \fIuse_deployment\fP
+Boolean yes/no to indicate if the deployment table should be used
+instead of the site table when determining active/inactive status.
+The default is no.
+
+.IP \fIdisplay_inactive\fP
+Boolean yes/no to indicate if inactive stations should be included.
+
+.IP \fIindicate_when\fP
+Boolean yes/no to indicate if each station should include a timestamp that
+would allow for time slider bar usage when viewing in Google Earth. Caveat:
+once generated, there seems to be no way to remove the display of the slider
+bar when running Google Earth.
+
+.IP \fIsuppress_label\fP
+Boolean yes/no to indicate if text labels should be shown in the map view
+in Google Earth (value = no) or labels should not appear (value = yes).
+
+.IP \fIprecision\fP
+Numeric value indicating how many decimal places to display for station
+coordinates (i.e. precision 2 will produce lat/lon like XX.XX/XXX.XX).
+Perhaps useful if you want to obfuscate the exact location of your station.
+
+.IP \fIsubsets\fP
+Datascope expressions to be applied to the joined deployment or site and
+snetsta tables.
+
+.IP \fIsort_fields\fP
+Ordered list to indicate sorting of merged tables. Not well tested.
+
+.LP
+Parameters from the \fIconfig:origins\fP section of the parameter file are:
+
+.IP \fIindicate_when\fP
+Boolean yes/no to indicate if each station should include a timestamp that
+would allow for time slider bar usage when viewing in Google Earth. Caveat:
+once generated, there seems to be no way to remove the display of the slider
+bar when running Google Earth.
+
+.IP \fIsubsets\fP
+Datascope expressions to be applied to the joined origin and netmag tables.
+Caveat: currently, the code is hard-coded to only plot the prefor for every event.
+
+.IP \fIsort_fields\fP
+Ordered list to indicate sorting of merged tables. Not well tested.
+
+.LP
+The \fIoverlays\fP section of the parameter file is an array of user-named
+arrays. An overlay is an image that can be included in the kml file, such
+as a logo or banner that will be displayed when the kml file is viewed in
+Google Earth. In order for ease of testing of logo placement in an output
+kml file, make use of the \fI-t\fP option that causes full production of a
+kml/kmz file to halt, instead creating a smaller kmz file, default name of
+\fIlogotest.kmz\fP, with only header and overlay information included.
+Such testing is highly recommended during initial runs of \fIdb2kml_py\fP when debugging
+placement of your logo.
+
+.LP
+Each label for the user-named array should be unique and every
+named overlay array needs to have all of the following parameters:
+
+.IP \fIplot_this\fP
+Boolean yes/no to indicate if this overlay should be plotted. Normally always
+set to yes, but there may be instances where you want to produce a kml file
+with no logos without destroying all of the configuration you have already
+saved in your updated parameter file.
+.IP \fIimgsrc\fP
+A url or filename with path of the image to include.
+
+.IP \fIname\fP
+A text label that will show up in the list view. Should be unique among
+each individual overlay. Can contain spaces.
+
+.IP \fIrotation\fP
+Value between +-180. Measured in degrees counterclockwise (KML construct).
+So 0 = north/no rotation, 90 = rotate left, -90 = rotate right.
+
+.IP \fIoverlayXY\fP
+A construct for KML that indicates what point on your image is mapped to
+a screen coordinate. My visualization is that the overlay is like a piece
+of paper to be attached to a bulletin board. This parameter controls where
+you place the thumbtack in the piece of paper to be stuck to the bulletin board
+- not where you stick it on the board. See:
+https://developers.google.com/kml/documentation/kmlreference#screenoverlay
+
+.RS 0.5i
+.IP \fIx\fP|\fIy\fP
+The x and y coordinates that indicate anchor point of your overlay.
+The coordinate origin is in the lower left corner (x,y) = (0,0)
+would be lower left.
+
+.IP \fIxunits\fP|\fIyunits\fP
+The units for \fIx\fP and \fIy\fP. Must be either 'fraction' or 'pixels'. If
+fraction is chosen, \fIx\fP and \fIy\fP must range from 0.0 to 1.0. If unit
+is pixels, \fIx\fP and \fIy\fP must be a number.
+.RE
+
+.IP \fIscreenXY\fP
+A construct for KML that indicates where your image is mapped to.
+Continuing with the piece of paper stuck to a bulletin board concept, this
+is where you place the piece of paper with the thumbtack on your bulletin
+board (the view window for the map). Note that it is possible for your
+overlay to extend over the edge of the visible bounding box. Consider
+using test mode \fI-t\fP to make sure you have your parameters set correctly.
+See https://developers.google.com/kml/documentation/kmlreference#screenoverlay
+
+
+.RS 0.5i
+.IP \fIx\fP|\fIy\fP
+The x and y coordinates that anchor placement of your overlay. The coordinate
+origin is in the lower left corner (x,y) = (0,0) would be lower left.
+
+.IP \fIxunits\fP|\fIyunits\fP
+The units for \fIx\fP and \fIy\fP. Must be either 'fraction' or 'pixels'. If
+fraction is chosen, \fIx\fP and \fIy\fP must range from 0.0 to 1.0. If units
+are pixels, \fIx\fP and \fIy\fP are a number.
+.RE
+
+.IP \fIsize\fP
+A KML construct for scaling the overlay image.
+
+.RS 0.5i
+.IP \fIx\fP|\fIy\fP
+A value of -1 indicates to use the native dimenion. A value of 0 indicates to maintain
+the aspect ration. A value of n sets the value of the dimension.
+
+.IP \fIxunits\fP|\fIyunits\fP
+The units for \fIx\fP and \fIy\fP. Must be either 'fraction' or 'pixels'. For example,
+to force the image to resize to 200px by 500px: \fIx\fP = 200, \fIy\fP = 500, and
+\fIxunits\fP and \fIyunits\fP = pixels. Not well tested.
+
+.RE
+
+.LP
+The \fIstyles\fP section of the parameter file contains two arrays,
+\fIstations\fP and \fIorigins\fP. They have been separated from
+the \fIconfig\fP section as these are kml style specific parameters.
+This is where you are going to specify the symbols used for your
+site or origin placemarks displayed in the kml file. Both the
+\fIstations\fP and \fIorigins\fP arrays have the following parameters in common:
+
+.IP \fIlook_at\fP
+An array contining coordinates and height (\fIrange\fP) that controls where your
+camera view will zoom to when the kml is initially loaded.
+.RS 0.5i
+.IP \fIlatitude\fP|\fIlongitude\fP
+Coordinates in decimal degrees.
+.IP \fIrange\fP
+View height above sea level, in meters.
+.RE
+
+.LP
+For the \fIstations\fP styling, the only grouping that is currently supported is
+\fIby_network\fP. This is an array of user-named arrays that correspond to the
+\fIsnet\fP code for a given station in the \fIdatabase\fP. The user-named array
+name will appear in the sidebar/list view in Google Earth. If there is no
+styling array found for a station in your database, the \fIothers\fP styling will
+be used. Do not remove the \fIothers\fP styling from this section of the parameter
+file!! Do rename any other arrays that use network codes specific to your
+operations.
+
+Each user-named array must have the following parameters:
+
+.RS 0.5i
+.IP \fIscale\fP
+Scale the chosen image file for the placemark by this value. A value of 1 indicates
+no change to the item scale.
+
+.IP \fIimagesrc\fP
+The path or url where the image for the placemark is found. This can be either
+a filename, a url, or a url with api paramters for dynamic icon generation. You
+can take advantage of the \fIimagedir\fP or \fIlocal_imagedir\fP special functions
+to shorten possibly repeated paths for icons.
+
+.RE
+
.LP
+For the \fIorigins\fP styling, all hope of compaitiblity with previous versions
+of \fIdb2kml_py\fP is completely gone. There are multiple parameters/sections
+that are maintained in the \fIorigins\fP styling section of the parameter file.
+
+The symbols used for plotting origins can either be:
+1) generated dynamically from an API (example shown for the very
+specific and undocumented API running at UCSD);
+2) available locally on disk; or
+3) in a web-accessible location.
+
+Beyond the \fIlook_at\fP section (described above with the \fIstations\fP parameters,
+there is a section called \fIapi_params\fP that
+defines what terms are used to access/control the api output.
+The default parameter file shows what is available from an api run at
+UCSD (see the default value of \fIapi_url\fP). Please modify \fIapi_url\fP
+and the \fIapi_params\fP for use with your own api.
+
+.IP \fIapi_url\FP
+A url for a functioning api. The parameters defined in the \fIapi_params\fP
+section are specific to the api chosen here.
+
+.LP
+The named arrays found in \fIapi_params\fP can be referenced in the later \fIplacemarks\fP
+styling for the origins. One caveat is that \fIdb2kml_py\fP does check
+if there is a regex match for 'color' in any of these parameters and
+performs a basic check to see if the value is a valid color (not well tested).
+
+.IP \fIdepthcolor\FP
+Integer-value pair corresponding to the limiting depth and color. This is
+only used for an api to map the origin placemark/icon color based on the
+depth of the event. Use integer depths followed by a hex color. For example,
+given the default parameter file setup, an event that is at at 2km depth
+is beyond a depth of "0", but not beyond a depth of "6", so a "0" value
+is used for colorization: BFFFFF.
+
+.IP \fImagscale\fP
+Integer-value pair corresponding to the limiting magnitude and scale factor.
+Used for both api and static origin icons. This allows icons to be scaled
+based on the magnitude of the event. For example, given the default parameter
+file setup, an event with magnitude 0.7 has not reached the threshold of "1",
+so the icon used will be scaled with a value of 0.4. If no magnitude is found
+for a given event it will use the first listed \fIscale_factor\fP. Note
+that some networks do record negative magnitudes, so the default parameter
+file has a first value of "-2".
+
+.LP
+The \fIplacemarks\fP section is critical to defining how your origin
+icons will be shown on the map. What configurtaion is chosen corresponds
+to the \fI-opm field:model\fP used on the command line. Currently only
+\fIdepth\fP and \fImagnitude\fP are supported as field values.
+Support for \fIauthor\fP is planned.
+
+Each named Tbl (the \fImodel\fP from the \fI-opm\fP command line option)
+in either the \fIdepth\fP or \fImagnitude\fP section,
+maps what icon will be used, whether or not there is a scale factor
+applied to the icon, the source location for the image, and optionally
+whether or not there are any parameters for api access.
+
+
+.IP "\(bu depth|magnitude"
+.br
+
+Depth. In km (use integers only). Origin depth will be compared to this
+value and a particular icon is chosen if the origin depth is less than
+or equal to the depth listed here.
+
+Magnitude. Origin magnitude (netmag.magnitude) will be compared to this
+value and a particular icon is chosen if the netmag magnitude is less than
+or equal to the magnitude listed here.
+
+.IP "\(bu scalefactor"
+.br
+
+Can be numeric or the text string: \fImagscale\fP. This applies a scale factor to the
+icon.
+
+.IP "\(bu imgsrc"
+.br
+
+The image that is used for plotting an icon on the Google Earth map. This can be a
+url for an api call, a url for an accessible image, or a file name.
+If you have defined \fIapi_url\fP , you can use a reference to that here. The \fIimagedir\fP
+and \fIlocal_imagedir\fP shortcuts can also be used here.
+
+.IP "\(bu api_params"
+.br
+
+This is optional and only used if your \fIimgsrc\fP is an api. This can
+either be a string that is passed to the api, or it can be a reference
+to a named set of api parameters from the \fIapi_params\fP section of the
+parameter file.
+
+
+.LP
+
+.SH EXAMPLES
+.SS "station plotting - static images"
+.IP \(bu
+Plot all stations (even those that are closed) using the icons
+provided with this script. Save as a kmz file.
+
+This assumes you have modified the config:stations:display_inactive
+parameter in \fImy_db2kml_py.pf\fP to "yes".
+.ft CW
+.in 2c
+.nf
+.ne 4
+
+%\fB db2kml_py -c stations -v -z -p my_db2kml_py.pf \\
+ dbin kmlout
+
+.fi
+.in
+.ft R
+
+.SS "origin plotting - static images"
+.IP \(bu
+Plot origins as red, orange or purple stars (depth based), with magnitude scaling
+.ft CW
+.in 2c
+.nf
+.ne 4
+
+%\fB db2kml_py -c origins -v -z -p my_db2kml_py.pf \\
+ -opm depth:static_ms dbin kmlout
+
+.fi
+.in
+.ft R
+
+.IP \(bu
+Plot origins as orange or red stars (magnitude based), with magnitude scaling
+.ft CW
+.in 2c
+.nf
+.ne 4
+
+%\fB db2kml_py -c origins -v -z \\
+ -opm magnitude:static_ms dbin kmlout
+
+.fi
+.in
+.ft R
+
+.SS "origin and station plotting - api images"
+.IP \(bu
+Plot origins with color based on depth, size based on magnitude.
+
+This uses the \fIdynamic_depth\fP set of api parameters.
+.ft CW
+.in 2c
+.nf
+.ne 4
+
+%\fB db2kml_py -v -z -opm depth:api_ms_dd dbin kmlout
+
+.fi
+.in
+.ft R
+
+.IP \(bu
+Plot origins as orange circles, red squares or purple stars (generated from api)
+and size based on magnitude.
+
+This uses the \fIorange_cirle\fP, \fIred_square\fP, and \fIpurple_star\fP
+defined set of api parameters found in \fIapi_params\fP.
+.ft CW
+.in 2c
+.nf
+.ne 4
+
+%\fB db2kml_py -v -z -opm magnitude:api_ms dbin kmlout
+
+.fi
+.in
+.ft R
-.SH RETURN VALUES
-\fBdb2kml_py\fP exits with 0 upon success, nonzero upon error.
.SH NOTES
-Code updated to include the snetsta table for stations. This will
-allow you to subset by network.
+Need to have installed the simplekml module.
+
+The url to the api at UCSD is included as a courtesy. Do not abuse access
+to it! Access may be denied at some future date.
+
+If you have not modified the default parameter file headers section, the
+program will warn you and exit. Make a local copy of \fIdb2kml_py.pf\fP
+and edit it with your specifics.
+
+The placemark icons must be sourced from a web-accessible location if you are
+not creating a kmz file. If your KML files are served
+to a wide audience, it is important to provide a robust access point for
+these images. It is recommended that you use a kmz file for external
+audiences as the images are collected once upon running \fBdb2kml_py\fP
+rather than requested each time someone runs Google Earth with your kml file.
+
+The example api from UCSD, included as an example for placemark icon generation,
+ is not well documented. Please use your own api.
+
+If you wish to specify a specific directory where the temporary image
+files are stored during creation of \fIkmlfile\fP and your use of \fI-k\fP,
+change your TMPDIR environment variable.
-.SH NOTE ABOUT SERVERS
-The icons and the magnitude/depth legend must be sourced from a
-web-accessible location. Especially if your KML files are served
-to a wide audience, it is important to provide a robust archive for
-these images that you have control over.
.SH "SEE ALSO"
.nf
-db2kml(1), db2xml(1), dbexpressions(5)
+db2kml(1), db2xml(1), antelope_python(1)
.fi
.SH "BUGS AND CAVEATS"
You must have the Antelope Interface to Python compiled
against your installed version of Antelope and Python. See
-pythondb for more information.
+antelope_python(1) for more information. This is Python3
+compatible. Will not work with Python2. Previous generations
+of this script used Python2 and stopped functioning around
+Antelope 5.8.
+
+If you are plotting events that span the globe, you may get an
+initial zoom window that is larger than expected/not focused on
+your network stations. To zoom to a preferred starting view area,
+make sure you have adjusted the \fIcamera\fP parameters in the
+\fIheaders\fP section of your pf file. As an alternative, in
+Google Earth, you can click on the \fIorigins\fP of \fIstations\fP
+folder in Places in the list view and your map should zoom to a
+desired focus area, assuming you have \fIlook_at\fP configured.
+
+Currently, there is no option to dynamically plot a "legend".
+The only available hack I can suggest to make one, is to create an
+image that contains all of your legend information, and then create
+a "legend" item in the \fIoverlays\fP section.
+
+This has only been tested for small networks and small numbers of
+events. It may not scale well.
+
+If your output kml file shows icons that are boxes with an "x", or
+the Google "yellow pushpin", you likely have had a problem
+accsessing your requested image files.
+
+The output kmz file zipfile will contain duplicate files when a
+listing of the zipfile is reviewed with a command like:
+.ft CW
+.in 2c
+.nf
+.ne 4
+
+%\fB python -m zipfile -l outputfile.kmz
+
+.fi
+.in
+.ft R
+
+This is due to how simplekml creates the zipfile. In an ideal world,
+the savekmz funciton would recognize that the icons to be saved
+were the same, and only one one to the zip. Instead, savekmz from simplekml adds
+that additional/duplicate file to the kmz and then warns about it.
+I have not found a way around this, which results in bloating the kmz file.
+I simply suppress the warnings about the duplicate files going in to the
+zip/kmz file.
+
.SH AUTHOR
.nf
-Rob Newman
+Jennifer Eakins
- based on the original db2kml written by -
@@ -94,7 +1189,9 @@ Geophysical Institute
Alaska Volcano Observatory
University of Alaska Fairbanks
-- UPDATED BY -
-Juan Reyes
+- and revised from the updated db2kml_py for python2 updates by -
+Juan Reyes
+Rob Newman
+
.fi
.\" $Id$
diff --git a/bin/export/db2kml_py/db2kml_py.pf b/bin/export/db2kml_py/db2kml_py.pf
index f1fa0610e..e38e36515 100644
--- a/bin/export/db2kml_py/db2kml_py.pf
+++ b/bin/export/db2kml_py/db2kml_py.pf
@@ -1,141 +1,475 @@
-config &Arr{
- expr &Tbl{
- #time >= 704371900
- # lat >= 10 && lat <= 40 && lon >= -90 && lon <= -50
- }
- sort_fields &Tbl{
- time
- }
- create_kmz True
- network_link &Arr{
- }
- subset stations # Can be events, stations, or empty string ('') for both
-}
+# default db2kml.pf
+
+# special functions for later use in pf:
+antelope &env(ANTELOPE)
+
+# convenient shorthand for use in station and origin styles
+imagedir &{antelope}/contrib/data/icons # location for some default icons
+local_imagedir &{antelope}/contrib/data/icons # modify this to point to your own saved icon/image directory
+
headers &Arr{
- name Central and Eastern United States Network (CEUSN)
+ name Change Name Here or script will die!!
description &Literal{
-
As the USArray Transportable Array entered the central and eastern United States, several Federal agencies (National Science Foundation, United States Geological Survey, United States Nuclear Regulatory Commission, and Department of Energy) recognized the unique opportunity to retain seismometers in this region beyond the original timeline of the deployed TA footprint.
+ Your network described here
- Created:
- Website: http://ceusn.ucsd.edu
+ Website: http://somewhere.edu
Author: db2kml_py
- Copyright:
+ Contact:
+ }
+
+ network_link &Arr{
+ ignore yes # yes/no. no = include the network link, yes = do not include a network link
+ link somelinkhere
+ name A placeholder for now
+ expires 86400 # refresh daily, every 86400
}
- #set_look_at True
- set_look_at
+ camera &Arr{
+ # A default view when initially loaded, defaults are southern California
+ # may be different than the focal point chosen by look_at for stations and/or origins
+ latitude 31.9
+ longitude -116.6
+ altitude 280000 # height above sea level, in meters (unlike range in lookat)
+ tilt 30
- look_at &Arr{
- # Some default view when initially loaded
- latitude 38.5
- longitude -87.0
- range 100000 # height above sea level
}
- legend_url http://ceusn.ucsd.edu/images/CEUSN-logo.jpg
- #generate_legend True
- generate_legend 1
}
-stations &Arr{
- expr &Tbl{
- sta =~ /.*/ && snet =~ /.*/
+config &Arr{
+ stations &Arr{
+ use_deployment no # use deployment table for active check, default is to use site table
+ display_inactive no
+ indicate_when yes # include a "when" based on ondate/offdate so slider bar/animation can be used
+ suppress_label no # don't include station name text on map
+ precision 4 # how many decimal places to display for station coordiantes
+ # i.e. precision 2 will produce XX.XX and XXX.XX
+ # i.e. precision 4 will produce XX.XXXX and XXX.XXXX as available
+
+ subsets &Tbl{
+ #sta =~ /.*/ && snet =~ /.*/
+ sta =~ /.*/ && snet != 'CI'
+ }
+ sort_fields &Tbl{
+ snet
+ sta
+ }
}
- fields &Tbl{
- snet
- sta
- lon
- lat
- elev
- staname
- ondate
- offdate
+
+
+ origins &Arr{
+
+ indicate_when no # include a "when" based on ondate/offdate so slider bar/animation can be used
+
+ prefor_only yes # only plot prefor origins, no = all origins will be plotted
+
+ subsets &Tbl{
+ #distance(lat,lon,33.3,-116.5) <= 5.0
+ time>='1/01/2023'
+ #magnitude>='1.5'
+ }
+ sort_fields &Tbl{
+ time
+ }
}
- visibility 1
- display_inactive 0
}
-styles &Arr{
- #imagepath http://maps.google.com/mapfiles/kml/paddle/
- #imagepath http://eqinfo.ucsd.edu/images/spevents/google_map_icons_evstars/
- imagepath http://maps.google.com/mapfiles/kml/paddle/
-
- styleinfo &Arr{
- mag_0 &Arr{
- id orangeStarZero
- scale 0.2
- href GMapOrangeStar.gif
- }
- mag_1 &Arr{
- id orangeStarOne
- scale 0.4
- href GMapOrangeStar.gif
- }
- mag_2 &Arr{
- id orangeStarTwo
- scale 0.7
- href GMapOrangeStar.gif
- }
- mag_3 &Arr{
- id redStarThree
- scale 1.1
- href GMapRedStar.gif
- }
- mag_4 &Arr{
- id redStarFour
- scale 1.6
- href GMapRedStar.gif
- }
- mag_5 &Arr{
- id redStarFive
- scale 2.2
- href GMapRedStar.gif
- }
- mag_6 &Arr{
- id redStarSix
- scale 2.9
- href GMapRedStar.gif
- }
- mag_7 &Arr{
- id redStarSeven
- scale 3.7
- href GMapRedStar.gif
- }
- mag_8 &Arr{
- id redStarEight
- scale 4.6
- href GMapRedStar.gif
- }
- mag_9 &Arr{
- id redStarNine
- scale 5.6
- href GMapRedStar.gif
- }
- }
- stylestation &Arr{
- N4 &Arr{
- id N4
- scale 1.0
- href grn-circle-lv.png
+overlays &Arr{
+ logo &Arr{
+
+ plotthis yes
+
+ imgsrc &{imagedir}/google_map_anza_icon.png
+ name Anza logo
+ rotation 0 # value in degrees counterclockwise 0 = north, 90 = rotate left, -90 = rotate right
+
+ overlayXY &Arr{
+ # what point on your image is mapped to a screen coordinate
+ # (i.e. where you place the thumbtack in a piece of paper to be stuck to the bulletin board
+ # - not where you stick it on the board)
+ #
+ # See https://developers.google.com/kml/documentation/kmlreference#screenoverlay
+ # (x,y) = (0,0) would be lower left
+ x 0 # coordinate origin is lower left corner
+ y 0 # coordinate origin is lower left corner,
+ xunits fraction # fraction(x,y 0.0->1.0), pixels(number)
+ yunits fraction # fraction(x,y 0.0->1.0), pixels(number)
}
- TA &Arr{
- id TA
- scale 1.0
- href red-circle-lv.png
+ screenXY &Arr{
+ # where your image is mapped to
+ # (i.e. where your paper with the thumbtack in it is stuck on the bulletin board)
+ #
+ # See https://developers.google.com/kml/documentation/kmlreference#screenoverlay
+ # (x,y) = (0,0) would be lower left
+ x 0.5 # coordinate origin is lower left corner
+ y 0.90 # coordinate origin is lower left corner
+ xunits fraction # fraction(x,y 0.0->1.0), pixels(number)
+ yunits fraction # fraction(x,y 0.0->1.0), pixels(number)
}
- US &Arr{
- id US
- scale 1.0
- href blu-circle-lv.png
+
+ size &Arr{
+ x 0 # -1 = native, 0 = maintain aspect ratio, n set value of dimension
+ y 0 # -1 = native, 0 = maintain aspect ratio, n set value of dimension
+ # to force image to recise to 100px by 500px, x = 100, y = 500, xunits,yunits = pixels
+ xunits pixels # fraction, pixels
+ yunits pixels # fraction, pixels
+
}
- others &Arr{
- id others
- scale 1.0
- href wht-circle-lv.png
+
+ }
+
+ fancylogo &Arr{
+
+ plotthis yes
+
+ imgsrc &{local_imagedir}/ANZA-logo-small.png
+ name Fancy Anza logo
+ rotation 0 # value in degrees counterclockwise 0 = north, 90 = rotate left, -90 = rotate right
+
+ overlayXY &Arr{
+ # what point on your image is mapped to a screen coordinate
+ # (i.e. where you place the thumbtack in a piece of paper to be stuck to the bulletin board
+ # - not where you stick it on the board)
+ #
+ # See https://developers.google.com/kml/documentation/kmlreference#screenoverlay
+ # (x,y) = (0,0) would be lower left
+ x 0 # coordinate origin is lower left corner
+ y 0 # coordinate origin is lower left corner,
+ xunits fraction # fraction, pixels
+ yunits fraction # fraction, pixels
+ }
+ screenXY &Arr{
+ # where your image is mapped to
+ # (i.e. where your paper with the thumbtack in it is stuck on the bulletin board)
+ #
+ # See https://developers.google.com/kml/documentation/kmlreference#screenoverlay
+ # (x,y) = (0,0) would be lower left
+ x 15 # coordinate origin is lower left corner
+ y 15 # coordinate origin is lower left corner,
+ xunits pixels # fraction(x,y 0.0->1.0), pixels(number)
+ yunits pixels # fraction(x,y 0.0->1.0), pixels(number)
+ }
+
+ size &Arr{
+ x 0 # -1 = native, 0 = maintain aspect ratio, n set value of dimension
+ y 0 # -1 = native, 0 = maintain aspect ratio, n set value of dimension
+ # to force image to recise to 100px by 500px, x = 100, y = 500, xunits,yunits = pixels
+ xunits pixels # fraction, pixels
+ yunits pixels # fraction, pixels
+
}
+
}
+
}
-pf_revision_time 1387575390
+styles &Arr{
+
+ stations &Arr{
+
+ look_at &Arr{
+ # Some default view when initially loaded, defaults are southern California
+ latitude 33.3
+ longitude -116.5
+ range 280000 # height above sea level
+ }
+
+ by_network &Arr{
+ # stations will be grouped by snet. Define your Arrays by snet (i.e. AZ, PY, XX, MA, etc.)
+ # do not completely remove the "others" defined array. Changing scale or imagesrc is ok
+ AZ &Arr{
+ scale 0.6
+ #imagesrc &{imagedir}/red_triangle.png
+ # api generated image instead of saved image
+ imagesrc http://anf.ucsd.edu/api/anza/mapimg/?transparency=1%26shape=triangle%26fillcolor=purple%26outline=yes26shadow=yes
+ }
+ PY &Arr{
+ scale 0.6
+ imagesrc &{imagedir}/yel_triangle.png
+ }
+ YN &Arr{
+ scale 0.6
+ imagesrc &{imagedir}/red_triangle.png
+ }
+ others &Arr{ # DO NOT rename this "others" network, changing scaling, imagepath or href is ok
+ scale 0.6
+ imagesrc &{imagedir}/wht_triangle.png
+ }
+ }
+ }
+
+ origins &Arr{
+
+ look_at &Arr{
+ # Some default view when initially loaded
+ latitude 33.3
+ longitude -116.5
+ range 280000 # height above sea level
+ }
+
+ # please change this to your own api. Access to the UCSD api may go away at any time
+ api_url http://anf.ucsd.edu/api/anza/mapimg/ # this gives a green (aaeeaa) triangle with a border (eww, but basic)
+
+ api_params &Arr{ # parameters in each named array are specific to the api in use
+
+ default &Arr{
+ # below are the params you can add to the api url to modify the symbol produced
+ bgcolor transparent # change to a color if you want icon to appear as square with filled in color
+ fillcolor red # colorname: for HSV colors, you can precede color code with "%23", i.e. %2340FFFF will be a light blue)
+ linecolor black # change to fillcolor if you want no outline for your symbol
+ size 24 # the default size is 24, use of magscale will alter this
+ transparency 0.75
+ shadow true # true/false
+ shape circle # valid shapes for UCSD api: circle, square, square-round, ellipse, diamond,
+ # star, triangle, equitrianagle, parallelogram, trapezoid
+ }
+
+ dynamic_depth &Arr{
+ # this is a special array that looks at the mappings of color to depth that are defined in depthcolor
+ bgcolor transparent # change to a color if you want icon to appear as square with filled in color
+ fillcolor depthcolor # colorname: for HSV colors, precede color code with "%23", i.e. %2340FFFF will be a light blue)
+ linecolor depthcolor # change to fillcolor if you want no outline for your symbol
+ size 24 # the default size is 24, use of magscale will alter this
+ transparency 0.75
+ shadow true # true/false
+ shape circle # valid shapes for UCSD api: circle, square, square-round, ellipse, diamond,
+ # star, triangle, equitrianagle, parallelogram, trapezoid
+ }
+
+ purple_star &Arr{
+ # below are the params you can add to the api line to modify the symbol produced
+ bgcolor transparent # change to a color if you want icon to appear as square with filled in color
+ fillcolor purple # colorname: for HSV colors, you can precede color code with "%23", i.e. %2340FFFF will be a light blue)
+ linecolor black # change to fillcolor if you want no outline for your symbol
+ size 24 # the default size is 24, use of magscale will alter this
+ transparency 0.75
+ shadow true # true/false
+ shape star # valid shapes for UCSD api: circle, square, square-round, ellipse, diamond,
+ # star, triangle, equitrianagle, parallelogram, trapezoid
+ }
+
+ red_square &Arr{
+ # below are the params you can add to the api line to modify the symbol produced
+ bgcolor transparent # change to a color if you want icon to appear as square with filled in color
+ fillcolor red # colorname: for HSV colors, you can precede color code with "%23", i.e. %2340FFFF will be a light blue)
+ linecolor black # change to fillcolor if you want no outline for your symbol
+ size 24 # the default size is 24, use of magscale will alter this
+ transparency 0.75
+ shadow true # true/false
+ shape square # valid shapes for UCSD api: circle, square, square-round, ellipse, diamond,
+ # star, triangle, equitrianagle, parallelogram, trapezoid
+ }
+
+ orange_circle &Arr{
+ # below are the params you can add to the api line to modify the symbol produced
+ bgcolor transparent # change to a color if you want icon to appear as square with filled in color
+ fillcolor orange # colorname: for HSV colors, you can precede color code with "%23", i.e. %2340FFFF will be a light blue)
+ linecolor black # change to fillcolor if you want no outline for your symbol
+ size 24 # the default size is 24, use of magscale will alter this
+ transparency 0.75
+ shadow true # true/false
+ shape circle # valid shapes for UCSD api: circle, square, square-round, ellipse, diamond,
+ # star, triangle, equitrianagle, parallelogram, trapezoid
+ }
+ }
+
+ depthcolor &Arr{ # dynamic depth colorization requires api, mag sizing does not
+ # depth fillcolor
+ -5 3F3F3F # grey, very negative depth
+ 0 BFFFFF
+ 6 00DFFF
+ 10 000080 # greyblue
+ 20 03ff03
+ 30 FFE800 # yellow-organge
+ 40 FE9400
+ 60 FF0000 # red
+ 100 FF00B2
+ 200 FF00F7 # fuchia
+ 300 B000B3
+ 400 8E00FE # purple
+ 600 4C0066 # dk. purple
+ 800 000000 # black
+ }
+
+
+ magscale &Arr{ # magnitude scaling can be applied to either api generated or static image
+ # magnitude scale_factor
+ -2 0.4 # this will also be used for events with no calculated magnitude
+ 0 0.6
+ 1 0.8
+ 2 1.0
+ 3 1.7
+ 4 2.2
+ 5 3.0
+ 6 3.6
+ 7 4.4
+ 8 5.5
+ 9 6.0
+ 10 6.2
+ }
+
+ placemarks &Arr{
+
+ default &Arr{
+ imgsrc &{imagedir}/vsm_red_circle.png
+ scale 0.7
+ }
+
+ depth &Arr{
+
+ # if depthcolor is used in the api_params (i.e. in dynamic_depth), but the listed depths
+ # do not have corresponding value defined in depthcolor, then:
+ # a best guess to the next closest color-depth mapping will be chosen.
+
+ api_ms_dd &Tbl{ # case1a - api image, mag scaling, dynamic depth colorization
+ #
+ # depth scalefactor imgsrc api_params(optional)
+ # #1 or magsacle #file or url for api # blank or api_params reference
+ -5 magscale &{api_url} dynamic_depth
+ 0 magscale &{api_url} dynamic_depth
+ 6 magscale &{api_url} dynamic_depth
+ 10 magscale &{api_url} dynamic_depth
+ 20 magscale &{api_url} dynamic_depth
+ 30 magscale &{api_url} dynamic_depth
+ 40 magscale &{api_url} dynamic_depth
+ 60 magscale &{api_url} dynamic_depth
+ 100 magscale &{api_url} dynamic_depth
+ 200 magscale &{api_url} dynamic_depth
+ 300 magscale &{api_url} dynamic_depth
+ 400 magscale &{api_url} dynamic_depth
+ 600 magscale &{api_url} dynamic_depth
+ 800 magscale &{api_url} dynamic_depth
+ }
+
+ api_no_ms &Tbl{ # case1b - api image, no mag scaling, dynamic depth colorization
+ #
+ # depth scalefactor imgsrc api_params(optional)
+ # #1 or magsacle #file or url for api # blank or api_params reference
+ -5 0.5 http://anf.ucsd.edu/api/anza/mapimg/ dynamic_depth
+ 0 0.5 http://anf.ucsd.edu/api/anza/mapimg/ dynamic_depth
+ 6 0.5 http://anf.ucsd.edu/api/anza/mapimg/ dynamic_depth
+ 10 0.5 http://anf.ucsd.edu/api/anza/mapimg/ dynamic_depth
+ 20 0.5 http://anf.ucsd.edu/api/anza/mapimg/ dynamic_depth
+ 30 0.5 http://anf.ucsd.edu/api/anza/mapimg/ dynamic_depth
+ 40 0.5 http://anf.ucsd.edu/api/anza/mapimg/ dynamic_depth
+ 60 0.5 http://anf.ucsd.edu/api/anza/mapimg/ dynamic_depth
+ 100 0.5 http://anf.ucsd.edu/api/anza/mapimg/ dynamic_depth
+ 200 0.5 http://anf.ucsd.edu/api/anza/mapimg/ dynamic_depth
+ 300 0.5 http://anf.ucsd.edu/api/anza/mapimg/ dynamic_depth
+ 400 0.5 http://anf.ucsd.edu/api/anza/mapimg/ dynamic_depth
+ 600 0.5 http://anf.ucsd.edu/api/anza/mapimg/ dynamic_depth
+ 800 0.5 http://anf.ucsd.edu/api/anza/mapimg/ dynamic_depth
+ }
+
+ static_ms &Tbl{ # case2a - static file (no depth colorization) + mag scaling
+ #
+ # depth scalefactor imgsrc api_params(optional)
+ # #1 or magscale #file or url for api # blank or api_params reference
+ -5 magscale &{imagedir}/red_star_nooutline.png
+ -4 magscale &{imagedir}/red_star_nooutline.png
+ 0 magscale &{imagedir}/red_star_nooutline.png
+ 6 magscale &{imagedir}/red_star_nooutline.png
+ 10 magscale &{imagedir}/red_star_nooutline.png
+ 20 magscale &{imagedir}/orange_star_nooutline.png
+ 30 magscale &{imagedir}/orange_star_nooutline.png
+ 40 magscale &{imagedir}/orange_star_nooutline.png
+ 60 magscale &{imagedir}/orange_star_nooutline.png
+ 100 magscale &{imagedir}/orange_star_nooutline.png
+ 200 magscale &{imagedir}/orange_star_nooutline.png
+ 300 magscale &{imagedir}/orange_star_nooutline.png
+ 400 magscale &{imagedir}/purple_star_nooutline.png
+ 600 magscale &{imagedir}/purple_star_nooutline.png
+ 800 magscale &{imagedir}/purple_star_nooutline.png
+ }
+
+ static_nos &Tbl{ # case2b - use canned/static images which vary in color (or not) for a given depth, no scaling
+
+ # depth scalefactor imgsrc api_params(optional)
+ -5 1 &{imagedir}/red_star_nooutline.png
+ -4 1 &{imagedir}/red_star_nooutline.png
+ 0 1 &{imagedir}/red_star_nooutline.png
+ 6 1 &{imagedir}/orange_star_nooutline.png
+ 10 1 &{imagedir}/yellow_star_nooutline.png
+ 20 1 &{imagedir}/yellow_star_nooutline.png
+ 30 1 &{imagedir}/green_star_nooutline.png
+ 40 1 &{imagedir}/green_star_nooutline.png
+ 60 1 &{imagedir}/green_star_nooutline.png
+ 100 1 &{imagedir}/purple_star_nooutline.png
+ 200 1 &{imagedir}/purple_star_nooutline.png
+ 300 1 &{imagedir}/purple_star_nooutline.png
+ 400 1 &{imagedir}/purple_star_nooutline.png
+ 600 1 &{imagedir}/purple_star_nooutline.png
+ 800 1 &{imagedir}/purple_star_nooutline.png
+ }
+
+ }
+
+ magnitude &Arr{
+
+ api_ms &Tbl{ # case3 - api dynamic scaling based on default magscale, no depth colorization, symbol shape/color differentiated via api call
+ # mag scalefactor imgsrc api_params(optional)
+ -3 magscale http://anf.ucsd.edu/api/anza/mapimg/ orange_circle
+ 0 magscale http://anf.ucsd.edu/api/anza/mapimg/ orange_circle
+ 1 magscale http://anf.ucsd.edu/api/anza/mapimg/ orange_circle
+ 2 magscale http://anf.ucsd.edu/api/anza/mapimg/ orange_circle
+ 3 magscale http://anf.ucsd.edu/api/anza/mapimg/ red_square
+ 4 magscale http://anf.ucsd.edu/api/anza/mapimg/ red_square
+ 5 magscale http://anf.ucsd.edu/api/anza/mapimg/ purple_star
+ 6 magscale http://anf.ucsd.edu/api/anza/mapimg/ purple_star
+ 7 magscale http://anf.ucsd.edu/api/anza/mapimg/ purple_star
+ 8 magscale http://anf.ucsd.edu/api/anza/mapimg/ purple_star
+ 9 magscale http://anf.ucsd.edu/api/anza/mapimg/ purple_star
+ 10 magscale http://anf.ucsd.edu/api/anza/mapimg/ purple_star
+ }
+
+ static_ms &Tbl{ # case4a - static file with dynamic scaling based on default magscale, no depth colorization
+ # mag scalefactor imgsrc api_params(optional)
+ -3 magscale &{imagedir}/orange_star_nooutline.png
+ 0 magscale &{imagedir}/orange_star_nooutline.png
+ 1 magscale &{imagedir}/orange_star_nooutline.png
+ 2 magscale &{imagedir}/orange_star_nooutline.png
+ 3 magscale &{imagedir}/red_star_nooutline.png
+ 4 magscale &{imagedir}/red_star_nooutline.png
+ 5 magscale &{imagedir}/red_star_nooutline.png
+ 6 magscale &{imagedir}/red_star_nooutline.png
+ 7 magscale &{imagedir}/red_star_nooutline.png
+ 8 magscale &{imagedir}/red_star_nooutline.png
+ 9 magscale &{imagedir}/red_star_nooutline.png
+ 10 magscale &{imagedir}/red_star_nooutline.png
+ }
+
+ static_nos &Tbl{ # case4b - static files (based on color or magnitude?), no magnitude scaling
+ # mag scalefactor imgsrc api_params(optional)
+ -3 1 &{imagedir}/orange_star_nooutline.png
+ 0 1 &{imagedir}/orange_star_nooutline.png
+ 1 1 &{imagedir}/orange_star_nooutline.png
+ 2 1 &{imagedir}/orange_star_nooutline.png
+ 3 1 &{imagedir}/red_star_nooutline.png
+ 4 1 &{imagedir}/red_star_nooutline.png
+ 5 1 &{imagedir}/red_star_nooutline.png
+ 6 1 &{imagedir}/red_star_nooutline.png
+ 7 1 &{imagedir}/red_star_nooutline.png
+ 8 1 &{imagedir}/red_star_nooutline.png
+ 9 1 &{imagedir}/red_star_nooutline.png
+ 10 1 &{imagedir}/red_star_nooutline.png
+ }
+
+ }
+
+
+ auth &Arr{ # not programmed yet, placeholder
+ static_auth_ms &Arr{
+ #
+ # auth scalefactor imgsrc
+ # #1 or magsacle #file or url for api
+ UCSD magscale &{imagedir}/orange_star_nooutline.png
+ USGS magscale &{imagedir}/red_star_nooutline.png
+ }
+ }
+ }
+ }
+}
+
+pf_revision_time 1681501519
diff --git a/bin/export/db2kml_py/db2kml_py.xpy b/bin/export/db2kml_py/db2kml_py.xpy
old mode 100755
new mode 100644
index c6ebe73e1..370ee7d01
--- a/bin/export/db2kml_py/db2kml_py.xpy
+++ b/bin/export/db2kml_py/db2kml_py.xpy
@@ -1,22 +1,38 @@
-'''
+
+"""
db2kml_py.py
Create Google Earth KML source from
database origin and/or site tables
-@author Juan Reyes
-@credits Rewrite of an original Perl script (db2kml) by
- Michael West of the Volcano Observatory, University
- of Alaska Fairbanks.
-@credits 2 Rewrite 2 by Rob Newman
-'''
+@author Jennifer Eakins
+@credits Rewrite of Juan Reyes' rewrite of an original
+ Perl script (db2kml) by Michael West of the
+ Volcano Observatory, University of Alaska Fairbanks.
+@updates Make Python3 compatible
+ Move away from print statements to simplekml
+ Depth colorization
+ Dynamic symbol styles based on ANF api
+
+
+"""
import sys
import os
import time
import math
-import zipfile
-from optparse import OptionParser
+from pathlib import Path
+import shutil
+
+import argparse
+import simplekml
+import tempfile
+import warnings
+
+import re
+import requests
+from bisect import bisect_right, bisect_left
+from PIL import Image
# Import Antelope modules
import antelope.datascope as datascope
@@ -24,108 +40,87 @@ import antelope.stock as stock
def parseepoch( t ):
- '''
- Parse epoch and covert to day only with no hours.
- '''
+ """Parse epoch time and covert to day only with no hours.
+ """
+
if not int( t ) or t > stock.now():
t = stock.now()
return stock.str2epoch( stock.strdate( t ) )
+def parseArgs(argv=None):
+ """Set up collection of arguments
+ """
-def configure():
- """Gather command line
- options"""
- usage = "Usage: %prog [options] database output_file.kml"
- parser = OptionParser(usage=usage)
- parser.add_option("-v", action="store_true", dest="verbose", help="verbose output", default=False)
- parser.add_option("-x", action="store_true", dest="debug", help="debug output", default=False)
- parser.add_option("-p", action="store", type="string", dest="pf", help="pf", default='db2kml_py.pf')
- parser.add_option("-t", action="store", type="string", dest="filetype", help="filetype", metavar="", default=False)
- (options, args) = parser.parse_args()
+ parser = argparse.ArgumentParser(description="generate kml for sites and origins from db")
- if len(args) != 2:
- parser.error("incorrect number of arguments")
+ group = parser.add_argument_group('Debugging', 'higher levels of vebosity')
+ group.add_argument("-d", "--debug", action="store_true", help="really verbose, useful for debugging only")
+ group.add_argument("-v", "--verbose", action="store_true", help="verbose print, shows progress of script")
+ group.add_argument("-q", "--quiet", action="store_true", help="suppress any std output")
+ group.add_argument("-t", "--testoverlay", action='store_const', const='logotest.kmz', help="test overlay/logo placement by saving to a kmz file called logotest.kmz")
- database = args[0]
- out_file = args[1]
- verbose = False
- debug = False
- file_type = 'all'
+ parser.add_argument("db", type=str, help="input database")
+ parser.add_argument("kmlfile", type=str, help="kml or kmz output file")
- if options.verbose:
- verbose = True
+ parser.add_argument("-p", "--pf", default="db2kml_py.pf", help="parameter file")
- if options.debug:
- debug = True
+ kgroup = parser.add_argument_group('KML options', 'kml plotting behavior modifications')
+ kgroup.add_argument("-z", action='store_true', help="save output as kmz")
+ kgroup.add_argument("-k", nargs='?', const='kmzfiles', metavar='img_savedir', help="save images used for kmz in this directory")
+ kgroup.add_argument("-c", default="all", const="all", nargs="?", choices=["stations","origins","all"], help="generate kml for stations, origins, or both (default: %(default)s)")
+ kgroup.add_argument("-opm", metavar='field:model', help="origin placemark plotting model, maps to field model for origin placemarks in pf")
- if verbose:
- print "- Read configuration parameter file (pf): %s" % options.pf
- pf = stock.pfread(options.pf)
+ return(parser.parse_args(argv),parser)
- #if not options.pf:
- # pfs_tuple = list(stock.pffiles('db2kml_py'))
- # pfs_tuple.reverse() # Reverse order to search local pf dir first
- # for p in pfs_tuple:
- # if os.path.isfile(p):
- # pfname = p
- # break
- # if verbose or debug:
- # print "Used PFPATH to determine which parameter file to use and found '%s'" % pfname
- #else:
- # if not os.path.isfile(options.pf):
- # print "Command line defined parameter file '%s' does not exist. Exiting" % options.pf
- # sys.exit(-1)
- # else:
- # pfname = options.pf
+def get_pf(pf,args):
+ """Get values from the parameter file
+
+ Tests that headers section of pf file has been modified from default
- if options.filetype:
- file_type = options.filetype
+ Returns: pf_result - a dictionary containing 'config', 'styles', 'headers' and 'overlays'
+ """
- return database, out_file, verbose, debug, pf, file_type
+ config = pf['config']
+ styles = pf['styles']
+ headers = pf['headers']
+ overlays = pf['overlays']
-def get_pf(pf, verbosity=0):
- """Get values from the parameter file
- """
+ # bare minimum check to see if headers has been updated from default pf settings
+
+ hn = "Change Name Here or script wil die!!"
+ hd = "Your network described here"
+
+ if headers['name'] == hn :
+ sys.exit("FATAL: No edit found for name in headers section!\nYou must modify the headers section of %s, or specify a modified pf with the -p option" % args.pf )
+ elif re.search(hd,headers['description']):
+ sys.exit("FATAL: check headers description!\nYou must modify the headers section of %s, or specify a modified pf with the -p option" % args.pf )
+ else:
+ dprint("Passed minimal check for pf modifications")
- #pf = stock.pfread(pf)
+ # insert check here to verify that a default catchall of 'others' is defined in styles
- config = pf['config']
+ if 'others' not in styles['stations']['by_network'].keys():
+ sys.exit("Must define 'others' named array in styles:stations:by_network\nCheck your pf file")
- styles = pf['styles']
- if verbosity:
- print "%s" % styles
+ pf_result = {'config': config, 'styles': styles, 'headers': headers, 'overlays': overlays}
- stations = pf['stations']
- if not styles['imagepath'].endswith('/'):
- err_str = []
- err_str.append('ERROR: imagepath URL must contain a trailing / in parameter file.')
- err_str.append('Imagepath currently defined as: %s\n' % styles['imagepath'])
- print err_str
- sys.exit()
- headers = pf['headers']
- pf_result = {'config': config, 'styles': styles, 'headers': headers, 'stations': stations}
return pf_result
-def calc_verbosity(verbose=False, debug=False):
- """Calculate the verbosity
- of the script"""
- verbosity = 0
- if verbose:
- verbosity = 1
- if debug:
- verbosity = 2
- return verbosity
-
def calc_magtype(ev_dict):
- """Determine the magnitude
- and scale to use per event
- Assumes a netmag table
- is present"""
- if ev_dict['magnitude'] > 0:
+ """Determine the magnitude and scale to use per event
+
+ Assumes a netmag table is present
+
+ Argument: ev_dict contains origin or site information collected from datascope database
+
+ Returns: magnitude value, and magnitude type
+ """
+
+ if ev_dict['magnitude'] != -99.99 :
mag = ev_dict['magnitude']
mag_sc = ev_dict['magtype']
elif ev_dict['mb'] > 0:
@@ -139,436 +134,1512 @@ def calc_magtype(ev_dict):
mag_sc = "Ml"
else:
mag = '-'
- mag_sc = ""
+ mag_sc = '-'
return mag, mag_sc
-def get_orig_records(database, pf, verbosity=0):
- """Return a list of all events
- from the database
+def get_magscale(pfstyle,mag):
+ """Return a scale factor given an origin magnitude from database
+ using magscale as defined in pf file
+
+ If magnitude is null (-99.99) or less than the smallest value
+ in magscale from pf, then use the smallest value in magscale
+ """
+
+ mymagsize = pfstyle['magscale']
+
+ # convert strings to ints
+ mymagsize = {int(k):v for k,v in mymagsize.items()}
+ mymagsize = dict(sorted(mymagsize.items()))
+
+ if mag == '-' or mag < mymagsize[0]:
+ return mymagsize[0]
+
+ msr = bisect_right(list(mymagsize.keys()),float(mag))
+
+ if msr:
+ dprint("get_magscale: Find rightmost value less than or equal to ", mag)
+ dprint("get_magscale: index of this value is: ", mag)
+ dprint("get_magscale: maybe magscale to use is: ", list(mymagsize.values())[msr-1])
+ return list(mymagsize.values())[msr-1]
+
+ raise ValueError
+
+def choose_right_value (num_style, val):
+ """Given a database value, val (perhaps depth or magnitude),
+ map that value to a key:value in the num_style dictionary.
+
+ For example, you have an event with a depth of 3.2km, what
+ is the proper color to map that to given depthcolor in the pf file?
+
+ Returns: list item of the mapped value (i.e. num_style[mapped_value])
+ """
+
+ dprint("choose_right_value: from dictionary:", num_style)
+ dprint("choose_right_value: keys of dictionary:", num_style.keys())
+ dprint("choose_right_value: checking value %s" % val)
+
+ br = bisect_right(list(num_style.keys()), float(val))
+ bl = bisect_left(list(num_style.keys()), float(val))
+
+ dprint("choose_right_value: output of bisect_right:", br)
+
+ if br:
+ dprint("choose_right_value: Find rightmost value less than or equal to ", val)
+ dprint("choose_right_value: index of this value is: ", br)
+ dprint("choose_right_value: maybe value to use is: ", list(num_style.values())[br-1])
+
+ # despite examples https://docs.python.org/3/library/bisect.html, I need to return list value
+ #return num_style[br-1]
+
+ return list(num_style.values())[br-1]
+
+ elif br == 0 :
+ dprint("choose_right_value: Value %s is smaller than defined in input dictionary." % val)
+ if br != len(list(num_style.keys())):
+ rval = list(num_style.values())[br]
+ dprint("choose_right_value: Choosing %s instead (the leftmost value gte %s)" % ( list(num_style.values())[br], val) )
+ return list(num_style.values())[br]
+ raise ValueError
+
+
+def get_origin_records(database, pf, opmtype_style, ofol, sfol, sharedstyle, icon_method):
+ """Collect a list of events from the database
+
+ Subset(s) from pf file are applied
+
+ Calls:
+ generate_origin_pts - which styles and plots the points, adding them to the kml file
"""
- fields = ['time', 'lat', 'lon', 'depth', 'auth', 'mb', 'ms', 'ml', 'magnitude', 'magtype']
- db_pointer = datascope.dbopen(database, 'r');
- db_pointer = db_pointer.lookup(table='origin')
- tbl_event = db_pointer.dblookup(table='event')
- if tbl_event.dbquery('dbTABLE_PRESENT') > 0:
- if verbosity > 1:
- print " - Join event table"
- db_pointer = db_pointer.join('event')
- db_pointer = db_pointer.subset('orid==prefor')
+
+ vprint ("\n - Collecting origin info from database: %s" % database)
+
+ fields = ['time', 'lat', 'lon', 'depth', 'auth', 'mb', 'ms', 'ml', 'magnitude', 'magtype', 'review']
+
+ db = datascope.dbopen(database, 'r');
+ dborigin = db.lookup(table='origin')
+ dbevent = db.lookup(table='event')
+
+ if dbevent.query('dbTABLE_PRESENT') > 0:
+ vprint (" - Join event table")
+ dbj = dborigin.join('event')
+ if stock.yesno(pf_result['config']['origins']['prefor_only']):
+ vprint (" - Per prefor_only in pf, only plotting prefor")
+ dbj = dbj.subset('orid==prefor')
else:
- if verbosity > 1:
- print " * NOTE: Cannot join 'event' table"
- tbl_netmag = db_pointer.dblookup(table='netmag')
- if tbl_netmag.query('dbTABLE_PRESENT'):
- if verbosity > 1:
- print " - Join netmag table"
- db_pointer = db_pointer.join('netmag', outer=True)
+ vprint (" * NOTE: Cannot join 'event' table")
+
+ dbnetmag = db.lookup(table='netmag')
+
+ if dbnetmag.query('dbTABLE_PRESENT'):
+ vprint (" - Join netmag table")
+ dbj = dbj.join('netmag', outer=True)
else:
- if verbosity > 1:
- print " * NOTE: Cannot join 'netmag' table"
- my_expr = pf['config']['expr']
- if pf['config']['expr']:
- for mex in pf['config']['expr']:
- db_pointer = db_pointer.subset('%s' % mex)
- if verbosity > 0:
- print " - Origin subset '%s' resulted in %d records" % (mex, db_pointer.query('dbRECORD_COUNT'))
- my_sort_fields = pf['config']['sort_fields']
- if db_pointer.query('dbRECORD_COUNT') < 1:
- print "* ERROR: Database subsets failed to return any records. Check expr in config section of parameter file."
+ vprint (" * NOTE: Cannot join 'netmag' table")
+
+ my_expr = pf['config']['origins']['subsets']
+
+ if my_expr:
+ for mex in my_expr:
+ if mex == '':
+ continue
+
+ dprint("mex is:", mex)
+ dbj = dbj.subset('%s' % mex)
+ vprint (" - Origin subset '%s' resulted in %d records" % (mex, dbj.query('dbRECORD_COUNT')) )
+
+ my_sort_fields = pf['config']['origins']['sort_fields']
+
+ if dbj.query('dbRECORD_COUNT') < 1:
+ print ("* ERROR: Database subsets failed to return any records. Check expr in config section of parameter file.")
sys.exit(1)
+
+ sortstring = []
+
for msf in my_sort_fields:
- db_pointer = db_pointer.sort('%s' % msf)
- if db_pointer.query('dbRECORD_COUNT') < 1:
- print "* ERROR: Database sorts failed. Check sort_fields in parameter file."
+ sortstring.append(msf)
+
+ dbj = dbj.sort(sortstring)
+
+ if dbj.query('dbRECORD_COUNT') < 1:
+ print ("* ERROR: Database sorts failed. Check sort_fields in parameter file.")
sys.exit(1)
else:
- if verbosity > 0:
- print "- Number of records: %s" % db_pointer.query('dbRECORD_COUNT')
- oridout = ["\t\n"]
- oridout.append("\t\tEarthquakes\n")
- oridout.append("\t\t1\n")
- for i in range(db_pointer.query('dbRECORD_COUNT')):
+ vprint (" - Number of origins to plot: %s" % dbj.query('dbRECORD_COUNT'))
+
+ for i in range(dbj.query('dbRECORD_COUNT')):
ev_dict = {}
- db_pointer.record = i
+ dbj.record = i
for f in fields:
- ev_dict[f] = db_pointer.getv(f)[0]
+ ev_dict[f] = dbj.getv(f)[0]
if f == 'time':
# Convert to XML standard time
ev_dict['time_xml'] = stock.epoch2str(ev_dict[f], "%Y-%m-%dT%H:%M:%SZ")
ev_dict['time_readable'] = stock.epoch2str(ev_dict[f], "%Y-%m-%d %H:%M:%S UTC")
- mag, mag_sc = calc_magtype(ev_dict)
- if mag != '-':
- style_mag = "mag_" + str(int(math.ceil(mag)))
- else:
- style_mag = "mag_0"
- style_mag_id = pf['styles']['styleinfo'][style_mag]['id']
- oridout.append("\t\t\t\n")
- oridout.append("\t\t\t\t\n") # keep blank else too much noise on the map
- oridout.append("\t\t\t\t#%s\n" % style_mag_id)
- oridout.append("\t\t\t\t%s,%s\n" % (ev_dict['lon'],ev_dict['lat']))
- oridout.append("\t\t\t\t%s\n" % ev_dict['time_xml'])
- oridout.append("\t\t\t\t\n")
- oridout.append("Latitude: %s
\n" % ev_dict['auth'])
- oridout.append("]]>\n")
- oridout.append("\t\t\t\t\n")
- oridout.append("\t\t\t\n")
- oridout.append("\t\n")
- return ''.join(oridout)
-
-def create_site(meta_dict_site, visibility, style):
- """Create KML for site icons
- """
- # Convert to XML standard time
-
- siteplace = ["\t\t\n\t\t\t%s\n" % meta_dict_site['sta']]
- siteplace.append("\t\t\t%s\n" % visibility)
- siteplace.append("\t\t\t\n")
- siteplace.append("\t\t\t\t%s\n" % meta_dict_site['time_xml'])
- siteplace.append("\t\t\t\t%s\n" % meta_dict_site['endtime_xml'])
- siteplace.append("\t\t\t\n")
- siteplace.append("\t\t\t\n")
- siteplace.append("\t\t\t\t%s_%s\n" % (meta_dict_site['snet'],meta_dict_site['sta']))
- siteplace.append("\n")
- for sKey in sorted(meta_dict_site.iterkeys()):
- sVal = meta_dict_site[sKey]
- if sKey == 'sta' or sKey == 'snet':
- pass
- else:
- if sKey == 'elev':
- sVal = str(sVal) + ' meters'
- if isinstance(sVal, int) and sVal < 0:
- sVal = '-'
- siteplace.append("
%s: %s
\n" % (sKey.capitalize(), sVal))
- siteplace.append("\t\t\t\t]]>\n")
- siteplace.append("\t\t\t\n")
- siteplace.append("\t\t\t#%s\n" % style)
- siteplace.append("\t\t\t\n\t\t\t\tabsolute\n")
- siteplace.append("\t\t\t\t%s,%s,%s\n" % (meta_dict_site['lon'], meta_dict_site['lat'], meta_dict_site['elev']))
- siteplace.append("\t\t\t\n\t\t\n")
- return ''.join(siteplace)
-
-def get_site_records(dbmaster, stylestation, staexpr, fields, visibility, inactive, verbosity=0):
- """Get all the sites
- in the dbmaster
+
+ #mag, mag_sc = calc_magtype(ev_dict)
+
+ generate_origin_pts (opmtype_style,icon_method,ev_dict,pf_result)
+
+ return ""
+
+# end get_origin_records
+
+def generate_origin_pts (opmtype_style,icon_method,ev_dict,pf_result):
+ """For a single origin from the database (collected within get_origin_records)
+
+ Use the styling determined from choose_right_value
+ and add the placemark for the origin to the kml file, origins directory
+
+ Argument icon_method should be magnitude, depth, or default
+
+ Calls:
+ - choose_right_value - map origin depth or magnitude to appropriate depthcolor or magdepth
+ - calc_magtype - maps magnitude type and value (null magnitude replaced with '-'
+ """
+
+ # cleanup mag and magtype as needed
+ mag, mag_sc = calc_magtype(ev_dict)
+
+ dprint("\nwithin generate_origin_pts: opmtype_style is: ", opmtype_style)
+
+ if icon_method == 'default':
+ mystyle_id = choose_right_value(dict_str2ints(opmtype_style), -9999)
+ dprint("after choose_right_value for icon_method=default, mystyle_id is: ", mystyle_id)
+ myscaleval = mystyle_id['scale']
+ mynamed_style = mystyle_id['namedstyle']
+
+
+ elif icon_method == 'depth':
+ dprint('Trying both magnitude sizing and depth colorization for event with magnitude:', ev_dict['magnitude'], 'and depth:', ev_dict['depth'] )
+ mystyle_id = choose_right_value(dict_str2ints(opmtype_style), ev_dict['depth'])
+ dprint("after choose_right_value for icon_method=depth, mystyle_id is: ", mystyle_id)
+
+ if isinstance(mystyle_id['namedstyle'], dict):
+ mynamed_style = choose_right_value(dict_str2ints(mystyle_id['namedstyle']), ev_dict['magnitude'])
+ else:
+ mynamed_style = mystyle_id['namedstyle']
+
+ dprint("mystyle_id for this point with depth of", ev_dict['depth'], "is: ", mystyle_id)
+
+ elif icon_method == 'magnitude':
+ dprint('Trying magnitude sizing for event with magnitude: %s %s' % (ev_dict['magnitude'],ev_dict['magtype'] ))
+
+ if mag == "-":
+ mystyle_id = choose_right_value(dict_str2ints(opmtype_style), 0)
+ else:
+ mystyle_id = choose_right_value(dict_str2ints(opmtype_style), mag)
+
+ dprint("after choose_right_value for icon_method=magnitude, mystyle_id is: ", mystyle_id)
+
+ if isinstance(mystyle_id['scale'], dict):
+ scaledict = dict_str2ints(mystyle_id['scale'])
+ dprint("styling name is: %s \n\tscaledict is: %s" %(mystyle_id['stylename'], scaledict))
+
+ if mag == '-':
+ # hard code choice that it magnitude is null/-99.99, choose the first value for magnitude scaling
+ mystyle_id = choose_right_value(dict_str2ints(opmtype_style), 0)
+ myscaleval = choose_right_value(scaledict, 0)
+ dprint("null magnitude found, using a scale value of %s" % myscaleval)
+ else:
+ mystyle_id = choose_right_value(dict_str2ints(opmtype_style), mag)
+ myscaleval = choose_right_value(scaledict, float(mag))
+ dprint("setting scalefactor to %s for point with magnitude %s" % (myscaleval, mag) )
+
+ else:
+ myscaleval = mystyle_id['scale']
+
+ # HERE - this may need a check for type dict for mystyle_id['namedstyle']
+ #if isinstance(mystyle_id['namedstyle'], dict):
+ # print("DEBUG: namedstyle is a dict")
+ # mynamed_style = mystyle_id['namedstyle']
+ #else:
+ # print("DEBUG: namedstyle is not a dict")
+ # mynamed_style = mystyle_id['namedstyle']
+
+ mynamed_style = mystyle_id['namedstyle']
+
+ dprint("\n\t myscaleval is:", myscaleval, "for event at depth %s and magnitude %s" % (ev_dict['depth'], mag))
+
+ else:
+ print(' * ERROR * Should never get here, something is very broken' )
+ sys.exit()
+
+ # now generate placemark for kml
+ pnt = ofol.newpoint(coords=[(ev_dict['lon'],ev_dict['lat'])])
+
+ pnt.style = mynamed_style
+
+ if stock.yesno(pf_result['config']['origins']['indicate_when']):
+ pnt.timestamp.when = ev_dict['time_xml']
+
+ pnt.description = otext(ev_dict['lat'],ev_dict['lon'],ev_dict['depth'],ev_dict['time_readable'],mag,mag_sc,ev_dict['auth'],ev_dict['review'])
+
+ dprint("pnt.description is: ", pnt.description)
+ dprint("pnt.style is: %s \nfor %s " % (pnt.style, pnt.id) )
+
+ dprint("scaleval is:", pnt.style.iconstyle.scale, "for event at depth %s and magnitude %s" % (ev_dict['depth'], mag))
+
+
+def get_site_records(dbmaster, pf_result):
+ """Get all the site info from the dbmaster
+
+ Subset(s) from pf file are applied
+
+ Returns: a dictionary of dictionaries, allsite
+ - allsite keys are snet, values are dictionary of dictionaries
+ with key of 'sta' and values that are 'field1:val1", etc.'
"""
- if verbosity > 0:
- print "- Subsetting database '%s' for %s" % (dbmaster,staexpr)
+
+ staexpr = pf_result['config']['stations']['subsets']
+ use_deployment = pf_result['config']['stations']['use_deployment']
+ inactive = pf_result['config']['stations']['display_inactive']
+ my_sort_fields = pf_result['config']['stations']['sort_fields']
try:
db = datascope.dbopen(dbmaster, 'r')
except:
sys.exit( "* Cannot open database '%s'" % dbmaster )
+ if stock.yesno(use_deployment):
+ dbm = db.lookup(table='deployment')
+ dbm = dbm.join('site', outer=True)
+ fields = ['snet', 'sta', 'lat', 'lon', 'elev', 'staname', 'time', 'endtime']
+
+ if not stock.yesno(inactive):
+ # double negative (not displaying inactive stations)
+ vprint (" - Subsetting database '%s' for active stations based on deployment.endtime" % dbmaster)
+ dbm = dbm.subset('endtime == NULL || endtime > %s' % stock.now() )
+ vprint (" - dbsubset for active stations resulted in %d records" % (dbm.query('dbRECORD_COUNT')) )
+
+ else:
+ dbm = db.lookup(table='site')
+ fields = ['snet', 'sta', 'lat', 'lon', 'elev', 'staname', 'ondate', 'offdate']
+
+ if not stock.yesno(inactive):
+ # double negative (not displaying inactive stationss)
+ vprint (" - Subsetting database '%s' for active stations based on site.offdate" % dbmaster)
+ dbm = dbm.subset('offdate == NULL || offdate > %s' % stock.yearday(stock.now()) )
+ vprint (" - dbsubset for active stations resulted in %d records" % (dbm.query('dbRECORD_COUNT')) )
- dbm = db.lookup(table='deployment')
- dbm = dbm.join('site', outer=True)
dbm = dbm.join('snetsta', outer=True)
- dbm = dbm.sort( ['snet','sta'] )
+
+ try:
+ precision = pf_result['config']['stations']['precision']
+ vprint(" - Truncating lat/lon for site to %s places" % precision)
+ except:
+ vprint(" - Using full lat/lon precision")
+ dbq = dbm.lookup(field='lat', record='dbNULL')
+ print("dbq is:", dbq)
+
+ precision = dbq.query("dbFIELD_FORMAT")
+ precision = str(precision).split('.')[1][0]
+ dprint("precision defined from schema is:", precision)
+
+ sortstring = []
+ for msf in my_sort_fields:
+ sortstring.append(msf)
+
+ dbm = dbm.sort(sortstring)
for nex in staexpr:
if nex:
+ vprint (" - Subsetting database based on expression '%s'" % nex )
dbm = dbm.subset('%s' % nex )
-
- if not stock.yesno(inactive):
- if verbosity > 0:
- print "- Subsetting database '%s' for active stations" % dbmaster
- dbm = dbm.subset('endtime == NULL || endtime > %s' % stock.now() )
-
+ vprint (" - dbsubset '%s' resulted in %d records" % (nex, dbm.query('dbRECORD_COUNT')) )
if dbm.query('dbRECORD_COUNT') < 1:
if len(staexpr) > 0:
- print "* ERROR: Dbmaster database (%s) generated view contains no records. Check your expressions." % dbmaster
+ print ("* ERROR: Dbmaster database (%s) generated view contains no records. Check your expressions." % dbmaster)
else:
- print "* ERROR: Dbmaster database (%s) generated view contains no records." % dbmaster
+ print ("* ERROR: Dbmaster database (%s) generated view contains no records." % dbmaster)
sys.exit(1)
+ mynet = ''
+
+ allsite = {}
+
+ dprint("Starting loop over range of dbm records")
-
- sitestr = []
- openfolder = False
- activenet = ''
- nownet = ''
for i in range(dbm.query('dbRECORD_COUNT')):
dbm.record = i
- per_sta_info = {}
- per_sta_info['lat'] = dbm.getv('lat')[0]
- per_sta_info['lon'] = dbm.getv('lon')[0]
- per_sta_info['elev'] = dbm.getv('elev')[0]
+ for f in fields:
+ if f == 'snet':
+
+ mynet = dbm.getv('snet')[0]
+
+ try:
+ allsite[mynet]
+ except:
+ vprint ("\n - Gathering site info for network '%s'" % mynet )
+ allsite[mynet] = {}
+
+ elif f == 'sta':
+
+ mysta = dbm.getv('sta')[0]
+ try:
+ allsite[mynet][mysta]
+ except:
+ allsite[mynet][mysta] = {}
+ vprint (" - Collecting site info for station '%s'" % mysta )
+
+ elif f == 'elev':
+ allsite[mynet][mysta]['elev'] = dbm.getv('elev')[0] * 1000
+
+ elif f == 'time':
+ time = parseepoch( dbm.getv('time')[0] )
+ # this gets rid of stations prior to 1970
+ #if time < 0: continue
+ allsite[mynet][mysta]['time'] = time
+ allsite[mynet][mysta]['time_xml'] = stock.epoch2str(time, "%Y-%m-%dT%H:%M:%SZ")
+ allsite[mynet][mysta]['time_readable'] = stock.epoch2str(time, "%m/%d/%Y (%j)")
+
+ elif f == 'endtime':
+ endtime = parseepoch( dbm.getv('endtime')[0] )
+
+ if not int(endtime) or stock.now() < endtime:
+ endtime = stock.now()
+
+ allsite[mynet][mysta]['endtime'] = endtime
+ allsite[mynet][mysta]['endtime_xml'] = stock.epoch2str(endtime, "%Y-%m-%dT%H:%M:%SZ")
+ allsite[mynet][mysta]['endtime_readable'] = stock.epoch2str(endtime, "%m/%d/%Y (%j)")
+
+ elif f == 'ondate':
+ time = stock.epoch( dbm.getv('ondate')[0] )
+ # from original code:
+ # this gets rid of stations prior to 1970, which is not what we want
+ #if time < 0: continue
+ allsite[mynet][mysta]['time'] = time
+ allsite[mynet][mysta]['time_xml'] = stock.epoch2str(time, "%Y-%m-%dT%H:%M:%SZ")
+ allsite[mynet][mysta]['time_readable'] = stock.epoch2str(time, "%m/%d/%Y (%j)")
+
+ elif f == 'offdate':
+ offdate = dbm.getv('offdate')[0]
+
+ if (offdate == -1) or (stock.now() < stock.epoch(offdate)) :
+ endtime = stock.now()
+ else:
+ endtime = stock.epoch(offdate)
+
+ allsite[mynet][mysta]['endtime'] = endtime
+ allsite[mynet][mysta]['endtime_xml'] = stock.epoch2str(endtime, "%Y-%m-%dT%H:%M:%SZ")
+ allsite[mynet][mysta]['endtime_readable'] = stock.epoch2str(endtime, "%m/%d/%Y (%j)")
+
+ elif f == 'lat' or f == 'lon':
+ allsite[mynet][mysta][f] = round(dbm.getv(f)[0],int(precision))
+ dprint("Precision adjusted lat/lon:", allsite[mynet][mysta][f])
+
+
+ else: # anything else
+ allsite[mynet][mysta][f] = dbm.getv(f)[0]
+
+ dprint("Time: %s Endtime: %s" % (allsite[mynet][mysta]['time_readable'], allsite[mynet][mysta]['endtime_readable'] ))
+
+ dprint("allsite is:\n", allsite)
+ return(allsite)
+
+# end get_site_records
+
+def generate_site_pts(allsite,station_style,sfol):
+ """Generate site placemarks For each station collected within get_site_records
+
+ Create a snet based folder for viewing in Google Earth list view
+ and add a placemark for the site to the kml file, Stations/snet directory
+ or to Stations/others
+
+ """
+
+ sfnames = {}
+
+ dprint("allsite.keys is: ", allsite.keys())
+ vprint("\n Gather site placemarks into named folders based on snet")
+
+ for key in allsite.keys():
+ # create a network named folder in sfol if key exists in station_style
+ # otherwise, create "others" folder if it does not exist
+
+ # had previously used by_network[net]['stylename']
+ # but I decided calling folders the same as the by_network key was sufficient
+
+ dprint("station_style.keys is: ", station_style.keys())
+ if key in station_style.keys():
+ # if true, this means no folder for this station group exists
+ # but we do have style info (i.e. it does not have to plot into 'others')
+
+ if key not in sfnames.keys():
+ # populate the sfnames dict
+ sfnames[key] = key
+ netfol = sfol.newfolder(name=key,open=0)
+ vprint(" - Created station snet folder named", key)
+
+ else:
+ if 'others' not in sfnames.values():
+ netfol = sfol.newfolder(name='others',open=0)
+ othersfol = netfol
+ vprint(" - Created catch-all snet folder named 'others'")
+ else:
+ # do something here to force folder to be used to be pre-existing 'others' folder
+ dprint("folder named 'others' already exists")
+ netfol = othersfol
+
+ sfnames[key] = 'others'
+
+ # now loop through each of the sta's in allsite for this network/key
+
+ for s in allsite[key].keys():
+ # now generate placemark for kml
+ lat = allsite[key][s]['lat']
+ lon = allsite[key][s]['lon']
+ pnt = netfol.newpoint(coords=[(lon,lat)],name=s)
+
+
+ try:
+ pnt.style = station_style[key]['namedstyle']
+ except:
+ pnt.style = station_style['others']['namedstyle']
+
+ # this is likely a problem since scale is now set in sharedstyle???
+
+ try:
+ pnt.iconstyle.scale = station_style[key]['scale']
+ except:
+ pnt.iconstyle.scale = station_style['others']['scale']
+
+ if stock.yesno(pf_result['config']['stations']['indicate_when']):
+ pnt.timestamp.when = allsite[key][s]['time_xml']
+
+ if stock.yesno(pf_result['config']['stations']['suppress_label']):
+ pnt.style.labelstyle.scale = 0
+
+ pnt.description = stext(key,s,allsite)
+
+ return ""
+# end generate_site_pts
+
+def href2kmz(kmzdir,myurl,altname):
+ """Modify href if using kmz with saved images
+
+ Checks if requested img is on local disc, web image, or api call
+ Opens image and determines img format
+
+ kmzdir is system's default tmp dir (see mk_kmzdir)
+ altname is the alternate name for file (needed especially for api collected images)
+
+ Returns: href for use in icon styling
+ """
+
+ if not altname:
+ altname = "dummy"
+
+ if kmzdir:
+
+ # need to program a try/except for this to deal with non-http, i.e. file://
+ try:
+ dprint("attempting api collected image %s" % myurl)
+ img_file = requests.get(myurl, stream=True).raw
+ except:
+ # does myurl start with "file://"
+ if(re.match("file://", myurl)):
+ dprint ("%s uses 'file://' convention" % myurl)
+ # strip off leading "file://"
+ img_file = myurl.removeprefix("file://")
+ else:
+ img_file = myurl
+
+ dprint("img_file is: ", img_file)
+
+ try:
+ img = Image.open(img_file)
+ except:
+ sys.exit("ERROR: Failed to open image file from %s" % myurl)
+
+ ext = img.format
+
+ dprint("image format is:", ext)
+ dprint("before any rename, filename is:", Path(str(myurl)).name)
+
+ # Need to regex the filename to see if it has "?" or "&" or "#" or "%23" or "%26",
+ # if so, it's an api call
+
+ regex = '[@#&%]'
+
+ # Compile the regex
+ r = re.compile(regex)
+
+ if r.search(Path(str(myurl)).name):
+ myfilename = altname + '.' + ext
+ dprint("Found an api file match. Will set filename to %s" % myfilename)
+ else:
+ myfilename = Path(str(myurl)).name
+
+ dprint("filename to be saved is:", myfilename)
+
+ kmlhref = kmzdir + '/' + myfilename
+
+ dprint("kmlhref inside href2kmz is:", kmlhref)
+
+ #img = img.save(kmlhref)
+
+ if os.path.isfile(kmlhref):
+ # file exists
+ dprint("image file %s already exists" % kmlhref)
+ else:
+ img = img.save(kmlhref)
+ vprint(" - Adding %s to kmz image directory" % myfilename)
+
+ else:
+ kmlhref = myurl
+
+ return kmlhref
+
+def plot_overlays(overlays,kmzdir,args):
+ """plot overlay images such as a logo
+
+ if overlay has plotthis set to 'no' in pf, skip plotting
+
+ if args.testoverlay, interrupt full kml/kmz generation
+ to produce test file that has no site or origin placemarks
+ """
+
+ # only open a overlays folder if there are overlays to plot
+
+ ovfol = ''
+ ocnt = 1
+
+ vprint ("\n - Add overlay images")
+
+ for o in overlays:
+
+ try:
+ if stock.yesno(overlays[o]['plotthis']):
+ dprint("Plotting overlay image for ", o)
+ vprint(" - Per plotthis in pf file, plotting overlay:", o)
+ if not ovfol:
+ ovfol = kml.newfolder(name='overlays',open=0)
+ else:
+ vprint(" -> Per plotthis in pf file, skipping overlay:", o)
+ dprint("Skipping plotting of overlay image for", o)
+ continue
+ except:
+ dprint("no plotthis parameter for", o, "...continuing")
+
+ vprint(" - Placing overlay:", o)
+ oxy = overlays[o]['overlayXY']
+ sxy = overlays[o]['screenXY']
+ sz = overlays[o]['size']
+
+ oxu = 'simplekml.Units.' + oxy['xunits']
+ oyu = 'simplekml.Units.' + oxy['yunits']
+
+ sxu = 'simplekml.Units.' + sxy['xunits']
+ syu = 'simplekml.Units.' + sxy['yunits']
+
+ szxu = 'simplekml.Units.' + sz['xunits']
+ szyu = 'simplekml.Units.' + sz['yunits']
+
+ screen = ovfol.newscreenoverlay(name=overlays[o]['name'])
+
+ # I have tried a million times and cannot get the icon to show up in list view
+ #screen.style.liststyle.itemicon.href = screen.icon.href
+
+ if kmzdir:
+ # fix the href for img_file
+ screen.icon.href = href2kmz(kmzdir,overlays[o]['imgsrc'],'ov' + str(ocnt))
+
+ # BUG - I cannot get the list icon to show up
+ #screen.style.liststyle.itemicon.href = screen.icon.href
+ # increment cnt in case of api file nameing needs
+ ocnt += 1
+
+ else:
+ screen.icon.href = str(overlays[o]['imgsrc'])
+
+
+ screen.overlayxy = simplekml.OverlayXY(x=oxy['x'],y=oxy['y'],xunits=oxu,yunits=oyu)
+ screen.screenxy = simplekml.ScreenXY(x=sxy['x'],y=sxy['y'],xunits=sxu,yunits=syu)
+
+
+ screen.rotation = overlays[o]['rotation']
+
+ # a way to scale the overlay image
+ screen.size.x = sz['x']
+ screen.size.y = sz['y']
+ screen.size.xunits = szxu
+ screen.size.yunits = szyu
+
+ # still can't get image to show up in list view
+ #screen.liststyle.itemicon.href = screen.icon.href
+ #screen.style.liststyle.itemicon.href = screen.icon.href
+ #screen.iconstyle.icon.href = screen.icon.href
+
+ if args.testoverlay:
+ print("\nTEST MODE: saving to %s to check overlay placement(s)" % args.testoverlay)
+ try:
+ kml.savekmz(args.testoverlay)
+
+ for o in overlays:
+ oxy = overlays[o]['overlayXY']
+ sxy = overlays[o]['screenXY']
+ sz = overlays[o]['size']
+ vprint("Paramters for overlay %s:" % o)
+ vprint(" - overlayXY: %s %s %s %s" % (oxy['x'], oxy['xunits'], oxy['y'], oxy['yunits']))
+ vprint(" - screenXY: %s %s %s %s" % (sxy['x'], sxy['xunits'], sxy['y'], sxy['yunits']))
+ vprint(" - size: %s %s %s %s" % (sz['x'], sz['xunits'], sz['y'], sz['yunits']))
+
+ except:
+ print("Some exception occurred when saving kmz", args.testoverlay)
+
+ print("Review overlay settings in Google Earth by opening", args.testoverlay)
+ sys.exit()
+
+ return()
+
+
+def add_camera(pf_result,obj):
+ """ Add a starting visibility for the kml
+
+ Allows Google Earth to zoom automatically to given location
+ """
+
+ vprint(" - Adding camera info to object: '%s'" % obj.name)
+ cam = pf_result['headers']['camera']
+
+ obj.camera.latitude = cam['latitude']
+ obj.camera.longitude = cam['longitude']
+ obj.camera.altitude = cam['altitude']
+ obj.camera.tilt = cam['tilt']
+
+# end add_camera
+
+def generate_lookat(pf_result,plottype,folder):
+ """ Add LookAt information for an object (normally a folder containing placemarks)
+
+ Allows Google Earth to zoom automatically to a given location
+ """
+
+ la = pf_result['styles'][plottype]['look_at']
+ vprint (" - Adding lookat to object:", folder.name)
+
+ folder.lookat.latitude = la['latitude']
+ folder.lookat.longitude = la['longitude']
+ folder.lookat.range = la['range']
+
+# end generate_lookat
+
+def map_sta_stylename (mydict, pfstyle ):
+ """ because simplekml does not let you set the style.id, here is a dict to map
+ the random number given to the style to something useful
+ along with other parameters needed. Used for sites. See map_useful_stylename for origins.
+
+ Called by kml_styles
+
+ Calls href2kmz
+
+ Returns: my_style
+ """
+
+ my_style = {}
+
+ for key in sorted(mydict.keys()):
+ my_style[key] = {}
+
+ stastat_fields = ['scale', 'imagesrc']
+
+ for ss in stastat_fields:
+ my_style[key][ss] = mydict[key][ss]
+
+
+ my_style[key]['namedstyle'] = 'style{0}'.format(key)
+
+ dprint("namedstyle within map_sta_stylename is:", my_style[key]['namedstyle'])
+
+ # try to get href with kmz
+ fullhref = my_style[key]['imagesrc']
+
+ my_style[key]['style_href'] = href2kmz(kmzdir,fullhref,my_style[key]['namedstyle'])
+
+ dprint("my_style for %s is: %s" % (key,my_style))
+
+ try:
+ style_scale = mydict[key]['iconscale']
+ except:
+ style_scale = mydict[key]['scale']
+
+ my_style[key]['scale'] = style_scale
+
+ dprint("style_href for ",key, "is:", my_style[key]['style_href'])
+
+ return(my_style)
+
+# end map_sta_stylename
+
+def map_useful_stylename (mydict, pfstyle, icon_method):
+ """ because simplekml does not let you set the style.id, here is a dict to map
+ the random number given to the style to something useful
+ along with other parameters needed: style_href, scalefactor , scale
+
+ Used for origins. See map_sta_stylename for sites
+
+ Called in kml_styles
+
+ Calls href2kmz, get_sf_magscale
+ """
+
+ my_style = {}
+
+
+ try:
+ my_magscale = pfstyle['magscale']
+ dprint("origin magnitude styling is: \n", my_magscale)
+ except:
+ sys.exit("Can't parse magscale from pf->styles->origin")
+
+ for key in mydict.keys():
+ my_style[key] = {}
+
+ # i.e. -2dep-style, 3mag-style, etc.
+ ustyle_name = str(key) + str(icon_method)[:3]
+ dprint("pretty style_name is:", ustyle_name)
+ dprint("my_style is:", my_style)
+
+ my_style[key]['stylename'] = ustyle_name
+ my_style[key]['namedstyle'] = ustyle_name + '-style'
+
+ dprint("namedstyle is:", my_style[key]['namedstyle'])
+
+ # fullhref build varies betwen stations (possibly non-api) and origins (only api??)
+ # for depth/mag pfstyle = origin_styles
+
+
+ if icon_method : # for stations icon_method will be ""
+
+ try:
+ mydict[key]['api_params']
+ fullhref = mydict[key]['imgsrc'] + mydict[key]['api_params']
+ except:
+ fullhref = mydict[key]['imgsrc']
+
+ else:
+ print("Should never get here as map_useful_stylename is only for origins")
+ sys.exit()
+
+ dprint("complicated href:", fullhref)
+
+ my_style[key]['style_href'] = href2kmz(kmzdir,fullhref,my_style[key]['namedstyle'])
+
+ dprint("style_href before I set sharedstyle is:", my_style[key]['style_href'])
+
+ # need to put scale info into my_style
+ sf = mydict[key]['scalefactor']
+
+ # convert sf if scalefactor is 'magscale'
+ # if sf is not 'magscale', get_sf_magscale will return
+ # either '1' or given scale from pfstyle
+
+ dprint("Before get_sf_magscale shenanigans, sf is:", sf)
- time = parseepoch( dbm.getv('time')[0] )
- if time < 0: continue
+ sf = get_sf_magscale(sf,icon_method,pfstyle,key)
+
+ dprint("After get_sf_magscale shenanigans, sf is:", sf)
- per_sta_info['time'] = time
- per_sta_info['time_xml'] = stock.epoch2str(time, "%Y-%m-%dT%H:%M:%SZ")
+ # indent may be incorrect here and have to go <<<
+ my_style[key]['scale'] = sf
+ return(my_style)
- endtime = parseepoch( dbm.getv('endtime')[0] )
- if not int(endtime) or stock.now() < endtime:
- endtime = stock.now()
- per_sta_info['endtime'] = endtime
- per_sta_info['endtime_xml'] = stock.epoch2str(endtime, "%Y-%m-%dT%H:%M:%SZ")
+# end map_useful_stylename
- nownet = dbm.getv('snet')[0]
- per_sta_info['snet'] = nownet
- per_sta_info['sta'] = dbm.getv('sta')[0]
- if nownet in stylestation:
- stastyle = nownet
+def get_sf_magscale (sf,icon_method,pfstyle,val):
+ """ converts input sf (scalefactor) from dict (magscale) to numeric sf
+
+ Calls get_magscale(pfstyle,val)
+
+ Called by map_useful_stylename
+
+ Returns: newly mapped sf
+ """
+
+ if sf == 'magscale':
+ dprint("scalefactor depends on magnitude map in magsacle for %s" % val )
+
+ # if icon_method is magnitude, then pull out mapped scale factor
+ # if icon_method is depth, you have to create new style for each magnitude
+
+ if icon_method == 'magnitude':
+ # get mapped magnitude scale
+ dprint("Trying get_magscale")
+ sf = get_magscale(pfstyle,val)
+ else:
+ # insert magscale to mydict (append/map dictionary to key 'scale')
+ sf = pfstyle['magscale']
+
+ else:
+ try:
+ sf = float(sf)
+ except ValueError:
+ print("ERROR: scalefactor %s for %s is neither a float or 'magscale'" % (sf , val) )
+ print(" - setting scalefactor to '1.0' ")
+ sf = 1
+
+ dprint("sf within get_sf_magscale is now:", sf)
+
+ return(sf)
+
+def make_sharedstyle(mystyle,icon_method):
+ """ make a shared style using simplekml
+
+ Note: only shared styles which are used by a placemark show up in output kml/kmz file
+ """
+
+ # icon_method can be 'default', 'magnitude', or 'depth'
+ # key is either a depth or a magnitude deliniation (compare later against actual values from db)
+
+ dprint ("icon_method within make_sharedstyle is:", icon_method)
+
+ for key in mystyle.keys():
+
+ if isinstance(mystyle[key]['scale'], dict):
+
+ mystyle[key]['namedstyle'] = {}
+
+ for sckey in mystyle[key]['scale']:
+ # this creates a style per each scalefactor, not the most efficient thing,
+ # but I cannot scale each individual point when using a shared style. Sigh.
+ # On the plus side, the saved kmz will only contain the sharedstyles
+ # that are "used" by the origins
+
+ dprint("Working on scaling %s for %s %s..." % (sckey, icon_method, key) )
+
+ sharedstyle = simplekml.Style()
+ dprint("\n\tStyle id for varied scale value %s with key %s for type %s is: %s " % ( sckey, key, icon_method, sharedstyle.id ) )
+
+ sharedstyle.iconstyle.scale = mystyle[key]['scale'][sckey]
+
+ sharedstyle.liststyle.itemicon.href = mystyle[key]['style_href']
+ sharedstyle.iconstyle.icon.href = mystyle[key]['style_href']
+ sharedstyle.balloonstyle.text = "$[description]"
+ sharedstyle.balloonstyle.bgColor = "ffffffff"
+ sharedstyle.balloonstyle.Color = "ffffffff"
+
+ ## original code had customizable scale for LableStyle... ignoring
+ ## See https://developers.google.com/kml/documentation/extendeddata
+ ## for discussion of using extended data for balloon filling text
+
+ # modify namedstyle to
+ mystyle[key]['namedstyle'][sckey] = sharedstyle
+
+ dprint("namedstyle for %s-%s is now:\n %s" % (key, sckey, sharedstyle))
+ dprint( "sharedstyle after balloonstyle setting:", sharedstyle)
+
+ else:
+
+ dprint("namedstyle when scale is a value for key %s is:\n %s" % ( key, mystyle[key]['namedstyle']) )
+ sharedstyle = simplekml.Style()
+
+ dprint("\n\t Style id is: ", sharedstyle.id, "\n" )
+
+ # is there any case where mystyle[key]['scale'] is not defined??? Might need to check for that and set scale to 1?
+
+ sharedstyle.iconstyle.scale = mystyle[key]['scale']
+ sharedstyle.liststyle.itemicon.href = mystyle[key]['style_href']
+ sharedstyle.iconstyle.icon.href = mystyle[key]['style_href']
+ sharedstyle.balloonstyle.text = "$[description]"
+ sharedstyle.balloonstyle.bgColor = "ffffffff"
+ sharedstyle.balloonstyle.Color = "ffffffff"
+
+ mystyle[key]['namedstyle'] = sharedstyle
+
+ dprint( "sharedstyle after balloonstyle setting:", sharedstyle)
+
+
+
+ dprint("useful style name to sharedstyle map:", mystyle[key]['namedstyle'])
+
+ # mystyle is now a dictionary that maps the read-only style.id
+ # to the "what I would call the style if I could set the id" style_name
+
+ dprint("\nDictionary with mapped style info:\n", mystyle,"\n")
+
+ dprint("sharedstyle within make_sharedstyle, outside for loop:", sharedstyle)
+
+ return sharedstyle
+
+# end make_sharedstyle
+
+def parse_placemark_model(origin_styles,icon_method,opmmodel):
+ """interpret placemark model for origins
+ select color from depthcolor if placemark model uses dynamic coloring
+ select magnitude scaling if model uses dynamic scaling
+
+ Currently only 'depth', 'magnitude', or 'default' are accepted as icon_method
+
+ Calls: build_api_href
+
+ Returns: mymodel
+
+ """
+
+ vprint (" - Generating icon styles based on '%s'" % icon_method)
+
+ mymodel = {}
+
+ dprint("icon_method is:", icon_method, "opmmodel is:", opmmodel)
+
+ if icon_method == 'depth' or icon_method == 'magnitude':
+ myfields = ['depth', 'scalefactor', 'imgsrc', 'api_params']
+ elif icon_method == 'magnitude':
+ myfields = ['magnitude', 'scalefactor', 'imgsrc', 'api_params']
+ elif icon_method == 'default':
+ defpm = origin_styles['placemarks']['default']
+ myfields = ['magnitude', 'scalefactor', 'imgsrc']
+ myvalues = [ '-9999', defpm['scale'], defpm['imgsrc'] ]
+ mymodel['-9999'] = dict(zip(myfields,myvalues))
+ else:
+ vprint("programming for interpretting a styling based on '%s' has not been done" % icon_method)
+ sys.exit()
+
+ # take named model, and pull in values for it
+ if opmmodel:
+ opmmodel = origin_styles['placemarks'][icon_method][opmmodel]
+
+ for l in opmmodel:
+ if l.strip() == "":
+ continue
+
+ myvalues = str(l).split()
+ myval = str(l).split()[0]
+
+ try:
+ myapis = str(l).split()[3]
+ except:
+ myapis = ""
+
+ if(re.match("\?", myapis)):
+ dprint("Chosen api values are %s" % myapis)
+
+ elif myapis:
+ if origin_styles['api_params'][myapis] :
+
+ # if any of the values are 'depthcolor' or 'magscale', interpret
+ # this is now done later, for instance in generate_origin_pts
+ #if 'depthcolor' in list(origin_styles['api_params'][myapis].values()):
+ # print("One of the params is depthcolor")
+ #if 'magscale' in list(origin_styles['api_params'][myapis].values()):
+ # print("One of the params is magscale")
+
+ api2add = build_api_href(origin_styles['api_params'][myapis],origin_styles,myval)
+ dprint("api2add is:", api2add)
+
+ myvalues[3] = api2add
+
+ mymodel[myval] = dict(zip(myfields,myvalues))
+
+ else:
+ print("ERROR: Can't find ", myapis, "in origin_styles['api_params'][myapis]")
+ sys.exit()
+ else:
+ dprint("There are no api modifications")
+
+ mymodel[myval] = dict(zip(myfields,myvalues))
+
+ return mymodel
+
+
+def kml_styles(pf_result,args):
+ """Create KML styles
+
+ Calls: generate_lookat, parse_placemark_model, map_useful_stylename, make_sharedstyle, map_sta_stylename
+
+ Returns: opmtype_style, station_style, ofol, sfol, icon_method, opmmodel, sharedstyle
+
+ """
+
+ #vprint ("- Write out styles")
+ #vprint ("- Generating icon styles")
+
+ #should create a separate folder for station styles vs origin styles
+
+
+ ofol = ""
+ origin_styles = pf_result['styles']['origins']
+ opmtype_style = {}
+ opmmodel = ""
+ icon_method = ""
+
+ sfol = ""
+ station_style = {}
+ sta_styles = pf_result['styles']['stations']
+
+ dprint("origin_styles = ", origin_styles)
+ dprint("sta_styles = ", sta_styles)
+
+ dprint("What are you attempting to plot?", args.c)
+
+ if args.c == 'origins' or args.c == 'all':
+
+ vprint ("\n - Generating icon styles for origins")
+ ofol = kml.newfolder(name="origins",open=0)
+
+ if origin_styles['look_at']:
+ # add look_at info to folder
+ generate_lookat(pf_result,'origins',ofol)
+
+
+ if args.opm :
+ dprint("an origin placemark option was chosen - ", args.opm)
+ if args.opm == 'default':
+ dprint("using default origin placemark plotting")
+ icon_method = 'default'
+ opmmodel = ''
+ else:
+ try:
+ icon_method,opmmodel = str(args.opm).split(':')
+ except:
+ msg = "Cannot parse origin placemark model choice via -opm "
+ msg = msg + args.opm + "\nVerify you split field:model with a ':'"
+ sys.exit(msg)
else:
- stastyle = 'others'
+ dprint("using default origin placemark plotting")
+ icon_method = 'default'
+ opmmodel = ''
+
+ dprint("icon_method is:", icon_method)
+ dprint("opmmodel is:", opmmodel)
+
+ # check to see if icon_model is 'magnitude', 'depth', or ''
+ allowed_im = ['magnitude', 'depth', 'default', '']
+
+ if icon_method not in allowed_im:
+ msg = "ERROR: Chosen origin placemark sorting field via -opm is not found: "
+ msg = msg + icon_method + "\nValid values are one of: "
+ msg = msg + ' or '.join(allowed_im)
+ sys.exit(msg)
+
+
+ # check to see if opmmodel exists, retrieve it
+
+ if opmmodel and opmmodel in origin_styles['placemarks'][icon_method].keys():
+ dprint("Interpretting placemark model", opmmodel)
+ elif not opmmodel :
+ dprint("using default rather than an opmmodel")
+
+ else:
+ print("Cannot find your chosen model -", opmmodel ,"- in styles{origins}{placemarks}{", icon_method, "} section of pf")
+ sys.exit()
+
+ mymodel = parse_placemark_model(origin_styles,icon_method,opmmodel)
+
+ opmtype_style = map_useful_stylename (mymodel, origin_styles, icon_method)
+
+ dprint("opmtype_style:\n", opmtype_style)
+
+ # below makes numerous styles based on keys of opmtype_style
+ # icon_method can be 'default', 'magnitude', or 'depth'
+
+ sharedstyle = make_sharedstyle(opmtype_style,icon_method)
+
+
+ if args.c == 'stations' or args.c == 'all':
+ vprint ("\n - Generating icon styles for stations")
+ sfol = kml.newfolder(name="stations",open=1)
+
+ if pf_result['styles']['stations']['look_at']:
+ # add look_at info to folder
+ generate_lookat(pf_result,'stations',sfol)
+
+ my_sta_styles = pf_result['styles']['stations']['by_network']
+
+ # insert check here to verify that a default catchall of 'others' is defined in my_sta_styles
+
+ if 'others' not in my_sta_styles.keys():
+ sys.exit("ERROR: 'others' named array is undefined. Check styles:stations:by_network\nCheck your pf file")
+
+ #dprint("my_sta_styles is:", my_sta_styles)
+
+ station_style = map_sta_stylename (my_sta_styles, pf_result['styles']['stations'])
+ sharedstyle = make_sharedstyle(station_style,'station')
+
+ # this dprint is pointless as shared styles don't show up in kml.kml() unless they have an object/placemark
+ #dprint("Within, but at end of kml_styles:", kml.kml())
+
+ return (opmtype_style, station_style, ofol, sfol, icon_method, opmmodel, sharedstyle)
- # Lets color them by network...
+# end kml_styles
- if nownet != activenet and openfolder:
- sitestr.append("\t")
- openfolder = False
- activenet = ''
+def build_api_href(apips,origin_styles,myval):
+ """Interpret api parameters for origin styles
- try:
- fullname = "%s: %s" % (nownet,stylestation[nownet]['name'])
- except:
- fullname = "%s: - " % nownet
+ If one of arrays in api_params has a param with regex = 'color', then value
+ is validated via validate_hexcolor
- if not openfolder:
- openfolder = True
- activenet = nownet
- sitestr.append("\t")
- sitestr.append("\t\t%s" % visibility)
- sitestr.append("\t\t%s" % fullname )
- sitestr.append("\t\t#%s\n" % nownet)
+ Calls:
+ - validate_hexcolor
+ - choose_right_value
+
+ Returns: apistring
+ """
- sitestr.append(create_site(per_sta_info, visibility, stastyle))
+ apistring = '?'
+ apk = 0
+ for apk in apips.keys():
+ apv = apips[apk]
+ dprint("apk: %s apv: %s" % (apk, apv))
- sitestr.append("\t")
+ # logic hardcode...
+ # if key has regex match to "color", then pass through validate_hexcolor
+ if(re.search('color', apk)):
+ dprint("Found an api parameter that is likely a color")
+ dprint("Going to run validate_hexcolor")
- return ''.join(sitestr)
+ if(re.search('depthcolor', apv)):
+ dprint("Found an api parameter that is set to depthcolor")
-def generate_legend(legendurl):
- """Generate legend
+ depthcolor = dict_str2ints(origin_styles['depthcolor'])
+ mycolorname = choose_right_value(depthcolor, float(myval))
+
+ apv = validate_hexcolor(mycolorname)
+ dprint(" Param: %s Depth: %s Color: %s" % (apk, myval, apv))
+
+
+ # This may be a problem/bug since I have not programmed anything
+ if(re.search('magscale', apv)):
+ print("Found an api parameter that is a magscale ")
+ print("ERROR: have not programmed for this eventuallity")
+ sys.exit()
+ # Do somehting??
+ # Can/cannot that the key = size?
+ # compare with default[size] and do math?
+
+
+ if apistring == '?':
+ # do not add "%26" (which is &) if it is the first parameter
+ apistring = apistring + apk + '=' + apv
+ else:
+ # add "%26" (which is &) if it is *not* the first parameter
+ apistring = apistring + '%26' + apk + '=' + apv
+
+ return(apistring)
+
+def dict_str2ints (mydict):
+ """need to convert keys of dictionary to
+ ints from str in order to get properly ordered
+ """
+
+ mydict = {int(k):v for k,v in mydict.items()}
+ mydict = dict(sorted(mydict.items()))
+
+ return mydict
+
+def otext(lat,lon,depth,time,mag,magtype,auth,review):
+ """ Gather text for putting in description balloon for origins
+ """
+
+ text = ''
+
+ if review == '-':
+ review = "no"
+ elif review == 'y':
+ review == "yes"
+
+ startcdata = "\n"
+
+ tlat = "
Latitude: %s
\n" % lat
+ tlon = "
Longitude: %s
\n" % lon
+ tdepth = "
Depth(km): %s
\n" % depth
+ ttime = "
Time: %s
\n" % time
+ tmagnitude = "
Magnitude: %s%s
\n" % (mag, magtype)
+ tauth = "
Author: %s
\n" % auth
+ trev = "
Reviewed? %s
\n" % review
+
+ text = startcdata + tlat + tlon + tdepth + ttime + tmagnitude + tauth + trev + endcdata
+
+ return(text)
+
+
+def stext(snet, sta, allsite ):
+ """ Gather text for putting in description balloon for site
+ """
+
+ text = ''
+
+ startcdata = "\n"
+
+ tsnetsta = "
\n" % allsite[snet][sta]['endtime_readable']
+
+ text = startcdata + tsnetsta + hr + tstaname + tlat + tlon + telev + ton + toff + endcdata
+
+ return(text)
+
+def validate_hexcolor(colorstr):
+ """ validate color code, is it hex or no
+
+ See: https://www.geeksforgeeks.org/how-to-validate-hexadecimal-color-code-using-regular-expression/
+
+ Assumes that any non-hex string is a valid colorname - perilous!
+
+ Returns: colorstr
+ """
+
+ # regex to check valid hexadecimal color code.
+ # 3 or 6 characters using A-F and/or 0-9
+ regex = "^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$"
+
+ # Compile the ReGex
+ r = re.compile(regex)
+
+ # check colorstr if a '#' is prepended
+ pstr = '#' + colorstr
+
+ if(colorstr == None):
+ # raise exception??
+ return False
+
+ # Return if the string matched the regex
+ # most input strings will not have leading '#'
+
+ if(re.search(r, colorstr)):
+ # this assumes correcly formatted hex string (unlikely unless "#" is escaped in pf file)
+ return str
+ elif(re.search(r, pstr)):
+ dprint("color", colorstr, "is a hex if I add a '#'")
+ dprint("modifying", colorstr, "to have %23 prepended for api call" )
+ pstr = '%23' + colorstr
+ return pstr
+ else:
+ # this assumes color string is something like "orange"
+ return colorstr
+
+def mk_kmzdir(args):
+ """ get path and keep/delete status of temporary
+ imagedir for kmz images
+
+ Returns: kmzdir, cleanup
"""
- overlaycoords = '''
-
- Legend image
-
- %s
-
-
-
-
-
-
-'''
- return overlaycoords % legendurl
-
-def kml_header():
- """Define basic kml
- header string"""
- kml_header = '''
-
- '''
- return kml_header
-
-def kml_start(params):
- """Define basic kml
- header string"""
- kmlstart = '''
-
- %s
- 1
- %s
- '''
- return kmlstart % (params[0], params[1])
-
-def kml_lookat(params):
- """Define basic kml
- header string"""
- kmlstart = '''
-
- %s
- %s
- %s
- 0
- 0
- 0
-
- '''
- return kmlstart % (params[0], params[1], params[2])
-
-def kml_network(params):
- """Add a Network Link"""
- kml_network = '''
-
- %s
-
- '''
- return kml_network % params
-
-def kml_footer():
- """Create KML footer"""
- kml_footer = '''
-
-
- '''
- return kml_footer
-
-def write_kml(target_file, outlist, verbosity=0, create_kmz=False):
- """Write KML out to disk
- and create KMZ if defined"""
- try:
- file = open(target_file, 'w')
- except IOError as (errno, strerror):
- print "I/O error({0}): {1}".format(errno, strerror)
- except ValueError:
- print "Could not convert data to an integer"
+
+ kprefix = 'kmzimgs'
+ kmzdir = ''
+ cleanup = ''
+
+ if args.z:
+ vprint ("\n- KMZ generation requested")
+ kmzdir = tempfile.mkdtemp(prefix=kprefix)
+
+ # can't use the auto-cleanup version TemporaryDirectory because of href2html appending of filename
+
+ if args.k:
+ # tmpdir is left for manual cleanup after script exits
+ vprint(" - per -k, tmp directory will not be rm'd:", kmzdir)
+ cleanup = ''
+ else:
+ # tmpdir needs to be rm'd after script exits
+ vprint(" - tmp directory will be cleaned up:", kmzdir)
+ cleanup = True
+
+ dprint("Image directory for kmz generation: ", kmzdir)
+ dprint("If you prefer a different tmp directory, change your TMPDIR environment variable")
+
else:
- final_str = ''.join(outlist)
- file.write(final_str)
- file.close()
-
- if os.path.exists(target_file) and create_kmz:
- file_substr = target_file[:-3] + 'kmz'
- if verbosity > 0:
- print "- Creating zipfile '%s'" % file_substr
- zf = zipfile.ZipFile(file_substr, mode='w')
- try:
- zf.write(target_file)
- finally:
- zf.close()
- os.remove(target_file)
- if verbosity > 0:
- print "- Finished creating KMZ zipfile '%s'" % file_substr
- elif os.path.exists(target_file):
- if verbosity > 0:
- print "- Finished creating KML file '%s'" % target_file
- else:
- print "- KML file '%s' not created. Something went wrong" % target_file
- return
-
-def kml_styles(pf_result, verbosity=0):
- """Create KML styles"""
- style_list = []
- if verbosity > 0:
- print "- Write out styles"
- my_styles = pf_result['styles']['styleinfo']
- my_sta_styles = pf_result['styles']['stylestation']
- if not pf_result['config']['subset'] or pf_result['config']['subset'] == 'events':
- for key in sorted(my_styles.iterkeys()):
- style_id = my_styles[key]['id']
- style_scale = my_styles[key]['scale']
- try:
- icon_style_scale = my_styles[key]['iconscale']
- except:
- icon_style_scale = my_styles[key]['scale']
- style_href = pf_result['styles']['imagepath'] + my_styles[key]['href']
- styleout = '''
-
- '''
- style_list.append(styleout % (style_id, style_href, icon_style_scale, style_href, style_scale))
- if not pf_result['config']['subset'] or pf_result['config']['subset'] == 'stations':
- for key in sorted(my_sta_styles.iterkeys()):
- style_id = my_sta_styles[key]['id']
- style_scale = my_sta_styles[key]['scale']
- try:
- icon_style_scale = my_sta_styles[key]['iconscale']
- except:
- icon_style_scale = my_sta_styles[key]['scale']
- style_href = pf_result['styles']['imagepath'] + my_sta_styles[key]['href']
- sta_styleout = '''
-
- '''
- style_list.append(sta_styleout % (style_id, style_href, icon_style_scale, style_href, style_scale))
- return ''.join(style_list)
-
-def main():
- """Main functionality
- for creating KML files
+ dprint ("\n- No KMZ generation requested")
+ kmzdir = ''
+
+ return(kmzdir,cleanup)
+
+def check_output_filename(out_file, args, pf_result):
+ """check if out_file has .kml or .kmz and appends appropriate extension, if needed
+
+ Returns: out_file
"""
- database, out_file, verbose, debug, pf, file_type = configure()
- verbosity = calc_verbosity(verbose, debug)
-
- if verbosity > 0:
- print "Start of script at time %s" % time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime())
-
- pf_result = get_pf(pf, verbosity)
-
- outstr = []
- outstr.append(kml_header())
- if pf_result['config']['network_link']:
- expires_time = time.time() + pf_result['config']['network_link']['refresh_rate']
- outstr.append(kml_network(expires_time))
-
- outstr.append(kml_start([
- pf_result['headers']['name'],
- pf_result['headers']['description'],
- ]))
-
- if pf_result['headers']['set_look_at']:
- outstr.append(kml_lookat([
- str(pf_result['headers']['look_at']['longitude']),
- str(pf_result['headers']['look_at']['latitude']),
- str(pf_result['headers']['look_at']['range'])
- ]))
-
- if pf_result['headers']['generate_legend']:
- if verbosity > 0:
- print "- Write out legend link"
- outstr.append(generate_legend(pf_result['headers']['legend_url']))
-
- if verbosity > 0:
- print "- Generating styles"
- outstr.append(kml_styles(pf_result, verbosity))
-
- if not pf_result['config']['subset'] or pf_result['config']['subset'] == 'events':
- if verbosity > 0:
- print "- Generating event icons"
- outstr.append(get_orig_records(database, pf_result, verbosity))
-
- if not pf_result['config']['subset'] or pf_result['config']['subset'] == 'stations':
- if verbosity > 0:
- print "- Generating station icons from database '%s'" % database
- outstr.append(
- get_site_records(
- database,
- pf_result['styles']['stylestation'],
- pf_result['stations']['expr'],
- pf_result['stations']['fields'],
- pf_result['stations']['visibility'],
- pf_result['stations']['display_inactive'],
- verbosity
- )
- )
-
- outstr.append(kml_footer())
-
- if pf_result['config']['create_kmz']:
- write_kml(out_file, outstr, verbosity, True)
-
- write_kml(out_file, outstr)
-
- if verbosity > 0:
- print "End of script at time %s" % time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime())
-
- return 0
+ vprint (" - Confirming output file name ")
+
+ root, ext = os.path.splitext(out_file)
+ if not ext:
+ if args.z:
+ vprint(" - Appending '.kmz' to", out_file )
+ out_file = out_file + ".kmz"
+ else:
+ vprint(" - Saving kml file only" )
+ vprint(" - Appending '.kml' to", out_file )
+ out_file = out_file + ".kml"
+ elif ext != 'kml' or ext != 'kmz':
+ print("ERROR output file name", out_file, "must end with .kml, or .kmz if -z specified")
+ sys.exit()
+ elif ext == 'kml' and args.z:
+ print("ERROR output file name", out_file, "ends with .kml but -z specified")
+ sys.exit()
+ elif ext == 'kmz' and not args.z:
+ print("ERROR output file name", out_file, "ends with .kmz but -z not specified")
+ sys.exit()
+ else:
+ vprint(" - ", out_file, "has acceptable extension")
+
+ return out_file
+
+
+# main, taking it out of a def
if __name__ == '__main__':
- status = main()
- sys.exit(status)
+
+ (args,parser) = parseArgs()
+ database = args.db
+ out_file = args.kmlfile
+
+ # setup some verbose and debug printing
+ # if debug, then also define vprint
+ if args.debug:
+ args.verbose = True
+ def dprint(*args):
+ print("DEBUG:",*args),
+ else:
+ dprint = lambda *a: None # do-nothing function
+
+ if args.verbose:
+ def vprint(*args):
+ import inspect
+ frame = inspect.stack()[1]
+ print(*args),
+ else:
+ vprint = lambda *a: None # do-nothing function
+
+ if args.quiet:
+ print = lambda *a: None # do-nothing function
+
+ vprint ("Start of script at time %s" % time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()))
+
+ #dprint ("pf is", pf)
+
+ if args.testoverlay:
+ print("WARNING: Overlay test mode, -t, was specified. Full kml/kmz will not be generated!")
+
+ if args.k and not args.z:
+ print("Warning: -z was not specified. The -k option will be ignored.")
+
+ vprint ("\n- Read configuration parameter file (pf): %s" % args.pf)
+ pf = stock.pfread(args.pf)
+
+ vprint (" - Starting get_pf")
+
+ pf_result = get_pf(pf,args)
+
+ dprint ("pf_result is", pf_result)
+
+ headers = pf_result['headers']
+ overlays = pf_result['overlays']
+
+ (kmzdir,cleanup) = mk_kmzdir(args)
+
+ out_file = check_output_filename(out_file,args,pf_result)
+
+ imglist = [] # used for collecting hrefs for images, to be sorted later before kml.addfile
+
+ vprint ("\n- Starting kml generation ")
+
+ kml = simplekml.Kml(name=headers['name'],description=headers['description'],open=1)
+
+ try:
+ headers['camera']
+ add_camera(pf_result,kml.document)
+ except:
+ vprint (" -> Camera information not available, default zoom in effect" )
+
+
+ try:
+ headers['network_link']
+ if stock.yesno(headers['network_link']['ignore']):
+ vprint(" -> Skipping network link, per ignore in pf")
+ else:
+ vprint(" - Populating network link")
+ nl = kml.newnetworklink(name=headers['network_link']['name'])
+ nl.link.href = headers['network_link']['link']
+ nl.link.author = "db2kml_py script"
+ # keep the user's Google Earth settings
+ nl.link.refreshvisibility = 0
+ nl.link.viewrefreshmode = simplekml.ViewRefreshMode.onrequest
+
+ kml.networklinkcontrol.refreshmode = simplekml.RefreshMode.onexpire
+ kml.networklinkcontrol.expires = time.time() + float(headers['network_link']['expires'])
+ # need to set "minRefreshPeriod" to make sure server access is not abused
+ # currently hardwired to 5 minutes
+ kml.networklinkcontrol.minrefreshperiod = 300
+ kml.networklinkcontrol.refreshmode = simplekml.RefreshMode.onexpire
+ kml.networklinkcontrol.expires = time.time() + float(headers['network_link']['expires'])
+ except:
+ vprint(" - Skipping network link")
+
+
+
+ plot_overlays(overlays,kmzdir,args)
+
+ dprint("After adding overlays:", kml.kml())
+
+ vprint ("\n - Working on placemark styles")
+
+ (opmtype_style, station_style, ofol, sfol, icon_method, opmmodel, sharedstyle) = kml_styles(pf_result,args)
+
+ dprint("After generating styles with kml_styles :", kml.kml())
+
+ vprint ("\n - Collecting station info from database: %s" % database)
+
+ # args.c defaults to 'all' if no args.c is chosen on command line, per argparse
+
+ if args.c == 'origins':
+ # get_origin_records calls generate_origin_pts
+ get_origin_records(database,pf_result,opmtype_style,ofol,sfol,sharedstyle,icon_method)
+ dprint("After adding origin points to plot:", kml.kml())
+
+ if args.c =='stations':
+ allsite = get_site_records( database, pf_result)
+ generate_site_pts(allsite,station_style,sfol)
+
+ if args.c == 'all':
+ allsite = get_site_records( database, pf_result)
+ generate_site_pts(allsite,station_style,sfol)
+
+ get_origin_records(database,pf_result,opmtype_style,ofol,sfol,sharedstyle,icon_method)
+ dprint("After adding origin points to plot:", kml.kml())
+
+ if kmzdir:
+ print("\n- Saving kmz file", out_file)
+
+ #the savekmz function of simplekml seems to be a bit dumb about duplicate hrefs
+ # without the warn suppression below, you get frequent errors like:
+ # zipfile.py:1506: UserWarning: Duplicate name: 'files/style0.PNG' return self._open_to_write(zinfo, force_zip64=force_zip64)
+ # in an ideal world, the savekmz funciton would proceed like:
+ # "oh, same file, I'll only save one!"
+ # instead savekmz adds that additional file to the kmz and then warns about it
+ # I have not found a way around this so the kmz file does get bloated
+ # and I have chosen to suppress the warnings about the duplicate files
+
+ warnings.simplefilter('ignore', UserWarning)
+ kml.savekmz(out_file)
+
+ else:
+ print("- Saving kml file", out_file)
+ kml.save(out_file)
+
+ # cleanup the imagedir for kmz image files unless -k
+
+ if args.k:
+ vprint("Image files used for kmz can be found in %s" % kmzdir)
+ else:
+ if args.z:
+ vprint("\n- Removing temporarily saved image files and directory %s" % kmzdir )
+ # This removal is done automatically because TemporaryDirectory() is used
+ try:
+ shutil.rmtree(kmzdir)
+ except:
+ print("Error when attempting to cleanup %s" % kmzdir)
+
+ vprint ("\nEnd of script at time %s" % time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()))
+
+
diff --git a/bin/export/leaflet_js/LICENSE b/bin/export/leaflet_js/LICENSE
new file mode 100644
index 000000000..f8985a66a
--- /dev/null
+++ b/bin/export/leaflet_js/LICENSE
@@ -0,0 +1,39 @@
+Copyright (c) 2015,2022 Nikolaus Horn
+All rights reserved.
+
+This software is licensed under the New BSD license:
+
+Redistribution and use in source and binary forms,
+with or without modification, are permitted provided
+that the following conditions are met:
+
+* Redistributions of source code must retain the above
+copyright notice, this list of conditions and the
+following disclaimer.
+
+* Redistributions in binary form must reproduce the
+above copyright notice, this list of conditions and
+the following disclaimer in the documentation and/or
+other materials provided with the distribution.
+
+* Neither the name of Nikolaus Horn nor
+the names of its contributors may be used to endorse
+or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
diff --git a/bin/export/leaflet_js/Makefile b/bin/export/leaflet_js/Makefile
index de2073e59..8dd941fb5 100644
--- a/bin/export/leaflet_js/Makefile
+++ b/bin/export/leaflet_js/Makefile
@@ -1,7 +1,7 @@
-BIN=web_stamap
-MAN1=web_stamap.1
+BIN=web_stamap web_evmap
+MAN1=web_stamap.1 web_evmap.1
-PF=web_stamap.pf
+PF=web_stamap.pf web_evmap.pf
include $(ANTELOPEMAKE)
DIRS=
SUBDIR=/contrib
diff --git a/bin/export/leaflet_js/web_evmap.1 b/bin/export/leaflet_js/web_evmap.1
new file mode 100644
index 000000000..9dae3dfb0
--- /dev/null
+++ b/bin/export/leaflet_js/web_evmap.1
@@ -0,0 +1,89 @@
+.TH WEB_EVMAP 1
+.SH NAME
+web_evmap \- interactive event map based on the leaflet library
+.SH SYNOPSIS
+.nf
+web_evmap [-v] [-s sitedb] [-p pffile] [-o] dbname evid|orid
+.fi
+
+.SH DESCRIPTION
+This utility produces a webpage for interactive display of event information and stations in a database.
+The display relies on the \fIleaflet\fP javascript library written by Vladimir Agafonkin.
+
+.SH OPTIONS
+.IP "-v"
+verbose flag
+.IP "-p pffile"
+parameter file
+.IP "-s sitedb"
+Database with station metadata.
+.IP "-o"
+The id is an origin id. Default would be to assume the event id is given.
+.IP "dbname"
+Name of database with event information. Site information can optionally be provided in a separatae database. This is a required parameter.
+.IP "evid (or orid)"
+Event or origin id.
+.SH PARAMETER FILE
+
+The following is a sample parameter file. Most of the parameters
+should be fairly self-explanatory.
+
+.in 2c
+.ft CW
+.nf
+title Antelope Demo Event Map # title
+
+logo_url https://geoweb.zamg.ac.at/images/zamg_logo_vert.png
+logo_alt ZAMG Logo
+
+leaflet_js https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/leaflet.min.js
+leaflet_css https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/leaflet.min.css
+leaflet_draw_js https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/1.0.4/leaflet.draw.js
+leaflet_draw_css https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/1.0.4/leaflet.draw.css
+leaflet_measurecontrol_js https://makinacorpus.github.io/Leaflet.MeasureControl/leaflet.measurecontrol.js
+leaflet_measurecontrol_css https://makinacorpus.github.io/Leaflet.MeasureControl/leaflet.measurecontrol.css
+
+prefor_icon https://geoweb.zamg.ac.at/my_icons/star_red.png
+origin_icon https://geoweb.zamg.ac.at/my_icons/star_blue.png
+defining_icon https://geoweb.zamg.ac.at/my_icons/tri_26_magenta.png
+nondefining_icon https://geoweb.zamg.ac.at/my_icons/tri_26_navy.png
+unassoc_icon https://geoweb.zamg.ac.at/my_icons/tri_26_grey.png
+
+
+html_template ...
+.fi
+.ft R
+.in
+.IP "logo_url, logo_alt"
+Replace with your own logo.
+.IP "prefor_icon, etc"
+The default parameter file uses icons hosted by ZAMG in Vienna. You may use these icons, but it would be kind
+to use locally hosted versions of these icons.
+.IP "leaflet_..."
+Javascript libraries used here. You may want to provide locally hosted versions of these libraries
+to increase stability and reliability. The plugins \fBdraw\fP and \fBmeasurecontrol\fP are needed for the interactive ruler taht can be activated by clicking on the icon below the zoom control ("+/-") on the left side of the webpage. See https://github.com/makinacorpus/Leaflet.MeasureControl for more information.
+.IP html_template
+Template for the new webpage. See https://leaflet-extras.github.io/leaflet-providers/preview/ for a list of alternative map layers.
+All curly brackets must be doubled because of the antelope parameter file quoting conventions. See \fIpf(5)\fP for an explanation.
+.SH EXAMPLE
+.nf
+% web_evmap /opt/antelope/data/db/demo/demo 4
+% open evmap_evid_0000000004.html
+.fi
+
+.SH "BUGS AND CAVEATS"
+The default parameter file is using icons and java-script libraries and stylesheets provided by the cloudflare CDN, github and ZAMG. For productive usage, I would recommend to provide locally hosted copies.
+
+.SH "SEE ALSO"
+.nf
+web_stamap(1),
+\fBhttps://leafletjs.com/\fP,
+\fBhttps://leaflet-extras.github.io/leaflet-providers/preview/\fP,
+\fBhttps://github.com/makinacorpus/Leaflet.MeasureControl\fP and
+pf(5)
+.fi
+.SH AUTHOR
+.nf
+Nikolaus Horn, 2022
+
+ZAMG / Vienna, Nikolaus.Horn@zamg.ac.at
diff --git a/bin/export/leaflet_js/web_evmap.pf b/bin/export/leaflet_js/web_evmap.pf
new file mode 100644
index 000000000..7a15838e4
--- /dev/null
+++ b/bin/export/leaflet_js/web_evmap.pf
@@ -0,0 +1,131 @@
+filebase events # output filename
+title Antelope Demo Event Map # title
+
+logo_url https://geoweb.zamg.ac.at/images/zamg_logo_vert.png
+logo_alt ZAMG Logo
+leaflet_js https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/leaflet.min.js
+leaflet_css https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/leaflet.min.css
+leaflet_draw_js https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/1.0.4/leaflet.draw.js
+leaflet_draw_css https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/1.0.4/leaflet.draw.css
+leaflet_measurecontrol_js https://makinacorpus.github.io/Leaflet.MeasureControl/leaflet.measurecontrol.js
+leaflet_measurecontrol_css https://makinacorpus.github.io/Leaflet.MeasureControl/leaflet.measurecontrol.css
+
+prefor_icon https://geoweb.zamg.ac.at/my_icons/star_red.png
+origin_icon https://geoweb.zamg.ac.at/my_icons/star_blue.png
+defining_icon https://geoweb.zamg.ac.at/my_icons/tri_26_magenta.png
+nondefining_icon https://geoweb.zamg.ac.at/my_icons/tri_26_navy.png
+unassoc_icon https://geoweb.zamg.ac.at/my_icons/tri_26_grey.png
+
+
+# Note: we don't need to escape percent signs, but
+# we need double curly brackets for a single on in the output, while
+# key-fields must be embracketed only once
+html_template &Literal{
+
+
+
+ {title}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
diff --git a/bin/export/leaflet_js/web_evmap.xpy b/bin/export/leaflet_js/web_evmap.xpy
index d2c8d3e33..5395ba7c2 100755
--- a/bin/export/leaflet_js/web_evmap.xpy
+++ b/bin/export/leaflet_js/web_evmap.xpy
@@ -1,35 +1,22 @@
"""
-recent webforms
-
-Create HTML for seismic event
+Create HTML for seismic event(s)
@author Nikolaus Horn %.2f %.2f
%s"
origin_tr_template = "
%s
%d
%s
%s
%s
%s
%.2f
%.2f
%.1fkm
%s
%d
%d
%s
"
origin_th_template = "
evid
orid
time
mag
etype
review
lat
lon
depth
auth
nass
ndef
lddate
"
@@ -42,135 +29,6 @@ mag_tr_template = (
"
%s
%s
%.1f
%.2f
%.0f
%s
"
)
-html_template = """
-
-
-
-
-
-
-%s
-
-
-
-
-
-
-
-
-
-
-
-
-
-"""
-
info_template = """
@@ -199,20 +57,7 @@ import codecs
def usage(progname):
- print(progname, "[-v] [-d dirout] [-s sitedb] [-h histdb] [-p pfname] [-o] dbname evid")
-
-
-def feltsize(number):
- # print "this is feltsize"
- size = 12
- if number < 3:
- size = 12
- else:
- size = 12 + (number - 3) * (number - 3)
- if size > 30:
- size = 30
- # print "fs %d %d" % (number,size)
- return size
+ print(progname, "[-v] [-d dirout] [-s sitedb] [-p pfname] [-o] dbname evid")
def magsize(number):
@@ -275,8 +120,6 @@ def main():
pf = a
elif o == "-d":
dirout = a
- elif o == "-h":
- histdbname = a
elif o == "-s":
sitedbname = a
@@ -288,6 +131,23 @@ def main():
timenow = stock.now()
creation_time = stock.epoch2str(timenow, "%d. %m. %Y %H:%M")
+ pf = stock.pfread(pfname)
+
+ logo_url = pf["logo_url"]
+ logo_alt = pf["logo_alt"]
+ leaflet_css = pf["leaflet_css"]
+ leaflet_js = pf["leaflet_js"]
+ leaflet_draw_css = pf["leaflet_draw_css"]
+ leaflet_draw_js = pf["leaflet_draw_js"]
+ leaflet_measurecontrol_css = pf["leaflet_measurecontrol_css"]
+ leaflet_measurecontrol_js = pf["leaflet_measurecontrol_js"]
+ title = pf["title"]
+ html_template = pf["html_template"]
+ prefor_icon = pf["prefor_icon"]
+ origin_icon = pf["origin_icon"]
+ defining_icon = pf["defining_icon"]
+ nondefining_icon = pf["nondefining_icon"]
+ unassoc_icon = pf["unassoc_icon"]
if id_is_orid:
orid = int(args[1])
@@ -300,9 +160,6 @@ def main():
filebase = os.path.join(dirout, filebase)
db = ds.dbopen(dbname, "r")
my_tables = db.query(ds.dbSCHEMA_TABLES)
- has_macro_tables = False
- if "idp" in my_tables and "massoc" in my_tables and "meval" in my_tables:
- has_macro_tables = True
dborigin = db.lookup(table="origin")
dbevent = db.lookup(table="event")
dbassoc = db.lookup(table="assoc")
@@ -349,10 +206,6 @@ def main():
stamagmatcher = dbstamagmatch.matches(dbstamag, ["sta", "orid"])
# print "we have %d origins" % nevents
- if has_macro_tables:
- dbp = dbp.join("massoc", outer=True)
- dbp = dbp.join("meval", outer=True)
-
layers = []
layer_names = []
layer_descriptions = []
@@ -427,7 +280,7 @@ def main():
ms = mag
elif magt == "ml":
ml = mag
- elif magt == "mw":
+ elif magt == "mw" or magt == "mww":
mw = mag
if mw > -99.0:
@@ -565,7 +418,7 @@ def main():
ms = mag
elif magt == "ml":
ml = mag
- elif magt == "mw":
+ elif magt == "mw" or magt == "mww":
mw = mag
if mw > -99.0:
@@ -588,7 +441,7 @@ def main():
ss = "%d,%d" % (mysize, mysize)
htmlfilename = "%s_evinfo.html" % filebase
marker_html = (
- '%s %s %.2f %.2f %.0fkm %s orid: %d evid: %d Auth: %s Mehr Info'
+ '%s %s %.2f %.2f %.0fkm %s orid: %d evid: %d Auth: %s more information'
% (
tooltipstr,
etype,
@@ -668,7 +521,9 @@ def main():
magdiff = ml - stamag
if stamagtype.lower() == "ms" and ms > -90.0:
magdiff = ms - stamag
- if stamagtype.lower() == "mw" and mw > -90.0:
+ if (
+ stamagtype.lower() == "mw" or stamagtype.lower() == "mww"
+ ) and mw > -90.0:
magdiff = mw - stamag
if first_stamag:
mag_str.append(
@@ -687,7 +542,6 @@ def main():
if len(siterecords) > 0:
dbsite.record = siterecords[0]
[stalat, stalon, staname] = dbsite.getv("lat", "lon", "staname")
- #staname = staname.decode(db_encoding)
staname = staname.replace("'", "\\'")
stastr = []
stastr.append("%s - %s" % (sta, staname))
@@ -821,12 +675,10 @@ def main():
icon_name = "xI"
icons.append(icon_template % (icon_name, unassoc_icon))
this_layer = "xxx"
- # layer_names.append( this_layer )
layers.append(layer_template % this_layer)
layer_descriptions.append('"unused Stations": %s' % this_layer)
for dbsite.record in range(n_sites_left):
[sta, stalat, stalon, staname] = dbsite.getv("sta", "lat", "lon", "staname")
- #staname = staname.decode(db_encoding)
staname = staname.replace("'", "\\'")
marker_html = "%s - %s %.2f %.2f" % (sta, staname, stalat, stalon)
markers.append(
@@ -834,32 +686,41 @@ def main():
% (stalat, stalon, "xI", "%s - %s" % (sta, staname), marker_html, "xxx")
)
- htmlfilename = "%s.html" % filebase
- file = codecs.open(htmlfilename, "w", "UTF-8")
if id_is_orid:
titlestring = "Origin %d" % orid
else:
titlestring = "Event %d - prefor %d" % (orid, preforid)
- my_html = html_template % (
- titlestring,
- "".join(icons),
- "".join(layers),
- "".join(markers),
- plat,
- plon,
- ",".join(layer_names),
- ",".join(layer_descriptions),
- creation_time,
+ my_html = html_template.format(
+ title=title,
+ leaflet_css=leaflet_css,
+ leaflet_js=leaflet_js,
+ leaflet_draw_css=leaflet_draw_css,
+ leaflet_draw_js=leaflet_draw_js,
+ leaflet_measurecontrol_css=leaflet_measurecontrol_css,
+ leaflet_measurecontrol_js=leaflet_measurecontrol_js,
+ icons="".join(icons),
+ layers="".join(layers),
+ markers="".join(markers),
+ layer_names=",".join(layer_names),
+ layer_descriptions=",".join(layer_descriptions),
+ center_lat=plat,
+ center_lon=plon,
+ logo_url=logo_url,
+ logo_alt=logo_alt,
+ creation_time=creation_time,
)
- file.write("".join(my_html))
+ htmlfilename = "%s.html" % filebase
+ with open(htmlfilename, "w", encoding="utf8") as myfile:
+ myfile.write(my_html)
+
if verbose:
elog.log("file done %s" % htmlfilename)
- htmlfilename = "%s_evinfo.html" % filebase
- file = codecs.open(htmlfilename, "w", "UTF-8")
my_html = info_template % (titlestring, "".join(outstr), "".join(mag_str))
- file.write("".join(my_html))
+ htmlfilename = "%s_evinfo.html" % filebase
+ with open(htmlfilename, "w", encoding="utf8") as myfile:
+ myfile.write(my_html)
if verbose:
elog.log("file done %s" % htmlfilename)
return 0
diff --git a/bin/export/leaflet_js/web_stamap.1 b/bin/export/leaflet_js/web_stamap.1
index fbf4c07b7..af0e7e932 100644
--- a/bin/export/leaflet_js/web_stamap.1
+++ b/bin/export/leaflet_js/web_stamap.1
@@ -8,45 +8,81 @@ web_stamap [-v] [-p pffile] dbname
.SH DESCRIPTION
This utility produces a webpage for an interactive display of stations in a database. The stations can be grouped using search expressions in the paramter file.
-The display relys on the \fIleaflet\fP javascript library written by Vladimir Agafonkin.
+The display relies on the \fIleaflet\fP javascript library written by Vladimir Agafonkin.
.SH OPTIONS
.IP "-v"
verbose flag
.IP "-p pffile"
parameter file
+.IP "-f file"
+Output filename. This overrides the filebase from the parameter file.
.IP "dbname"
Name of database. Only the site table is needed here.
.SH PARAMETER FILE
-The following is a sample parameter file. Some of the parameters
+The following is a sample parameter file. Most of the parameters
should be fairly self-explanatory.
+.in 2c
+.ft CW
.nf
-filebase stations
-title OÖW Station Map
+filebase stations # output filename
+title Antelope Demo Station Map # title
-logo_url https://geoweb.zamg.ac.at/images/zamg_logo_vert.png
-logo_alt ZAMG Logo
-web_css https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/leaflet.min.css
-web_js https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/leaflet.min.js
-dontshow S[123456]TA|BSTA|CUVW|CXYZ|CO[ABCD]|VB[1-3]|AAA[0-9].*
+dontshow X[123456]TA|BSTA|CUVW|CXYZ|CO[ABCD] # ignore sites matching this expression
layers &Tbl{
- &Arr{
- stations BZN|CRY|FRD|HSSP|SETM|SND|TONN|TRAN|WMC|B081|B082|B082A|B084|B086|B086A|B087|B088|B088A|B093|B946|ALCY|GVAR1|SJR|PSPR|TFRD
- icon https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/images/marker-icon.png
- description Anza Stations
- }
- &Arr{
- stations
- icon https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/images/marker-icon.png
- description Other Stations
- }
+ &Arr{
+ stations B0.*
+ icon http://geoweb.zamg.ac.at/my_icons/tri_26_pink.png
+ description Some array in the desert
+ }
+ &Arr{
+ stations PFO
+ icon http://geoweb.zamg.ac.at/my_icons/tri_26_pink.png
+ description Pinion Flat
+ }
+ &Arr{
+ stations # catch all stations left here
+ icon https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/images/marker-icon.png
+ description ANZA stations
+ }
}
-.fi
+logo_url https://geoweb.zamg.ac.at/images/zamg_logo_vert.png
+logo_alt ZAMG Logo
+
+leaflet_js https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/leaflet.min.js
+leaflet_css https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/leaflet.min.css
+leaflet_draw_js https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/1.0.4/leaflet.draw.js
+leaflet_draw_css https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/1.0.4/leaflet.draw.css
+leaflet_measurecontrol_js https://makinacorpus.github.io/Leaflet.MeasureControl/leaflet.measurecontrol.js
+leaflet_measurecontrol_css https://makinacorpus.github.io/Leaflet.MeasureControl/leaflet.measurecontrol.css
+
+html_template ...
+.fi
+.ft R
+.in
+.IP filebase
+Output filename without extension (".html"). This can be overriden on the commandline
+.IP dontshow
+Filter out stations
+.IP layers
+Different groups of stations selecte by the parameter \fIstations\fP.
+Each group should be given a different icon. You may use the icons specified here,
+but it would be kind to provide locally hosted copies.
+The last groups with an empty parameter \fIstations\fP contains all stations left after excluding stations
+either selected by the paramter \fIdontshow\fP or in one of the previous groups.
+.IP "logo_url, logo_alt"
+Replace with your own logo
+.IP "leaflet_..."
+Javascript libraries used here. You may want to provide locally hosted versions of these libraries
+to increase stability and reliability. The plugins \fBdraw\fP and \fBmeasurecontrol\fP are needed for the interactive ruler taht can be activated by clicking on the icon below the zoom control ("+/-") on the left side of the webpage. See https://github.com/makinacorpus/Leaflet.MeasureControl for more information.
+.IP html_template
+Template for the new webpage. See https://leaflet-extras.github.io/leaflet-providers/preview/ for a list of alternative map layers.
+All curly brackets must be doubled because of the antelope parameter file quoting conventions. See \fIpf(5)\fP for an explanation.
.SH EXAMPLE
.nf
% web_stamap /opt/antelope/data/db/demo/demo
@@ -54,11 +90,14 @@ layers &Tbl{
.fi
.SH "BUGS AND CAVEATS"
-The default parameter files is using icons and java-script libraries provided by the cloudflare CDN. For productive usage, I would recommend to provide locally hosted copies.
+The default parameter file is using icons and java-script libraries and stylesheets provided by the cloudflare CDN, github and ZAMG. For productive usage, I would recommend to provide locally hosted copies.
.SH "SEE ALSO"
.nf
-antelope(1), rtexec(1), \fBhttps://leafletjs.com/\fP
+\fBhttps://leafletjs.com/\fP,
+\fBhttps://leaflet-extras.github.io/leaflet-providers/preview/\fP,
+\fBhttps://github.com/makinacorpus/Leaflet.MeasureControl\fP and
+pf(5)
.fi
.SH AUTHOR
.nf
diff --git a/bin/export/leaflet_js/web_stamap.pf b/bin/export/leaflet_js/web_stamap.pf
index ffe75b885..3bbb16b13 100644
--- a/bin/export/leaflet_js/web_stamap.pf
+++ b/bin/export/leaflet_js/web_stamap.pf
@@ -1,25 +1,144 @@
-filebase stations
-title OÖW Station Map
-
-logo_url https://geoweb.zamg.ac.at/images/zamg_logo_vert.png
-logo_alt ZAMG Logo
-leaflet_css https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/leaflet.min.css
-leaflet_js https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/leaflet.min.js
-dontshow S[123456]TA|BSTA|CUVW|CXYZ|CO[ABCD]|VB[1-3]|AAA[0-9].*
+filebase stations # output filename
+title Antelope Demo Station Map # title
+
+dontshow X[123456]TA|BSTA|CUVW|CXYZ|CO[ABCD] # ignore sites matching this expression
layers &Tbl{
- &Arr{
- stations ABNA|ABTA|ARSA|BIOA|CONA|CSNA|DAVA|FETA|KBA|KMR|LESA|MOA|MOTA|MYKA|OBKA|RETA|RONA|SOKA|SESA|SQTA|VIE|WATA|WINA|WTTA|UNNA
- icon https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/images/marker-icon.png
- description Austrian Broadband ( Q330 + STS-2/STS-2.5 )
- }
- &Arr{
- stations OBSA|RKSA|RSNA|RWNA|KMWA|ADSA|ZETA|UMWA|FRTA|NATA|LFVA|WOTA|PROA|LMSA|WIWA|GUKA|KEKA|KMKA|BITA|SNWA|ROSA|BSTA|SOSA
- icon https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/images/marker-icon.png
- description Austrian Realtime Strong Motion Stations (Basalt or Etna2)
- }
- &Arr{
- stations
- icon https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/images/marker-icon.png
- description Foreign Stations
- }
+ &Arr{
+ stations B0.*
+ icon http://geoweb.zamg.ac.at/my_icons/tri_26_pink.png
+ description Some array in the desert
+ }
+ &Arr{
+ stations PFO
+ icon http://geoweb.zamg.ac.at/my_icons/tri_26_pink.png
+ description Pinion Flat
+ }
+ &Arr{
+ stations # catch all stations left here
+ icon https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/images/marker-icon.png
+ description ANZA stations
+ }
+}
+
+logo_url https://geoweb.zamg.ac.at/images/zamg_logo_vert.png
+logo_alt ZAMG Logo
+leaflet_js https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/leaflet.min.js
+leaflet_css https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/leaflet.min.css
+leaflet_draw_js https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/1.0.4/leaflet.draw.js
+leaflet_draw_css https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/1.0.4/leaflet.draw.css
+leaflet_measurecontrol_js https://makinacorpus.github.io/Leaflet.MeasureControl/leaflet.measurecontrol.js
+leaflet_measurecontrol_css https://makinacorpus.github.io/Leaflet.MeasureControl/leaflet.measurecontrol.css
+
+
+# Note: we don't need to escape percent signs, but
+# we need double curly brackets for a single on in the output, while
+# key-fields must be embracketed only once
+html_template &Literal{
+
+
+
+ {title}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
}
diff --git a/bin/export/leaflet_js/web_stamap.xpy b/bin/export/leaflet_js/web_stamap.xpy
index 1e05c10ef..521b3a064 100755
--- a/bin/export/leaflet_js/web_stamap.xpy
+++ b/bin/export/leaflet_js/web_stamap.xpy
@@ -20,112 +20,6 @@ marker_template = (
icon_template = """var %s = new LeafIcon({iconUrl: '%s'});"""
marker_html_template = "%s - %s
%.2f %.2f %.0fm
%s"
-# note we need to escape percents %-> %%
-html_template = """
-
-
-
- %s
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-"""
-
import getopt
# Import Antelope modules
@@ -184,9 +78,14 @@ def main():
logo_alt = pf["logo_alt"]
leaflet_css = pf["leaflet_css"]
leaflet_js = pf["leaflet_js"]
+ leaflet_draw_css = pf["leaflet_draw_css"]
+ leaflet_draw_js = pf["leaflet_draw_js"]
+ leaflet_measurecontrol_css = pf["leaflet_measurecontrol_css"]
+ leaflet_measurecontrol_js = pf["leaflet_measurecontrol_js"]
dontshow = pf["dontshow"]
title = pf["title"]
gis_layers = pf["layers"]
+ html_template = pf["html_template"]
db = ds.dbopen(dbname, "r")
dbsite = db.lookup(table="site")
@@ -226,7 +125,11 @@ def main():
layer_index += 1
for dbs.record in range(dbs.record_count):
[ondate, lat, lon, elev, sta] = dbs.getv(
- "ondate", "lat", "lon", "elev", "sta",
+ "ondate",
+ "lat",
+ "lon",
+ "elev",
+ "sta",
)
try:
[staname] = dbs.getv("staname")
@@ -247,26 +150,31 @@ def main():
marker_template % (lat, lon, icon_name, sta, marker_html, this_layer)
)
- my_html = html_template % (
- title,
- leaflet_css,
- leaflet_js,
- "".join(icons),
- "".join(layers),
- "".join(markers),
- center_lon, center_lat,
- ",".join(layer_names),
- ",".join(layer_descriptions),
- logo_url,
- logo_alt,
- creation_time,
+ my_html = html_template.format(
+ title=title,
+ leaflet_css=leaflet_css,
+ leaflet_js=leaflet_js,
+ leaflet_draw_css=leaflet_draw_css,
+ leaflet_draw_js=leaflet_draw_js,
+ leaflet_measurecontrol_css=leaflet_measurecontrol_css,
+ leaflet_measurecontrol_js=leaflet_measurecontrol_js,
+ icons="".join(icons),
+ layers="".join(layers),
+ layer_names=",".join(layer_names),
+ layer_descriptions=",".join(layer_descriptions),
+ markers="".join(markers),
+ center_lat=center_lat,
+ center_lon=center_lon,
+ logo_url=logo_url,
+ logo_alt=logo_alt,
+ creation_time=creation_time,
)
- outstr = "".join(my_html)
with open(htmlfilename, "w", encoding="utf8") as myfile:
- myfile.write(outstr)
+ myfile.write(my_html)
return 0
+
if __name__ == "__main__":
status = main()
sys.exit(status)
diff --git a/bin/import/ctbto/LICENSE b/bin/import/ctbto/LICENSE
new file mode 100644
index 000000000..02f54e781
--- /dev/null
+++ b/bin/import/ctbto/LICENSE
@@ -0,0 +1,39 @@
+Copyright (c) 2015 Nikolaus Horn
+All rights reserved.
+
+This software is licensed under the New BSD license:
+
+Redistribution and use in source and binary forms,
+with or without modification, are permitted provided
+that the following conditions are met:
+
+* Redistributions of source code must retain the above
+copyright notice, this list of conditions and the
+following disclaimer.
+
+* Redistributions in binary form must reproduce the
+above copyright notice, this list of conditions and
+the following disclaimer in the documentation and/or
+other materials provided with the distribution.
+
+* Neither the name Nikolaus Horn nor the names of
+his contributors may be used to endorse
+or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
diff --git a/bin/import/usgs2db/.gitignore b/bin/import/usgs2db/.gitignore
index 25fa1b08b..6e0ff7959 100644
--- a/bin/import/usgs2db/.gitignore
+++ b/bin/import/usgs2db/.gitignore
@@ -2,3 +2,7 @@ usgs2db
emsc2db
pdetxt2db
keydb
+fdsntxt2db
+keydb.idmatch
+gfzrss2db
+orig_*
diff --git a/bin/import/usgs2db/LICENSE b/bin/import/usgs2db/LICENSE
new file mode 100644
index 000000000..f8985a66a
--- /dev/null
+++ b/bin/import/usgs2db/LICENSE
@@ -0,0 +1,39 @@
+Copyright (c) 2015,2022 Nikolaus Horn
+All rights reserved.
+
+This software is licensed under the New BSD license:
+
+Redistribution and use in source and binary forms,
+with or without modification, are permitted provided
+that the following conditions are met:
+
+* Redistributions of source code must retain the above
+copyright notice, this list of conditions and the
+following disclaimer.
+
+* Redistributions in binary form must reproduce the
+above copyright notice, this list of conditions and
+the following disclaimer in the documentation and/or
+other materials provided with the distribution.
+
+* Neither the name of Nikolaus Horn nor
+the names of its contributors may be used to endorse
+or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
diff --git a/bin/import/usgs2db/Makefile b/bin/import/usgs2db/Makefile
index e3a6c4c1d..17167a1c1 100644
--- a/bin/import/usgs2db/Makefile
+++ b/bin/import/usgs2db/Makefile
@@ -1,5 +1,5 @@
-BIN=usgs2db emsc2db pdetxt2db fdsntxt2db
-MAN1=usgs2db.1 emsc2db.1
+BIN=usgs2db emsc2db gfzrss2db fdsntxt2db
+MAN1=usgs2db.1 emsc2db.1 fdsntxt2db.1 gfzrss2db.1
DATA=idmatch1.0
DATADIR=schemas
diff --git a/bin/import/usgs2db/emsc2db.xpy b/bin/import/usgs2db/emsc2db.xpy
index e1bfde1fc..f0265f49c 100644
--- a/bin/import/usgs2db/emsc2db.xpy
+++ b/bin/import/usgs2db/emsc2db.xpy
@@ -1,15 +1,14 @@
"""
@author Nikolaus Horn
@created 2013-11-25
-@modified 2014-02-15
-@version 1.0
+@modified 2023-03-03
+@version 1.2
@license MIT-style license
@credits ZAMG for my visit to EGU 2014
"""
import getopt
-import codecs
import requests
import json
import warnings
@@ -18,361 +17,595 @@ import warnings
import antelope.datascope as ds
import antelope.stock as stock
import antelope.elog as elog
+import antelope.orb as orb
+import antelope.Pkt as Pkt
+
+sys.path.append(os.environ["ANTELOPE"] + "/contrib/data/python")
+import zamg.utilities as zu
def usage(progname):
- print(progname, "[-v] [-p proxy_url] [-a auth] [-k keydb] [-u url] dbname")
+ # print(progname, "[-v] [-h] [-AB] [-P prefix] [-O|-o orb] [-p proxy_url] [-a auth] [-k keydb] [-u url] dbname")
+ print(
+ progname,
+ "[-v] [-h] [-AB] [-P prefix] [-o|-O orb] [-p proxy_url] [-a auth] [-k keydb] [-u url] [-s schema] dbname",
+ )
-def main():
- progname = sys.argv[0].split("/")[-1]
- elog.init(progname)
+progname = sys.argv[0].split("/")[-1]
+elog.init(progname)
+if progname == "usgs2db":
BASE_URL = (
- "http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/2.5_day.geojson"
+ "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_hour.geojson"
)
- BASE_URL = "http://www.seismicportal.eu/fdsnws/event/1/query?limit=100&format=json"
- verbose = 0
- archive = 0
- opts = []
- args = []
- keydbname = "keydb"
- keyschema = "idmatch1.0"
+ auth = "USGS"
+ help_text = """USGS provides at most 1 month of data on the following URL:
+http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.geojson.
+The default is to retrieve all events from the last hour, regardless of magnitude"""
+else:
+ BASE_URL = "http://www.seismicportal.eu/fdsnws/event/1/query?limit=10&format=json"
auth = "EMSC"
- proxy_url = ""
- try:
- opts, args = getopt.getopt(sys.argv[1:], "a:k:p:u:v", "")
- except getopt.GetoptError:
- elog.die("illegal option")
- usage(progname)
- sys.exit(2)
-
- for o, a in opts:
- if o == "-v":
- verbose = 1
- elif o == "-a":
- auth = a
- elif o == "-u":
- BASE_URL = a
- elif o == "-k":
- keydbname = a
- elif o == "-p":
- proxy_url = a
-
- if len(args) > 1 or len(args) < 1:
+ help_text = """EMSC provides at most 20000 events at once on the following URL:
+http://www.seismicportal.eu/fdsnws/event/1/query?limit=20000&format=json.
+The default here is to retrieve only the most recent 10 events"""
+
+verbose = False
+debug = False
+archive_all = True # for pfpackets, if True then the value for archive_if_not_associated in the packet is set to yes
+archive = 0
+opts = []
+args = []
+keydbname = "keydb"
+keyschema = "idmatch1.0"
+proxy_url = ""
+mag_also_to_mb = False
+orbname = ""
+orbpkttype = "db" # or pf for /pf/orb2dbt - format
+prefix = ""
+dbschema = "css3.0"
+try:
+ opts, args = getopt.getopt(sys.argv[1:], "a:ABshk:o:O:p:P:u:vd", "")
+except getopt.GetoptError:
+ elog.die("illegal option")
+ usage(progname)
+ sys.exit(2)
+
+for o, a in opts:
+ if o == "-v":
+ verbose = True
+ elif o == "-d":
+ verbose = True
+ debug = True
+ elif o == "-a":
+ auth = a
+ elif o == "-A":
+ archive_all = False
+ elif o == "-u":
+ BASE_URL = a
+ elif o == "-k":
+ keydbname = a
+ elif o == "-B":
+ mag_also_to_mb = True
+ elif o == "-o":
+ orbname = a
+ orbpkttype = "db"
+ elif o == "-O":
+ orbname = a
+ orbpkttype = "pf"
+ elif o == "-P":
+ prefix = a
+ elif o == "-p":
+ proxy_url = a
+ elif o == "-s":
+ dbschema = a
+ elif o == "-h":
usage(progname)
- sys.exit(1)
+ print(help_text)
+ sys.exit(0)
+
+if len(args) > 1 or len(args) < 1:
+ usage(progname)
+ sys.exit(1)
- if len(args) > 0:
- dbname = args[0]
+if len(args) > 0:
+ dbname = args[0]
- db = ds.dbopen(dbname, "r+")
- dborigin = db.lookup(table="origin")
- dbevent = db.lookup(table="event")
- dbnetmag = db.lookup(table="netmag")
+db = zu.create_dbdesc(dbname, dbschema)
+dborigin = db.lookup(table="origin")
+dbevent = db.lookup(table="event")
+dbnetmag = db.lookup(table="netmag")
- dbq = db.lookup(table="origin", field="ml", record="dbNULL")
- [mlnull] = dbq.getv("ml")
- dbq = db.lookup(table="event", field="evname", record="dbNULL")
- evname_width = dbq.query("dbFIELD_SIZE")
+dbq = db.lookup(table="origin", field="ml", record="dbNULL")
+[mlnull] = dbq.getv("ml")
+dbq = db.lookup(table="event", field="evname", record="dbNULL")
+evname_width = dbq.query("dbFIELD_SIZE")
+dbq = db.lookup(table="origin", field="auth", record="dbNULL")
+auth_width = dbq.query("dbFIELD_SIZE")
+
+kdb = ds.dbopen(keydbname, "r+")
+descname = kdb.query("dbDATABASE_FILENAME")
+if os.path.exists(descname):
+ schemaname = kdb.query("dbSCHEMA_NAME")
+ if schemaname != keyschema:
+ elog.die(
+ "keydb %s has wrong schema %s, should be %s"
+ % (keydbname, schemaname, keyschema)
+ )
+ sys.exit(1)
+else:
+ kdb.close()
+ ds.dbcreate(keydbname, keyschema)
kdb = ds.dbopen(keydbname, "r+")
- descname = kdb.query("dbDATABASE_FILENAME")
- if os.path.exists(descname):
- schemaname = kdb.query("dbSCHEMA_NAME")
- if schemaname != keyschema:
- elog.die(
- "keydb %s has wrong schema %s, should be %s"
- % (keydbname, schemaname, keyschema)
- )
- sys.exit(1)
+try:
+ idmatch = kdb.lookup(table="idmatch")
+except Exception as e:
+ elog.die("fatal problem with key database:", e)
+
+if proxy_url != "":
+ if proxy_url.startswith("https"):
+ proxy = {"https": proxy_url}
else:
- kdb.close()
- ds.dbcreate(keydbname, keyschema)
+ proxy = {"http": proxy_url}
+ if debug:
+ elog.notify("try to retrieve %s\nvia proxy %s" % (BASE_URL, proxy))
+ with warnings.catch_warnings():
+ warnings.simplefilter(
+ "ignore"
+ ) # ignore silly warnings on SSL verification, especially needed on 5.9
+ try:
+ req = requests.get(BASE_URL, proxies=proxy, verify=False, timeout=30)
+ req.raise_for_status()
+ except requests.exceptions.HTTPError as herr:
+ elog.die("problem requesting data from %s:%s" % (BASE_URL, herr))
+ except requests.exceptions.Timeout:
+ elog.die("timeout requesting data from %s" % BASE_URL)
+ except requests.exceptions.TooManyRedirects:
+ elog.die("too many retries requesting data from %s" % BASE_URL)
+ except requests.exceptions.RequestException as e:
+ elog.die("fatal problem requesting data from %s" % BASE_URL)
+ except:
+ elog.die("unspecific problem requesting data from %s" % BASE_URL)
+else:
+ if debug:
+ elog.notify("try to retrieve %s" % BASE_URL)
+ with warnings.catch_warnings():
+ warnings.simplefilter("ignore")
+ try:
+ req = requests.get(BASE_URL, verify=False, timeout=30)
+ req.raise_for_status()
+ except requests.exceptions.HTTPError as herr:
+ elog.die("problem requesting data from %s:%s" % (BASE_URL, herr))
+ except requests.exceptions.Timeout:
+ elog.die("timeout requesting data from %s" % BASE_URL)
+ except requests.exceptions.TooManyRedirects:
+ elog.die("too many retries requesting data from %s" % BASE_URL)
+ except requests.exceptions.RequestException as e:
+ elog.die("fatal problem requesting data from %s" % BASE_URL)
+ except:
+ elog.die("unspecific problem requesting data from %s" % BASE_URL)
+req.encoding = "utf8" # maybe not necessary...
+obj = req.json()
+data = obj["features"]
+i = len(data)
+if debug:
+ elog.debug("retrieved %d events" % i)
- kdb = ds.dbopen(keydbname, "r+")
- try:
- idmatch = kdb.lookup(table="idmatch")
- except Exception as e:
- elog.die("fatal problem with key database:", e)
+if orbname != "":
+ myorb = orb.orbopen(orbname, permissions="w&")
- if proxy_url != "":
- if proxy_url.startswith("https"):
- proxy = {"https": proxy_url}
- else:
- proxy = {"http": proxy_url}
- with warnings.catch_warnings():
- warnings.simplefilter(
- "ignore"
- ) # ignore silly warnings on SSL verification, especially needed on 5.9
- try:
- req = requests.get(BASE_URL, proxies=proxy, verify=False, timeout=30)
- req.raise_for_status()
- except requests.exceptions.HTTPError as herr:
- elog.die("problem requesting data from %s:%s" % (BASE_URL, herr))
- except requests.exceptions.Timeout:
- elog.die("timeout requesting data from %s" % BASE_URL)
- except requests.exceptions.TooManyRedirects:
- elog.die("too many retries requesting data from %s" % BASE_URL)
- except requests.exceptions.RequestException as e:
- elog.die("fatal problem requesting data from %s" % BASE_URL)
- except:
- elog.die("unspecific problem requesting data from %s" % BASE_URL)
- else:
- with warnings.catch_warnings():
- warnings.simplefilter("ignore")
- try:
- req = requests.get(BASE_URL, verify=False, timeout=30)
- req.raise_for_status()
- except requests.exceptions.HTTPError as herr:
- elog.die("problem requesting data from %s:%s" % (BASE_URL, herr))
- except requests.exceptions.Timeout:
- elog.die("timeout requesting data from %s" % BASE_URL)
- except requests.exceptions.TooManyRedirects:
- elog.die("too many retries requesting data from %s" % BASE_URL)
- except requests.exceptions.RequestException as e:
- elog.die("fatal problem requesting data from %s" % BASE_URL)
- except:
- elog.die("unspecific problem requesting data from %s" % BASE_URL)
- req.encoding = "utf8" # maybe not necessary...
- obj = req.json()
- data = obj["features"]
- i = len(data)
- for index in range(i):
- fdata = data[index]
- geom_type = fdata["type"]
- geometry = fdata["geometry"]
- coordinates = geometry["coordinates"]
- lon = float(coordinates[0])
- lat = float(coordinates[1])
- depth = float(coordinates[2])
+for index in range(i):
+ fdata = data[index]
+ unid = fdata["id"]
+ geom_type = fdata["type"]
+ geometry = fdata["geometry"]
+ coordinates = geometry["coordinates"]
+ lon = float(coordinates[0])
+ lat = float(coordinates[1])
+ depth = float(coordinates[2])
+ # EMSC correctly specifies depth as a negative number :-)
+ if progname == "emsc2db":
depth *= -1.0
- properties = fdata["properties"]
- mb = ms = ml = mlnull
- time = (
- status
- ) = (
- cdi
- ) = (
- place
- ) = (
- code
- ) = felt = mag = magtype = net = evtype = auth_str = unid = source_id = ""
- ml = mb = ms = mlnull
- # be sure to convert unicode objects to string objects by calling "str(xxx)",
- # this prevents datascope from CRASHING
- for propk, propv in properties.items():
- if propk == "time":
- try:
- etime = float(propv) / 1000.0
- except ValueError:
- dt = propv.replace("T", " ")
- dt2 = dt.replace("Z", " ")
- etime = stock.str2epoch(dt2)
- elif propk == "mag":
- mag = float(propv)
- elif propk.lower() == "magtype":
- magtype = str(propv)
- elif propk == "place":
- evname = str(propv)
- elif propk == "flynn_region":
- evname = str(propv)
- elif propk == "cdi":
- if propv is not None:
- cdi = float(propv)
- inull = float(propv)
- elif propk == "felt":
- felt = propv
- elif propk == "net":
- net = str(propv)
- elif propk == "auth":
- auth_str = str(propv)
- elif propk == "unid":
- unid = str(propv)
- elif propk == "source_id":
- source_id = str(propv)
- elif propk == "updated":
- updated = propv / 1000.0
- elif propk == "lastupdate":
+ properties = fdata["properties"]
+ mb = ms = ml = mlnull
+ time = (
+ status
+ ) = (
+ cdi
+ ) = place = code = felt = mag = magtype = net = evtype = auth_str = source_id = ""
+ ml = mb = ms = mlnull
+ for propk, propv in properties.items():
+ if propk == "time":
+ try:
+ etime = float(propv) / 1000.0
+ except ValueError:
dt = propv.replace("T", " ")
dt2 = dt.replace("Z", " ")
- updated = stock.str2epoch(dt2)
- elif propk == "place":
- place = str(propv)
-
- # push M to mb, seems to make sense...
- if magtype.lower() == "m":
- magtype = "mb"
-
- if magtype.lower() == "ml":
- ml = mag
- elif magtype.lower() == "mb":
- mb = mag
- elif magtype.lower() == "ms":
- ms = mag
- # grn, srn seems to be unimplemenmted
- gr = stock.grnumber(lat, lon)
- sr = stock.srnumber(lat, lon)
- jdate = stock.epoch2str(etime, "%Y%j")
-
- # fkey = str("%s%s" % (net, code))
-
- kmatch = idmatch.lookup(table="idmatch", record="dbSCRATCH")
- try:
- kmatch.putv(("fkey", unid))
- except Exception as e:
- elog.die("problem writing key %s to matcher :", (unid, e))
-
- matcher = kmatch.matches(idmatch, "fkey")
- rec_list = matcher()
- new_event = False
- evid = 0
- updated_event = False
- if len(rec_list) > 1:
- elog.notify("found too many keys for %s, sth strange goes on here" % unid)
- if len(rec_list) > 0:
- for rec in rec_list:
- idmatch.record = rec
- [ftime, kname, kval] = idmatch.getv("ftime", "keyname", "keyvalue")
- # print "found key %s %s" % (kname, kval)
- if kname == "evid":
- evid = kval
- if updated > ftime:
- new_event = False
- updated_event = True
- else:
- updated_event = False
+ etime = stock.str2epoch(dt2)
+ elif propk == "mag":
+ mag = float(propv)
+ elif propk == "depth":
+ depth = float(propv)
+ elif propk.lower() == "magtype":
+ magtype = str(propv)
+ elif propk == "place":
+ evname = str(propv)
+ elif propk == "flynn_region":
+ evname = str(propv)
+ elif propk == "cdi":
+ if propv is not None:
+ cdi = float(propv)
+ inull = float(propv)
+ elif propk == "felt":
+ felt = propv
+ elif propk == "net":
+ net = str(propv)
+ elif propk == "auth":
+ auth_str = str(propv)
+ # elif propk == "unid": #emsc repeats the id in Features as it "unid"
+ # unid = str(propv)
+ # elif propk == "code": # usgs calls id code
+ # code = str(propv)
+ # elif propk == "source_id":
+ # source_id = str(propv)
+ elif propk == "updated":
+ updated = propv / 1000.0
+ elif propk == "lastupdate":
+ dt = propv.replace("T", " ")
+ dt2 = dt.replace("Z", " ")
+ updated = stock.str2epoch(dt2)
+ elif propk == "place":
+ place = str(propv)
- else:
- new_event = True
+ # push M to mb, seems to make sense to Niko at least...
+ lmt = magtype.lower()
+ if lmt == "m":
+ magtype = "mb"
+ elif lmt == "ml":
+ ml = mag
+ elif lmt == "mb":
+ mb = mag
+ elif lmt == "ms":
+ ms = mag
+ # save mag to origin.mb to for the sake of alarming using orb_quake_alarm
+ if mag_also_to_mb:
+ mb = mag
+
+ gr = stock.grnumber(lat, lon)
+ sr = stock.srnumber(lat, lon)
+ jdate = stock.epoch2str(etime, "%Y%j")
+
+ # fkey = str("%s%s" % (net, code))
+ # if net != "" and code != "":
+ # unid = "%s%s" % (net, code)
+ if debug:
+ elog.notify("check id %s" % unid)
+
+ kmatch = idmatch.lookup(table="idmatch", record="dbSCRATCH")
+ try:
+ kmatch.putv(("fkey", unid))
+ except Exception as e:
+ elog.die("problem writing key %s to matcher :", (unid, e))
+
+ matcher = kmatch.matches(idmatch, "fkey")
+ rec_list = matcher()
+ new_event = False
+ evid = 0
+ updated_event = False
+ if len(rec_list) > 1:
+ elog.notify("found too many keys for %s, sth strange goes on here" % unid)
+ if len(rec_list) > 0:
+ for rec in rec_list:
+ idmatch.record = rec
+ [ftime, kname, kval] = idmatch.getv("ftime", "keyname", "keyvalue")
+ if kname == "evid":
+ evid = kval
+ if updated > ftime:
+ new_event = False
+ updated_event = True
+ else:
+ updated_event = False
+
+ else:
+ new_event = True
- if new_event:
- problem = False
+ if new_event:
+ problem = False
+ if verbose:
+ elog.notify("new event %s" % unid)
+ evid = dborigin.nextid("evid")
+ orid = dborigin.nextid("orid")
+ magid = dborigin.nextid("magid")
+ try:
+ orecno = dborigin.addv(
+ ("time", etime),
+ ("lat", lat),
+ ("lon", lon),
+ ("depth", depth),
+ ("evid", evid),
+ ("orid", orid),
+ ("jdate", jdate),
+ ("mb", mb),
+ ("ml", ml),
+ ("ms", ms),
+ ("nass", 0),
+ ("ndef", 0),
+ ("auth", auth),
+ ("grn", gr),
+ ("srn", sr),
+ )
+ except Exception as __:
+ problem = True
if verbose:
- elog.notify("new event %s" % unid)
- evid = dborigin.nextid("evid")
- orid = dborigin.nextid("orid")
+ elog.notify(
+ "problem adding origin for event at %s" % stock.strtime(etime)
+ )
+ else:
+ dborigin.record = orecno
+
+ if not problem:
try:
- orecno = dborigin.addv(
- ("time", etime),
- ("lat", lat),
- ("lon", lon),
- ("depth", depth),
+ erecno = dbevent.addv(
+ ("evid", evid),
+ ("prefor", orid),
+ ("evname", zu.string_maxbytes(evname, evname_width)),
+ ("auth", auth),
+ )
+ except Exception as __:
+ if verbose:
+ problem = True
+ elog.notify(
+ "problem adding event for events at %s" % stock.strtime(etime)
+ )
+ else:
+ dbevent.record = erecno
+
+ if not problem:
+ try:
+ nmrecno = dbnetmag.addv(
("evid", evid),
("orid", orid),
- ("jdate", jdate),
- ("mb", mb),
- ("ml", ml),
- ("ms", ms),
- ("nass", 0),
- ("ndef", 0),
+ ("magid", magid),
+ ("magnitude", mag),
+ ("magtype", magtype),
("auth", auth),
- ("grn", gr),
- ("srn", sr),
)
except Exception as __:
- problem = True
if verbose:
+ problem = True
elog.notify(
- "problem adding origin for event at %s" % stock.strtime(etime)
+ "problem adding netmap for event at %s" % stock.strtime(etime)
)
+ else:
+ dbnetmag.record = nmrecno
+ if lmt == "mb":
+ dborigin.putv(("mbid", magid))
+ elif lmt == "ms":
+ dborigin.putv(("msid", magid))
+ elif lmt == "ml":
+ dborigin.putv(("mlid", magid))
+ if not problem:
+ if orbname != "" and orbpkttype == "db":
+ pkt = Pkt.Packet()
+ pkt.srcname = Pkt.SrcName(srcname_string="%s/db/origin" % prefix)
+ pkt.db = (
+ dborigin.database,
+ dborigin.table,
+ dborigin.field,
+ dborigin.record,
+ )
+ try:
+ pkttype, packet, srcname, pkttime = pkt.stuff()
+ except Exception:
+ elog.complain("orbstuff error (origin) on %s\n" % unid)
+ else:
+ try:
+ myorb.put(srcname, pkttime, packet)
+ except Exception:
+ elog.complain("orbput error (origin) on %s\n" % unid)
- if not problem:
+ pkt = Pkt.Packet()
+ pkt.srcname = Pkt.SrcName(srcname_string="%s/db/event" % prefix)
+ pkt.db = (
+ dbevent.database,
+ dbevent.table,
+ dbevent.field,
+ dbevent.record,
+ )
try:
- erecno = dbevent.addv(
- ("evid", evid),
- ("prefor", orid),
- ("evname", evname[:evname_width]),
- ("auth", auth),
- )
- except Exception as __:
- if verbose:
- problem = True
- elog.notify(
- "problem adding event for events at %s"
- % stock.strtime(etime)
- )
- if not problem:
+ pkttype, packet, srcname, pkttime = pkt.stuff()
+ except Exception:
+ elog.complain("orbstuff error (event) on %s\n" % unid)
+ else:
+ try:
+ myorb.put(srcname, pkttime, packet)
+ except Exception:
+ elog.complain("orbput error (event) on %s\n" % unid)
+
+ pkt = Pkt.Packet()
+ pkt.srcname = Pkt.SrcName(srcname_string="%s/db/netmag" % prefix)
+ pkt.db = (
+ dbnetmag.database,
+ dbnetmag.table,
+ dbnetmag.field,
+ dbnetmag.record,
+ )
try:
- nmrecno = dbnetmag.addv(
- ("evid", evid),
- ("orid", orid),
- ("magnitude", mag),
- ("magtype", magtype),
- ("auth", auth),
+ pkttype, packet, srcname, pkttime = pkt.stuff()
+ except Exception:
+ elog.complain("orbstuff error (netmag) on %s\n" % unid)
+ else:
+ try:
+ myorb.put(srcname, pkttime, packet)
+ except Exception:
+ elog.complain("orbput error (netmag) on %s\n" % unid)
+ try:
+ idmatch.addv(
+ ("fkey", unid),
+ ("keyname", "evid"),
+ ("keyvalue", evid),
+ ("ftime", updated),
+ )
+ except Exception:
+ if verbose:
+ problem = True
+ elog.notify(
+ "problem adding id for event at %s" % stock.strtime(etime)
)
- except Exception as __:
- if verbose:
- problem = True
- elog.notify(
- "problem adding netmap for event at %s"
- % stock.strtime(etime)
+ elif updated_event:
+ if verbose:
+ elog.notify("updated event %s" % unid)
+ idmatch.putv(("ftime", updated))
+ kmatch = db.lookup(table="event", record="dbSCRATCH")
+ kmatch.putv(("evid", evid))
+ evmatcher = kmatch.matches(dbevent, "evid")
+ evlist = evmatcher()
+ if len(evlist) > 1:
+ elog.notify("strange, found a few matching events for evid %d " % evid)
+ if len(evlist) > 0:
+
+ dbevent.record = evlist[0]
+ [prefor] = dbevent.getv("prefor")
+ kmatch = db.lookup(table="origin", record="dbSCRATCH")
+ kmatch.putv(("orid", prefor))
+ ormatcher = kmatch.matches(dborigin, "orid")
+ orlist = ormatcher()
+ if len(orlist) > 1:
+ elog.notify("strange, found a few origind for orid %d" % prefor)
+ if len(orlist) > 0:
+ dborigin.record = orlist[0]
+ dborigin.putv(
+ ("time", etime),
+ ("lat", lat),
+ ("lon", lon),
+ ("depth", depth),
+ ("jdate", jdate),
+ )
+ if magtype.lower() == "ml":
+ dborigin.putv(("ml", mag))
+ elif magtype.lower() == "mb":
+ dborigin.putv(("mb", mag))
+ elif magtype.lower() == "ms":
+ dborigin.putv(("ms", mag))
+ if orbname != "":
+ if orbpkttype == "db":
+ pkt = Pkt.Packet()
+ # points already to right row # dborigin.record = orecno
+ pkt.srcname = Pkt.SrcName(
+ srcname_string="%s/db/origin" % prefix
)
- if not problem:
- try:
- idmatch.addv(
- ("fkey", unid),
- ("keyname", "evid"),
- ("keyvalue", evid),
- ("ftime", updated),
- )
- except Exception as __:
- if verbose:
- problem = True
- elog.notify(
- "problem adding id for event at %s" % stock.strtime(etime)
+ pkt.db = (
+ dborigin.database,
+ dborigin.table,
+ dborigin.field,
+ dborigin.record,
)
- elif updated_event:
- if verbose:
- elog.notify("updated event %s" % unid)
- idmatch.putv(("ftime", updated))
- kmatch = db.lookup(table="event", record="dbSCRATCH")
- kmatch.putv(("evid", evid))
- evmatcher = kmatch.matches(dbevent, "evid")
- evlist = evmatcher()
- if len(evlist) > 1:
- elog.notify("strange, found a few matching events for evid %d " % evid)
- if len(evlist) > 0:
- dbevent.record = evlist[0]
- [prefor] = dbevent.getv("prefor")
-
- kmatch = db.lookup(table="origin", record="dbSCRATCH")
+ pkttype, packet, srcname, pkttime = pkt.stuff()
+ myorb.put(srcname, pkttime, packet)
+
+ kmatch = db.lookup(table="netmag", record="dbSCRATCH")
kmatch.putv(("orid", prefor))
- ormatcher = kmatch.matches(dborigin, "orid")
- orlist = ormatcher()
- if len(orlist) > 1:
- elog.notify("strange, found a few origind for orid %d" % prefor)
- if len(orlist) > 0:
- dborigin.record = orlist[0]
- dborigin.putv(
- ("time", etime),
- ("lat", lat),
- ("lon", lon),
- ("depth", depth),
- ("jdate", jdate),
+ magmatcher = kmatch.matches(dbnetmag, "orid")
+ maglist = magmatcher()
+ if len(maglist) > 1:
+ elog.notify("strange, found a few netmags for origin %d" % prefor)
+ if len(maglist) > 0:
+
+ dbnetmag.record = maglist[0]
+ dbnetmag.putv(
+ ("magnitude", mag), ("magtype", magtype), ("auth", auth)
)
- if magtype.lower() == "ml":
- dborigin.putv(("ml", mag))
- elif magtype.lower() == "mb":
- dborigin.putv(("mb", mag))
- elif magtype.lower() == "ms":
- dborigin.putv(("ms", mag))
- kmatch = db.lookup(table="netmag", record="dbSCRATCH")
- kmatch.putv(("orid", prefor))
- magmatcher = kmatch.matches(dbnetmag, "orid")
- maglist = magmatcher()
- if len(maglist) > 1:
- elog.notify(
- "strange, found a few netmags for origin %d" % prefor
- )
- if len(maglist) > 0:
- dbnetmag.record = maglist[0]
- dbnetmag.putv(
- ("magnitude", mag), ("magtype", magtype), ("auth", auth)
- )
+ if orbname != "":
+ if orbpkttype == "db":
+ pkt = Pkt.Packet()
+ # points already to right row # dborigin.record = orecno
+ pkt.srcname = Pkt.SrcName(
+ srcname_string="%s/db/origin" % prefix
+ )
+ pkt.db = (
+ dbnetmag.database,
+ dbnetmag.table,
+ dbnetmag.field,
+ dbnetmag.record,
+ )
+ pkttype, packet, srcname, pkttime = pkt.stuff()
+ myorb.put(srcname, pkttime, packet)
+
+ if not problem and (new_event or updated_event) and orbname != "" and orbpkttype != "db":
+ dbevent.get(scratch=True) # read data into scratch record
+ # because it's safe to manipulate the scratch record later
+ dbevent.record = ds.dbSCRATCH
+ dbevent.putv(("evid", 1), ("prefor", 2), ("commid", -1))
+
+ dborigin.get(scratch=True) # read data into scratch record
+ dborigin.record = ds.dbSCRATCH
+ dborigin.putv(
+ ("evid", 1),
+ ("orid", 2),
+ ("commid", -1),
+ ("mbid", -1),
+ ("msid", -1),
+ ("mlid", -1),
+ )
+
+ dbnetmag.get(scratch=True)
+ dbnetmag.record = ds.dbSCRATCH
+ dbnetmag.putv(
+ ("magid", -1),
+ ("orid", 2),
+ ("evid", 1),
+ ("commid", -1),
+ )
+ if lmt == "mb":
+ dborigin.putv(("mbid", 3))
+ dbnetmag.putv(("magid", 3))
+ elif lmt == "ms":
+ dborigin.putv(("msid", 3))
+ dbnetmag.putv(("magid", 3))
+ elif lmt == "ml":
+ dborigin.putv(("mlid", 3))
+ dbnetmag.putv(("magid", 3))
+ pfstring = []
+ pfstring.append("schema css3.0\n")
+ if archive_all:
+ pfstring.append("archive_if_not_associated yes\n")
+ else:
+ pfstring.append("archive_if_not_associated no\n")
+ pfstring.append("event &Literal{\n")
+ pfstring.append(dbevent.get())
+ pfstring.append("}\n")
+ pfstring.append("origin &Literal{\n")
+ pfstring.append(dborigin.get())
+ pfstring.append("}\n")
+ pfstring.append("magnitude_update yes\n")
+ pfstring.append("netmag &Literal{\n")
+ pfstring.append(dbnetmag.get())
+ pfstring.append("}\n")
- return 0
+ pfstring = "".join(pfstring)
+ pfout = stock.ParameterFile(type=stock.PFARR, auto_convert=False)
+ try:
+ pfout.pfcompile(pfstring)
+ except Exception:
+ elog.complain("pfcompile() error on %s\n" % pfstring)
+ else:
+ srcname = ""
+ pkt = Pkt.Packet()
+ pkt.time = stock.now()
+ pkt.srcname = Pkt.SrcName(srcname_string="%s/pf/orb2dbt" % prefix)
+ pkt.pf = pfout
+ try:
+ pkttype, packet, srcname, pkttime = pkt.stuff()
+ except Exception:
+ elog.complain("stuff Pkt error on %s\n" % unid)
+ else:
+ try:
+ myorb.put(srcname, pkttime, packet)
+ except Exception:
+ elog.complain("orbput error on %s\n" % unid)
+ else:
+ if debug:
+ elog.notify("output pfpkt for %s" % unid)
-if __name__ == "__main__":
- status = main()
- sys.exit(status)
+sys.exit(0)
diff --git a/bin/import/usgs2db/fdsntxt2db.1 b/bin/import/usgs2db/fdsntxt2db.1
new file mode 100644
index 000000000..f87a1ae85
--- /dev/null
+++ b/bin/import/usgs2db/fdsntxt2db.1
@@ -0,0 +1,68 @@
+.TH FDSNTXT2DB 1
+.SH NAME
+fdsntxt2db \- utility to retrieve earthquake information in text format from \fBFDSN\fP services.
+.SH SYNOPSIS
+.nf
+\fBfdsntxt2db\fP [-v] [-h] [-a \fIauthor\fP]
+ [-k \fIkeydbname\fP] [-u \fIservice-url\fP] \fIdbname\fP
+.fi
+.SH DESCRIPTION
+\fBfdsntxt2db\fP queries fdsn services for event information in text format
+and stores the event information in a database.
+The programs keeps track of event ids in a separate table and updates
+the output database if new information is available.
+.br
+.SH OPTIONS
+.IP \-v
+verbose flag
+.IP -h
+Show help.
+.IP "-k keydbname"
+name of database to keep track of event ids. Since USGS/EMSC IDs
+are a mixture of strings and integers, a separate table is needed.
+The database must be in schema \fBidmatch1.0\fP or higher. The database
+is created upon startup if not originally existing.
+The database name defaults to keydb.
+.IP \-u
+URL of the data source. A list of all available feeds can be found on a
+website of the \fBFDSN\fP: \fBhttps://www.fdsn.org/datacenters/\fP.
+Please be aware that not all datacenters provide event information. And
+not all datacenters providing event information also support the text format.
+The URL defaults to \fBhttp://webservices.ingv.it/fdsnws/event/1/query?format=text\fI,
+the service run by INGV for Italy.
+.IP "-a author"
+Author name for event, origin and netmag table. If this is not specified, the author information returned by the service is used. There is no default.
+.IP database
+The name of the output database. This argument is required.
+.SH EXAMPLE
+To retrieve recent event data from INGV into a database named \fBingv\fP:
+.nf
+fdsntxt2db -k db/fdsn_ids -v ingv
+.fi
+To update event information every 10 minutes, add the following to your rtexec.pf
+.nf
+# update database USGS every 10 minutes, all events above magnitude 2.5
+INGV UTC 0,10,20,30,40,50 * * * * fdsntxt2db -k db/fdsn_ids db/ingv
+.fi
+.SH ENVIRONMENT
+The program uses the Python module \fIrequests\fP to retrieve data from a
+webservice. This module supports proxy configuration based on the standard
+environment variables \fIhttp_proxy\fP, \fIhttps_proxy\fP.
+If you need more control over proxy settings, feel free to
+contact the author, Nikolaus.Horn@zamg.ac.at.
+.SH "SEE ALSO"
+.nf
+
+https://docs.python-requests.org/en/master, USGS2orb(1), antelope_python(3y)
+
+.fi
+.SH "BUGS AND CAVEATS"
+Since the text format for event information does not provide information on
+when the data has been updated, information on existing events is always
+overwritten. This is inefficient but unavoidable. The error handling is simple.
+I implemented my personal understanding of the data offered. There might
+be wiser ways to use the save the information in a database.
+This module uses the python modules requests with all their bugs and
+limitations. And of course I added many more problems...
+.SH AUTHOR
+Nikolaus Horn (nikolaus.horn@zamg.ac.at)
diff --git a/bin/import/usgs2db/fdsntxt2db.xpy b/bin/import/usgs2db/fdsntxt2db.xpy
index 1116f758d..0914f17bc 100755
--- a/bin/import/usgs2db/fdsntxt2db.xpy
+++ b/bin/import/usgs2db/fdsntxt2db.xpy
@@ -1,61 +1,76 @@
-sys.path.append(os.environ["ANTELOPE"] + "/contrib/data/python")
-
"""
@author Nikolaus Horn
-@created 2018-01-01
-@modified 2020-10-27
-@version 1.0
+@created 2013-11-25
+@modified 2022-03-31
+@version 1.2
@license MIT-style license
+@credits ZAMG for my visit to EGU 2014
"""
-# Import Antelope modules
+import getopt
+import requests
+
+# import json
+import warnings
+# Import Antelope modules
import antelope.datascope as ds
import antelope.stock as stock
-import getopt
-import codecs
-import urllib3
-import json
-import pprint
+import antelope.elog as elog
+
+import zamg.utilities as zu
-def usage():
- print(sys.argv[0], "[-v] [-a auth] [-k keydb] [-u url] dbname")
+def usage(progname):
+ print(progname, "[-v] [-h] [-p proxy_url] [-a auth] [-k keydb] [-u url] dbname")
def main():
- BASE_URL = "http://webservices.rm.ingv.it/fdsnws/event/1/query?format=text"
- verbose = 0
- archive = 0
+ progname = sys.argv[0].split("/")[-1]
+ elog.init(progname)
+ BASE_URL = "http://webservices.ingv.it/fdsnws/event/1/query?format=text"
+
+ auth = ""
+ help_text = """a list of datacenters running FDSN services can be found on the web:
+ https://www.fdsn.org/datacenters
+ Unfortunately, there is no general overview if these services provide event information and also support the text format.
+ You mut check each webservice individually"""
+ verbose = False
opts = []
args = []
keydbname = "keydb"
keyschema = "idmatch1.0"
- auth = "INGV"
+ proxy_url = ""
try:
- opts, args = getopt.getopt(sys.argv[1:], "a:k:u:v", "")
+ opts, args = getopt.getopt(sys.argv[1:], "a:hk:p:u:v", "")
except getopt.GetoptError:
- print("illegal option")
- usage()
+ elog.die("illegal option")
+ usage(progname)
sys.exit(2)
for o, a in opts:
if o == "-v":
- verbose = 1
+ verbose = True
elif o == "-a":
auth = a
elif o == "-u":
BASE_URL = a
elif o == "-k":
keydbname = a
+ elif o == "-p":
+ proxy_url = a
+ elif o == "-h":
+ usage(progname)
+ elog.notify(help_text)
+ sys.exit(0)
if len(args) > 1 or len(args) < 1:
- usage()
+ usage(progname)
sys.exit(1)
- dbname = args[0]
- # print dbname
+ if len(args) > 0:
+ dbname = args[0]
db = ds.dbopen(dbname, "r+")
dborigin = db.lookup(table="origin")
@@ -66,13 +81,15 @@ def main():
[mlnull] = dbq.getv("ml")
dbq = db.lookup(table="event", field="evname", record="dbNULL")
evname_width = dbq.query("dbFIELD_SIZE")
+ dbq = db.lookup(table="event", field="auth", record="dbNULL")
+ auth_width = dbq.query("dbFIELD_SIZE")
kdb = ds.dbopen(keydbname, "r+")
descname = kdb.query("dbDATABASE_FILENAME")
if os.path.exists(descname):
schemaname = kdb.query("dbSCHEMA_NAME")
if schemaname != keyschema:
- print(
+ elog.die(
"keydb %s has wrong schema %s, should be %s"
% (keydbname, schemaname, keyschema)
)
@@ -80,178 +97,265 @@ def main():
else:
kdb.close()
ds.dbcreate(keydbname, keyschema)
+
kdb = ds.dbopen(keydbname, "r+")
try:
idmatch = kdb.lookup(table="idmatch")
except Exception as e:
- print("Error :", e)
-
- updated = stock.now()
- # proxies={'http':'http://138.22.156.44:3128'}
- http = urllib3.PoolManager()
- req = http.request("GET", BASE_URL)
- txt_string = req.data.decode()
- # #EventID|Time|Latitude|Longitude|Depth/Km|Author|Catalog|Contributor|ContributorID|MagType|Magnitude|MagAuthor|EventLocationName
- # 7093051|2016-08-24T07:55:22.780000|42.8127|13.1653|9.6|SURVEY-INGV||||ML|2.8|--|Perugia
+ elog.die("fatal problem with key database:", e)
- for line in txt_string.splitlines():
- if line.startswith("#"):
- continue
- time = status = cdi = place = code = felt = mag = magtype = net = evtype = ""
- (
- evid,
- timestr,
- lats,
- lons,
- depths,
- oauth,
- cat,
- cont,
- contid,
- magtype,
- mags,
- magauth,
- evname,
- rest,
- ) = line.split("|", 14)
+ if proxy_url != "":
+ if proxy_url.startswith("https"):
+ proxy = {"https": proxy_url}
+ else:
+ proxy = {"http": proxy_url}
+ with warnings.catch_warnings():
+ warnings.simplefilter(
+ "ignore"
+ ) # ignore silly warnings on SSL verification, especially needed on 5.9
+ try:
+ req = requests.get(BASE_URL, proxies=proxy, verify=False, timeout=30)
+ req.raise_for_status()
+ except requests.exceptions.HTTPError as herr:
+ elog.die("problem requesting data from %s:%s" % (BASE_URL, herr))
+ except requests.exceptions.Timeout:
+ elog.die("timeout requesting data from %s" % BASE_URL)
+ except requests.exceptions.TooManyRedirects:
+ elog.die("too many retries requesting data from %s" % BASE_URL)
+ except requests.exceptions.RequestException as e:
+ elog.die("fatal problem requesting data from %s" % BASE_URL)
+ except:
+ elog.die("unspecific problem requesting data from %s" % BASE_URL)
+ else:
+ with warnings.catch_warnings():
+ warnings.simplefilter("ignore")
+ try:
+ req = requests.get(BASE_URL, verify=False, timeout=30)
+ req.raise_for_status()
+ except requests.exceptions.HTTPError as herr:
+ elog.die("problem requesting data from %s:%s" % (BASE_URL, herr))
+ except requests.exceptions.Timeout:
+ elog.die("timeout requesting data from %s" % BASE_URL)
+ except requests.exceptions.TooManyRedirects:
+ elog.die("too many retries requesting data from %s" % BASE_URL)
+ except requests.exceptions.RequestException as e:
+ elog.die("fatal problem requesting data from %s" % BASE_URL)
+ except:
+ elog.die("unspecific problem requesting data from %s" % BASE_URL)
+ req.encoding = "utf8" # maybe not necessary...
+ data = req.text
+ for line in data.splitlines():
+ if not line.startswith("#"):
+ updated = stock.now()
+ time = (
+ status
+ ) = cdi = place = code = felt = mag = magtype = net = evtype = ""
+ (
+ unid,
+ timestr,
+ lats,
+ lons,
+ depths,
+ oauth,
+ cat,
+ cont,
+ contid,
+ magtype,
+ mags,
+ magauth,
+ evname,
+ rest,
+ ) = line.split("|", 14)
+ mag = float(mags)
+ lat = float(lats)
+ lon = float(lons)
+ depth = float(depths)
+ etime = stock.str2epoch(timestr.replace("T", " "))
+ if auth != "":
+ oauth = auth
+ magauth = auth
- evid = int(evid)
- mag = float(mags)
- lat = float(lats)
- lon = float(lons)
- depth = float(depths)
- etime = stock.str2epoch(timestr.replace("T", " "))
- if auth != "INGV":
- auth = str(oauth)
+ ml = mb = ms = mlnull
- ml = mb = ms = mlnull
- # be sure to convert unicode objects to string objects by calling "str(xxx)",
- # this prevents datascope from CRASHING
+ # push M to mb, seems to make sense...
+ lmt = magtype.lower()
+ if lmt == "m":
+ magtype = "mb"
+ elif lmt == "ml":
+ ml = mag
+ elif lmt == "mb":
+ mb = mag
+ elif lmt == "ms":
+ ms = mag
- if magtype.lower() == "ml":
- ml = mag
- elif magtype.lower() == "mb":
- mb = mag
- elif magtype.lower() == "ms":
- ms = mag
- # grn, srn seems to be unimplemenmted
- gr = stock.grnumber(lat, lon)
- sr = stock.srnumber(lat, lon)
- jdate = stock.epoch2str(etime, "%Y%j")
+ gr = stock.grnumber(lat, lon)
+ sr = stock.srnumber(lat, lon)
+ jdate = stock.epoch2str(etime, "%Y%j")
- fkey = str("%d" % evid)
+ if verbose:
+ elog.notify("check id %s" % unid)
- kmatch = idmatch.lookup(table="idmatch", record="dbSCRATCH")
- try:
- kmatch.putv(("fkey", fkey))
- except Exception as e:
- print("Error :", e)
+ kmatch = idmatch.lookup(table="idmatch", record="dbSCRATCH")
+ try:
+ kmatch.putv(("fkey", unid))
+ except Exception as e:
+ elog.die("problem writing key %s to matcher :", (unid, e))
- matcher = kmatch.matches(idmatch, "fkey")
- rec_list = matcher()
- new_event = False
- evid = 0
- updated_event = False
- if len(rec_list) > 1:
- print("found too many keys, sth strange goes on here")
- if len(rec_list) > 0:
- for rec in rec_list:
- idmatch.record = rec
- [ftime, kname, kval] = idmatch.getv("ftime", "keyname", "keyvalue")
- # print "found key %s %s" % (kname, kval)
- if kname == "evid":
- evid = kval
- if updated > ftime:
- new_event = False
- updated_event = True
- else:
- updated_event = False
- else:
- new_event = True
+ matcher = kmatch.matches(idmatch, "fkey")
+ rec_list = matcher()
+ new_event = False
+ evid = 0
+ updated_event = False
+ if len(rec_list) > 1:
+ elog.notify(
+ "found too many keys for %s, sth strange goes on here" % unid
+ )
+ if len(rec_list) > 0:
+ for rec in rec_list:
+ idmatch.record = rec
+ [ftime, kname, kval] = idmatch.getv("ftime", "keyname", "keyvalue")
+ # print "found key %s %s" % (kname, kval)
+ if kname == "evid":
+ evid = kval
+ if updated > ftime:
+ new_event = False
+ updated_event = True
+ else:
+ updated_event = False
- if new_event:
- if verbose:
- print("new event %s" % code)
- evid = dborigin.nextid("evid")
- orid = dborigin.nextid("orid")
- orecno = dborigin.addv(
- ("time", etime),
- ("lat", lat),
- ("lon", lon),
- ("depth", depth),
- ("evid", evid),
- ("orid", orid),
- ("jdate", jdate),
- ("mb", mb),
- ("ml", ml),
- ("ms", ms),
- ("nass", 0),
- ("ndef", 0),
- ("auth", auth),
- ("grn", gr),
- ("srn", sr),
- )
- erecno = dbevent.addv(
- ("evid", evid),
- ("prefor", orid),
- ("evname", evname[:evname_width]),
- ("auth", auth),
- )
- nmrecno = dbnetmag.addv(
- ("evid", evid),
- ("orid", orid),
- ("magnitude", mag),
- ("magtype", magtype),
- ("auth", auth),
- )
- # idmatch.addv(('fkey',fkey),('keyname','evid'),('keyvalue',evid),('ftime',updated) )
- idmatch.addv(("fkey", fkey), ("keyname", "evid"), ("keyvalue", evid))
- elif updated_event:
- if verbose:
- print("updated event %s" % code)
- idmatch.putv(("ftime", updated))
- kmatch = db.lookup(table="event", record="dbSCRATCH")
- kmatch.putv(("evid", evid))
- evmatcher = kmatch.matches(dbevent, "evid")
- evlist = evmatcher()
- if len(evlist) > 1:
- print("strange, found a few matching events for evid %d " % evid)
- if len(evlist) > 0:
- dbevent.record = evlist[0]
- [prefor] = dbevent.getv("prefor")
+ else:
+ new_event = True
- kmatch = db.lookup(table="origin", record="dbSCRATCH")
- kmatch.putv(("orid", prefor))
- ormatcher = kmatch.matches(dborigin, "orid")
- orlist = ormatcher()
- if len(orlist) > 1:
- print("strange, found a few origind for orid %d" % prefor)
- if len(orlist) > 0:
- dborigin.record = orlist[0]
- dborigin.putv(
+ if new_event:
+ problem = False
+ if verbose:
+ elog.notify("new event %s" % unid)
+ evid = dborigin.nextid("evid")
+ orid = dborigin.nextid("orid")
+ try:
+ orecno = dborigin.addv(
("time", etime),
("lat", lat),
("lon", lon),
("depth", depth),
+ ("evid", evid),
+ ("orid", orid),
("jdate", jdate),
+ ("mb", mb),
+ ("ml", ml),
+ ("ms", ms),
+ ("nass", 0),
+ ("ndef", 0),
+ ("auth", zu.string_maxbytes(oauth, auth_width)),
+ ("grn", gr),
+ ("srn", sr),
)
- if magtype.lower() == "ml":
- dborigin.putv(("ml", mag))
- elif magtype.lower() == "mb":
- dborigin.putv(("mb", mag))
- elif magtype.lower() == "ms":
- dborigin.putv(("ms", mag))
- kmatch = db.lookup(table="netmag", record="dbSCRATCH")
+ except Exception as __:
+ problem = True
+ if verbose:
+ elog.notify(
+ "problem adding origin for event at %s"
+ % stock.strtime(etime)
+ )
+
+ if not problem:
+ try:
+ erecno = dbevent.addv(
+ ("evid", evid),
+ ("prefor", orid),
+ ("evname", zu.string_maxbytes(evname, evname_width)),
+ ("auth", zu.string_maxbytes(oauth, auth_width)),
+ )
+ except Exception as __:
+ if verbose:
+ problem = True
+ elog.notify(
+ "problem adding event for events at %s"
+ % stock.strtime(etime)
+ )
+ if not problem:
+ try:
+ nmrecno = dbnetmag.addv(
+ ("evid", evid),
+ ("orid", orid),
+ ("magnitude", mag),
+ ("magtype", magtype),
+ ("auth", zu.string_maxbytes(magauth, auth_width)),
+ )
+ except Exception as __:
+ if verbose:
+ problem = True
+ elog.notify(
+ "problem adding netmap for event at %s"
+ % stock.strtime(etime)
+ )
+ if not problem:
+ try:
+ idmatch.addv(
+ ("fkey", unid),
+ ("keyname", "evid"),
+ ("keyvalue", evid),
+ ("ftime", updated),
+ )
+ except Exception as __:
+ if verbose:
+ problem = True
+ elog.notify(
+ "problem adding id for event at %s"
+ % stock.strtime(etime)
+ )
+ elif updated_event:
+ if verbose:
+ elog.notify("eventually updated event %s" % unid)
+ idmatch.putv(("ftime", updated))
+ kmatch = db.lookup(table="event", record="dbSCRATCH")
+ kmatch.putv(("evid", evid))
+ evmatcher = kmatch.matches(dbevent, "evid")
+ evlist = evmatcher()
+ if len(evlist) > 1:
+ elog.notify(
+ "strange, found a few matching events for evid %d " % evid
+ )
+ if len(evlist) > 0:
+ dbevent.record = evlist[0]
+ [prefor] = dbevent.getv("prefor")
+
+ kmatch = db.lookup(table="origin", record="dbSCRATCH")
kmatch.putv(("orid", prefor))
- magmatcher = kmatch.matches(dbnetmag, "orid")
- maglist = magmatcher()
- if len(maglist) > 1:
- print("strange, found a few netmags for origin %d" % prefor)
- if len(maglist) > 0:
- dbnetmag.record = maglist[0]
- dbnetmag.putv(
- ("magnitude", mag), ("magtype", magtype), ("auth", auth)
+ ormatcher = kmatch.matches(dborigin, "orid")
+ orlist = ormatcher()
+ if len(orlist) > 1:
+ elog.notify("strange, found a few origins for orid %d" % prefor)
+ if len(orlist) > 0:
+ dborigin.record = orlist[0]
+ dborigin.putv(
+ ("time", etime),
+ ("lat", lat),
+ ("lon", lon),
+ ("depth", depth),
+ ("jdate", jdate),
)
+ if magtype.lower() == "ml":
+ dborigin.putv(("ml", mag))
+ elif magtype.lower() == "mb":
+ dborigin.putv(("mb", mag))
+ elif magtype.lower() == "ms":
+ dborigin.putv(("ms", mag))
+ kmatch = db.lookup(table="netmag", record="dbSCRATCH")
+ kmatch.putv(("orid", prefor))
+ magmatcher = kmatch.matches(dbnetmag, "orid")
+ maglist = magmatcher()
+ if len(maglist) > 1:
+ elog.notify(
+ "strange, found a few netmags for origin %d" % prefor
+ )
+ if len(maglist) > 0:
+ dbnetmag.record = maglist[0]
+ dbnetmag.putv(
+ ("magnitude", mag),
+ ("magtype", magtype),
+ ("auth", zu.string_maxbytes(magauth, auth_width)),
+ )
return 0
diff --git a/bin/import/usgs2db/gfzrss2db.1 b/bin/import/usgs2db/gfzrss2db.1
new file mode 100644
index 000000000..b08672ca5
--- /dev/null
+++ b/bin/import/usgs2db/gfzrss2db.1
@@ -0,0 +1,66 @@
+.TH GFZRSS2DB 1
+.SH NAME
+gfzrss2db \- utility to retrieve earthquake information in text format from \fBFDSN\fP services.
+.SH SYNOPSIS
+.nf
+\fBgfzrss2db\fP [-v] [-h] [-a \fIauthor\fP]
+ [-k \fIkeydbname\fP] [-u \fIservice-url\fP] \fIdbname\fP
+.fi
+.SH DESCRIPTION
+\fBgfzrss2db\fP queries the RSS-Feed of GPZ
+and stores the event information in a database.
+The programs keeps track of event ids in a separate table and updates
+the output database if new information is available.
+.br
+.SH OPTIONS
+.IP \-v
+verbose flag
+.IP -h
+Show help.
+.IP "-k keydbname"
+name of database to keep track of event ids. Since IDs used by GFZ
+are a mixture of strings and integers, a separate table is needed.
+The database must be in schema \fBidmatch1.0\fP or higher. The database
+is created upon startup if not originally existing.
+The database name defaults to keydb.
+.IP \-u
+URL of the data source. The RSS-Feed should have exact the same format as
+provided by GFZ on http://geofon.gfz-potsdam.de/eqinfo/list.php?fmt=rss.
+Probably it makes no sense not to use the default given above.
+.IP "-a author"
+Author name for event, origin and netmag table. The event flag (A for automatic) is appended. Defaults to GFZ.
+.IP database
+The name of the output database. This argument is required.
+.SH EXAMPLE
+Recent event data from GFZ into a database named \fBgfz\fP:
+.nf
+gfzrss2db -k db/gfz_ids -v gfz
+.fi
+To update event information every 10 minutes, add the following to your rtexec.pf
+.nf
+# update database gfz every 10 minutes
+GFZ UTC 0,10,20,30,40,50 * * * * gfzrss2db -k db/gfz_ids db/gfz
+.fi
+.SH ENVIRONMENT
+The program uses the Python module \fIrequests\fP to retrieve data from a
+webservice. This module supports proxy configuration based on the standard
+environment variables \fIhttp_proxy\fP, \fIhttps_proxy\fP.
+If you need more control over proxy settings, feel free to
+contact the author, Nikolaus.Horn@zamg.ac.at.
+.SH "SEE ALSO"
+.nf
+
+https://docs.python-requests.org/en/master, USGS2orb(1), antelope_python(3y)
+
+.fi
+.SH "BUGS AND CAVEATS"
+Since the text format for event information does not provide information on
+when the data has been updated, information on existing events is always
+overwritten. This is inefficient, but unavoidable. The error handling is simple.
+Since no magnitude type is given, it is set to \fImb\fP.
+I implemented my personal understanding of the data offered. There might
+be wiser ways to use the save the information in a database.
+This module uses the python modules requests with all their bugs and
+limitations. And of course I added many more problems...
+.SH AUTHOR
+Nikolaus Horn (nikolaus.horn@zamg.ac.at)
diff --git a/bin/import/usgs2db/gfzrss2db.xpy b/bin/import/usgs2db/gfzrss2db.xpy
new file mode 100755
index 000000000..b7b3e608b
--- /dev/null
+++ b/bin/import/usgs2db/gfzrss2db.xpy
@@ -0,0 +1,350 @@
+"""
+@author Nikolaus Horn
+@created 2013-11-25
+@modified 2022-03-31
+@version 1.2
+@license MIT-style license
+@credits ZAMG for my visit to EGU 2014
+"""
+
+
+import getopt
+import requests
+import warnings
+
+# XML related stuff
+import xml.dom.minidom
+import pprint
+import datetime
+
+# Import Antelope modules
+import antelope.datascope as ds
+import antelope.stock as stock
+import antelope.elog as elog
+
+import zamg.utilities as zu
+
+
+def getText(nodelist):
+ rc = []
+ for node in nodelist:
+ if node.nodeType == node.TEXT_NODE:
+ rc.append(node.data)
+ return "".join(rc)
+
+
+def usage(progname):
+ print(progname, "[-v] [-h] [-p proxy_url] [-a auth] [-k keydb] [-u url] dbname")
+
+
+def main():
+ progname = sys.argv[0].split("/")[-1]
+ elog.init(progname)
+ BASE_URL = "http://geofon.gfz-potsdam.de/eqinfo/list.php?fmt=rss"
+ auth_base = "GFZ"
+ help_text = """Not all datacenters provide event information using FDSN webservices
+Unfortunately, RSS or GeoRSS is not fully standardized. I assume this progam is only useful for obtaining event information from GFZ"""
+ verbose = False
+ opts = []
+ args = []
+ keydbname = "keydb"
+ keyschema = "idmatch1.0"
+ proxy_url = ""
+ try:
+ opts, args = getopt.getopt(sys.argv[1:], "a:hk:p:u:v", "")
+ except getopt.GetoptError:
+ elog.die("illegal option")
+ usage(progname)
+ sys.exit(2)
+
+ for o, a in opts:
+ if o == "-v":
+ verbose = True
+ elif o == "-a":
+ auth_base = a
+ elif o == "-u":
+ BASE_URL = a
+ elif o == "-k":
+ keydbname = a
+ elif o == "-p":
+ proxy_url = a
+ elif o == "-h":
+ usage(progname)
+ elog.notify(help_text)
+ sys.exit(0)
+
+ if len(args) > 1 or len(args) < 1:
+ usage(progname)
+ sys.exit(1)
+
+ if len(args) > 0:
+ dbname = args[0]
+
+ db = ds.dbopen(dbname, "r+")
+ dborigin = db.lookup(table="origin")
+ dbevent = db.lookup(table="event")
+ dbnetmag = db.lookup(table="netmag")
+
+ dbq = db.lookup(table="origin", field="ml", record="dbNULL")
+ [mlnull] = dbq.getv("ml")
+ dbq = db.lookup(table="event", field="evname", record="dbNULL")
+ evname_width = dbq.query("dbFIELD_SIZE")
+ dbq = db.lookup(table="event", field="auth", record="dbNULL")
+ auth_width = dbq.query("dbFIELD_SIZE")
+
+ kdb = ds.dbopen(keydbname, "r+")
+ descname = kdb.query("dbDATABASE_FILENAME")
+ if os.path.exists(descname):
+ schemaname = kdb.query("dbSCHEMA_NAME")
+ if schemaname != keyschema:
+ elog.die(
+ "keydb %s has wrong schema %s, should be %s"
+ % (keydbname, schemaname, keyschema)
+ )
+ sys.exit(1)
+ else:
+ kdb.close()
+ ds.dbcreate(keydbname, keyschema)
+
+ kdb = ds.dbopen(keydbname, "r+")
+ try:
+ idmatch = kdb.lookup(table="idmatch")
+ except Exception as e:
+ elog.die("fatal problem with key database:", e)
+
+ if proxy_url != "":
+ if proxy_url.startswith("https"):
+ proxy = {"https": proxy_url}
+ else:
+ proxy = {"http": proxy_url}
+ with warnings.catch_warnings():
+ warnings.simplefilter(
+ "ignore"
+ ) # ignore silly warnings on SSL verification, especially needed on 5.9
+ try:
+ req = requests.get(BASE_URL, proxies=proxy, verify=False, timeout=30)
+ req.raise_for_status()
+ except requests.exceptions.HTTPError as herr:
+ elog.die("problem requesting data from %s:%s" % (BASE_URL, herr))
+ except requests.exceptions.Timeout:
+ elog.die("timeout requesting data from %s" % BASE_URL)
+ except requests.exceptions.TooManyRedirects:
+ elog.die("too many retries requesting data from %s" % BASE_URL)
+ except requests.exceptions.RequestException as e:
+ elog.die("fatal problem requesting data from %s" % BASE_URL)
+ except:
+ elog.die("unspecific problem requesting data from %s" % BASE_URL)
+ else:
+ with warnings.catch_warnings():
+ warnings.simplefilter("ignore")
+ try:
+ req = requests.get(BASE_URL, verify=False, timeout=30)
+ req.raise_for_status()
+ except requests.exceptions.HTTPError as herr:
+ elog.die("problem requesting data from %s:%s" % (BASE_URL, herr))
+ except requests.exceptions.Timeout:
+ elog.die("timeout requesting data from %s" % BASE_URL)
+ except requests.exceptions.TooManyRedirects:
+ elog.die("too many retries requesting data from %s" % BASE_URL)
+ except requests.exceptions.RequestException as e:
+ elog.die("fatal problem requesting data from %s" % BASE_URL)
+ except:
+ elog.die("unspecific problem requesting data from %s" % BASE_URL)
+ req.encoding = "utf8" # maybe not necessary...
+ updated = stock.now()
+
+ dom = xml.dom.minidom.parseString(req.content)
+ events = dom.getElementsByTagName("item")
+ for event in events:
+ title = event.getElementsByTagName("title")[0]
+ ts = getText(title.childNodes)
+ mag_s, evname = ts.split(",", 1)
+ mag = float(mag_s[2:])
+ description = event.getElementsByTagName("description")[0]
+ desc = getText(description.childNodes)
+ date_s, time_s, lat_s, lon_s, depth_s, depth_u, flag = desc.split()
+ unid = event.getElementsByTagName("guid")[0].firstChild.nodeValue
+ etime = stock.str2epoch("%s %s" % (date_s, time_s))
+ jdate = stock.epoch2str(etime, "%Y%j")
+ lat = float(lat_s)
+ lon = float(lon_s)
+ depth = float(depth_s)
+ auth = "%s:%s" % (auth_base, flag)
+
+ mb = ms = ml = mlnull
+ time = status = cdi = place = code = felt = magtype = net = evtype = ""
+ # be sure to convert unicode objects to string objects by calling "str(xxx)",
+ # this prevents datascope from CRASHING
+
+ # use magtype mb for ignorance
+ magtype = "mb"
+
+ gr = stock.grnumber(lat, lon)
+ sr = stock.srnumber(lat, lon)
+ jdate = stock.epoch2str(etime, "%Y%j")
+
+ if verbose:
+ elog.notify("check id %s" % unid)
+
+ kmatch = idmatch.lookup(table="idmatch", record="dbSCRATCH")
+ try:
+ kmatch.putv(("fkey", unid))
+ except Exception as e:
+ elog.die("problem writing key %s to matcher :", (unid, e))
+
+ matcher = kmatch.matches(idmatch, "fkey")
+ rec_list = matcher()
+ new_event = False
+ evid = 0
+ updated_event = False
+ if len(rec_list) > 1:
+ elog.notify("found too many keys for %s, sth strange goes on here" % unid)
+ if len(rec_list) > 0:
+ for rec in rec_list:
+ idmatch.record = rec
+ [ftime, kname, kval] = idmatch.getv("ftime", "keyname", "keyvalue")
+ # print "found key %s %s" % (kname, kval)
+ if kname == "evid":
+ evid = kval
+ if updated > ftime:
+ new_event = False
+ updated_event = True
+ else:
+ updated_event = False
+
+ else:
+ new_event = True
+
+ if new_event:
+ problem = False
+ if verbose:
+ elog.notify("new event %s" % unid)
+ evid = dborigin.nextid("evid")
+ orid = dborigin.nextid("orid")
+ try:
+ orecno = dborigin.addv(
+ ("time", etime),
+ ("lat", lat),
+ ("lon", lon),
+ ("depth", depth),
+ ("evid", evid),
+ ("orid", orid),
+ ("jdate", jdate),
+ ("mb", mb),
+ ("ml", ml),
+ ("ms", ms),
+ ("nass", 0),
+ ("ndef", 0),
+ ("auth", auth),
+ ("grn", gr),
+ ("srn", sr),
+ )
+ except Exception as __:
+ problem = True
+ if verbose:
+ elog.notify(
+ "problem adding origin for event at %s" % stock.strtime(etime)
+ )
+
+ if not problem:
+ try:
+ erecno = dbevent.addv(
+ ("evid", evid),
+ ("prefor", orid),
+ ("evname", zu.string_maxbytes(evname, evname_width)),
+ ("auth", auth),
+ )
+ except Exception as __:
+ if verbose:
+ problem = True
+ elog.notify(
+ "problem adding event for events at %s"
+ % stock.strtime(etime)
+ )
+ if not problem:
+ try:
+ nmrecno = dbnetmag.addv(
+ ("evid", evid),
+ ("orid", orid),
+ ("magnitude", mag),
+ ("magtype", magtype),
+ ("auth", auth),
+ )
+ except Exception as __:
+ if verbose:
+ problem = True
+ elog.notify(
+ "problem adding netmap for event at %s"
+ % stock.strtime(etime)
+ )
+ if not problem:
+ try:
+ idmatch.addv(
+ ("fkey", unid),
+ ("keyname", "evid"),
+ ("keyvalue", evid),
+ ("ftime", updated),
+ )
+ except Exception as __:
+ if verbose:
+ problem = True
+ elog.notify(
+ "problem adding id for event at %s" % stock.strtime(etime)
+ )
+ elif updated_event:
+ if verbose:
+ elog.notify("eventually updated event %s" % unid)
+ idmatch.putv(("ftime", updated))
+ kmatch = db.lookup(table="event", record="dbSCRATCH")
+ kmatch.putv(("evid", evid))
+ evmatcher = kmatch.matches(dbevent, "evid")
+ evlist = evmatcher()
+ if len(evlist) > 1:
+ elog.notify("strange, found a few matching events for evid %d " % evid)
+ if len(evlist) > 0:
+ dbevent.record = evlist[0]
+ [prefor] = dbevent.getv("prefor")
+
+ kmatch = db.lookup(table="origin", record="dbSCRATCH")
+ kmatch.putv(("orid", prefor))
+ ormatcher = kmatch.matches(dborigin, "orid")
+ orlist = ormatcher()
+ if len(orlist) > 1:
+ elog.notify("strange, found a few origins for orid %d" % prefor)
+ if len(orlist) > 0:
+ dborigin.record = orlist[0]
+ dborigin.putv(
+ ("time", etime),
+ ("lat", lat),
+ ("lon", lon),
+ ("depth", depth),
+ ("jdate", jdate),
+ )
+ if magtype.lower() == "ml":
+ dborigin.putv(("ml", mag))
+ elif magtype.lower() == "mb":
+ dborigin.putv(("mb", mag))
+ elif magtype.lower() == "ms":
+ dborigin.putv(("ms", mag))
+ kmatch = db.lookup(table="netmag", record="dbSCRATCH")
+ kmatch.putv(("orid", prefor))
+ magmatcher = kmatch.matches(dbnetmag, "orid")
+ maglist = magmatcher()
+ if len(maglist) > 1:
+ elog.notify(
+ "strange, found a few netmags for origin %d" % prefor
+ )
+ if len(maglist) > 0:
+ dbnetmag.record = maglist[0]
+ dbnetmag.putv(
+ ("magnitude", mag),
+ ("magtype", magtype),
+ ("auth", auth),
+ )
+
+ return 0
+
+
+if __name__ == "__main__":
+ status = main()
+ sys.exit(status)
diff --git a/bin/import/usgs2db/pdetxt2db.xpy b/bin/import/usgs2db/pdetxt2db.xpy
deleted file mode 100755
index fdcc6f00c..000000000
--- a/bin/import/usgs2db/pdetxt2db.xpy
+++ /dev/null
@@ -1,122 +0,0 @@
-'''
-@author Nikolaus Horn
-@created 2014-06-18
-@modified 2014-06-18
-@version 1.0
-@license MIT-style license
-'''
-
-
-# Import Antelope modules
-
-import antelope.datascope as ds
-import antelope.stock as stock
-import getopt
-import codecs
-import urllib2
-import json
-import pprint
-
-def usage():
- print sys.argv[0], "[-v] [-a auth] [-u url] dbname from to"
-
-def main():
- BASE_URL="http://service.iris.edu/fdsnws/event/1/query?orderby=time&format=text&nodata=404"
- verbose=0
- archive=0
- opts = []
- args = []
- auth=''
- try:
- opts, args = getopt.getopt(sys.argv[1:], 'a:u:v', '')
- except getopt.GetoptError:
- print "illegal option"
- usage()
- sys.exit(2)
-
- for o,a in opts:
- if o == '-v':
- verbose = 1
- elif o == '-a':
- auth = a
- elif o == '-u':
- BASE_URL = a
-
- if len(args) > 3 or len(args) < 3:
- usage()
- sys.exit(1)
-
- if len(args) == 3:
- dbname=args[0]
- t_from=str(args[1])
- t_to=str(args[2])
-
- t1 = stock.str2epoch(t_from)
- t2 = stock.str2epoch(t_to)
- if t2 < t1:
- t2=t1+t2
- ts1=stock.epoch2str(t1,'%Y-%m-%dT%H:%M:%S')
- ts2=stock.epoch2str(t2,'%Y-%m-%dT%H:%M:%S')
- if t1 >= t2:
- print "endtime MUST be AFTER starttime : %s >= %s" % (ts1,ts2)
-
- db= ds.dbopen( dbname, "r+" )
- dborigin=db.lookup(table='origin')
- dbevent=db.lookup(table='event')
- dbnetmag=db.lookup(table='netmag')
-
- dbq=db.lookup(table='origin',field='ml',record='dbNULL')
- [mlnull]=dbq.getv('ml')
- dbq=db.lookup(table='event',field='evname',record='dbNULL')
- evname_width=dbq.query('dbFIELD_SIZE')
-
- #proxies={'http':'http://138.22.156.44:3128'}
- MY_URL="%s&starttime=%s&endtime=%s" % (BASE_URL,ts1,ts2)
- url=urllib2.urlopen(MY_URL)
- data_string=url.read()
- for myline in data_string.splitlines():
-
- if myline[0]=='#':
- continue
-
- [evid,otimestr,lat,lon,depth,oauth,ocat,ocont,ocid,magtype,magnitude,magauth,regname]=myline.split('|')
- evid=int(evid)
- lat=float(lat)
- lon=float(lon)
- depth=float(depth)
- if magnitude != '':
- magnitude=float(magnitude)
- else:
- magnitude=mlnull
- ts=otimestr.replace('T',' ')
- otime=stock.str2epoch(ts)
- magtype=str(magtype).lower()
- if verbose:
- print "evid %d lat %f lon %f :%s: %.1f" % (evid,lat,lon,magtype,magnitude)
-
- mb=ms=ml=mlnull
- if magtype == 'ml':
- ml=magnitude
- if magtype == 'ms':
- ms=magnitude
- if magtype == 'mb':
- mb=magnitude
- gr=stock.grnumber(lat,lon)
- sr=stock.srnumber(lat,lon)
- jdate=stock.epoch2str(otime,'%Y%j')
- if auth != '':
- oauth=auth
- ocat= auth
- orecno=dborigin.addv( ('time',otime),('lat',lat),('lon',lon),('depth',depth),
- ('evid',evid),('orid',evid), ('jdate',jdate),
- ('mb',mb),('ml',ml),('ms',ms),
- ('nass',0),('ndef',0),('auth',ocat),('grn',gr),('srn',sr) )
-
- erecno=dbevent.addv(('evid',evid),('prefor',evid),('evname',regname[:evname_width]),('auth',ocat) )
- nmrecno=dbnetmag.addv(('evid',evid),('orid',evid),('magnitude',magnitude),('magtype',magtype),('auth',magauth) )
-
- return 0
-
-if __name__ == '__main__':
- status = main()
- sys.exit(status)
diff --git a/bin/import/usgs2db/usgs2db.1 b/bin/import/usgs2db/usgs2db.1
index 1594aca60..4a47401e6 100644
--- a/bin/import/usgs2db/usgs2db.1
+++ b/bin/import/usgs2db/usgs2db.1
@@ -1,13 +1,13 @@
.TH USGS2DB 1
.SH NAME
-usgs2db,emsc2db \- utility to retrieve earthquake feeds in GeoJSON format from \fIUSGS\fP or \fIEMSC\fP.
+usgs2db, emsc2db \- utilities to retrieve earthquake feeds in GeoJSON format from \fIUSGS\fP or \fIEMSC\fP.
.SH SYNOPSIS
.nf
-\fBusgs2db\fP [-v] [-a \fIauthor\fP]
+\fBusgs2db\fP [-v] [-h] [-a \fIauthor\fP]
[-k \fIkeydbname\fP] [-u \fIfeed-url\fP] \fIdbname\fP
.fi
.nf
-\fBemsc2db\fP [-v] [-a \fIauthor\fP]
+\fBemsc2db\fP [-v] [-h] [-a \fIauthor\fP]
[-k \fIkeydbname\fP] [-u \fIfeed-url\fP] \fIdbname\fP
.fi
.SH DESCRIPTION
@@ -15,26 +15,39 @@ usgs2db,emsc2db \- utility to retrieve earthquake feeds in GeoJSON format from \
The programs keeps track of event ids in a separate table and updates the output database if new information is available.
.br
.SH OPTIONS
-.IP \-v
+.IP "-v"
verbose flag
-.IP "-k keydname"
-name of database to keep track of origin ids. Since USGS/EMSC IDs are a mixture of strings and integers, a separate table is needed.
+.IP "-k keydbname"
+name of database to keep track of event ids. Since USGS/EMSC IDs are a mixture of strings and integers, a separate table is needed.
The database must be in schema \fBidmatch1.0\fP or higher. The database is created upon startup if not originally existing. The database name defaults to keydb.
-.IP \-u
-URL of the data source. A list of all available feeds can be found on a page of the \fIUSGS\fP
+.IP "-u"
+URL of the data source. A list of all available feeds can be found on a website of the \fIUSGS\fP
\fBhttp://earthquake.usgs.gov/earthquakes/feed/v1.0/geojson.php\fP
If not specified, this defaults to
-\fBhttp://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/2.5_day.geojson\fP
-for \fIEMSC\fP, the program retrieves data from the FDSN webservice described on
+\fBhttp://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_hour.geojson\fP.
+For \fIEMSC\fP, the program retrieves data from the FDSN webservice described on
\fBhttp://www.seismicportal.eu/fdsn-wsevent.html\fP
the default url in this case is
-\fBhttp://www.seismicportal.eu/fdsnws/event/1/query?limit=100&format=json\fP.
+\fBhttp://www.seismicportal.eu/fdsnws/event/1/query?limit=10&format=json\fP.
.IP "-a author"
-Author name for event, origin and netmag table. Defaults to NEIC or EMSC
+Author name for event, origin and netmag table. Defaults to USGS or EMSC.
+.IP "-A"
+When writing event information to an orb as parameter-file packets (\fBO\fP), the parameter \fIarchive_if_not_associated\fP
+influences how these packets are handled. The default to set this parameter to \fIyes\fP. This option
+disables this default to make sure events are only associated to events already existing in the database.
+.IP "-h"
+Show help.
+.IP "-k"
+Databaset to map ids eventuelly containing characters to numerical values only.
+.IP "-B"
+For alerting using \fIorb_quake_alarm\fP, only magnitudes from the origin-table can me used. This option writes all magnitudes, regerdless of the real magnitude type, also to the body-wave magnitude mb.
+Note that thi \fIextra\fP magnitude is written to the origin table alone, a related netmag entry is missing and that there is no magid for this \fIfake\fP body-wave magnitude.
+.IP "-o|O"
+Output orb. This option also selects the output format. For database packets, use \fBo\fP. For parameter-file packets, as e.g. written by USGS2orb, use uppercase \fBO\fP.
.IP database
The name of the output database. This argument is required.
.SH EXAMPLE
-To retrieve all event data for the last month into database usgs:
+To retrieve all event data for the last month into a database named \fBusgs\fP:
.nf
usgs2db -k db/usgs_ids -v -u http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.geojson usgs
.fi
@@ -42,21 +55,21 @@ To update event information every 10 minutes, add the following to your rtexec.p
.nf
# update database USGS every 10 minutes, all events above magnitude 2.5
USGS UTC 0,10,20,30,40,50 * * * * usgs2db -k db/usgs_ids db/usgs
-
+EMSC2DB UTC 5,15,35,35,45,55 * * * * emsc2db -k db/emsc_ids db/emsc
.fi
.SH ENVIRONMENT
-The program uses the Python module \fIurllib2\fP to retrieve data from a webpage.
-This module provides proxy support via environment variables like e.g.: http_proxy = http://myhost:myport.
+The program uses the Python module \fIrequests\fP to retrieve data from a webpage.
+This module supports proxy configuration based on the standard environment variables \fIhttp_proxy\fP and \fIhttps_proxy\fP.
If you need more control over proxy settings, feel free to contact the author, Nikolaus.Horn@zamg.ac.at.
.SH "SEE ALSO"
.nf
-pydoc liburl2, antelope_python(3y)
+https://docs.python-requests.org/en/master, USGS2orb(1), antelope_python(3y)
.fi
.SH "BUGS AND CAVEATS"
-The error handling is very basic. I implemented my personal understanding of the data offered. There might be wiser ways to use the save the information in a database.
+The error handling is simple. I implemented my personal understanding of the data offered. There might be wiser ways to use the save the information in a database.
The feeds are subject to the feed life cycle policy as explained on the website of the usgs. See there for more information if a feed stops working.
-This module uses the python modules urllib2 and json with all their bugs. And of course I added many more problems...
+This module uses the python modules requests with all its bugs and limitations. And of course I added many more problems...
.SH AUTHOR
-Nikolaus Horn (nikolaus.horn@zamg.ac.at)
+Nikolaus Horn (nikolaus.horn@geosphere.at)
diff --git a/bin/import/usgs2db/usgs2db.xpy b/bin/import/usgs2db/usgs2db.xpy
deleted file mode 100755
index 29974422f..000000000
--- a/bin/import/usgs2db/usgs2db.xpy
+++ /dev/null
@@ -1,272 +0,0 @@
-"""
-@author Nikolaus Horn
-@created 2013-11-25
-@modified 2014-02-15
-@version 1.0
-@license MIT-style license
-"""
-
-
-import requests
-import urllib.request, urllib.error, urllib.parse
-import json
-import pprint
-
-# Import Antelope modules
-
-import antelope.datascope as ds
-import antelope.stock as stock
-import getopt
-
-
-def usage():
- print(sys.argv[0], "[-v] [-a auth] [-k keydb] [-u url] dbname")
-
-def main():
- # BASE_URL="http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/2.5_day.geojson"
- BASE_URL = (
- "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/2.5_week.geojson"
- )
- verbose = 0
- archive = 0
- opts = []
- args = []
- keydbname = "keydb"
- keyschema = "idmatch1.0"
- auth = "NEIC"
- use_curl = False
- try:
- opts, args = getopt.getopt(sys.argv[1:], "a:ck:u:v", "")
- except getopt.GetoptError:
- print("illegal option")
- usage()
- sys.exit(2)
-
- for o, a in opts:
- if o == "-v":
- verbose = 1
- elif o == "-a":
- auth = a
- elif o == "-c":
- use_curl = True
- elif o == "-u":
- BASE_URL = a
- elif o == "-k":
- keydbname = a
-
- if len(args) > 1 or len(args) < 1:
- usage()
- sys.exit(1)
-
- if len(args) > 0:
- dbname = args[0]
-
- db = ds.dbopen(dbname, "r+")
- dborigin = db.lookup(table="origin")
- dbevent = db.lookup(table="event")
- dbnetmag = db.lookup(table="netmag")
-
- dbq = db.lookup(table="origin", field="ml", record="dbNULL")
- [mlnull] = dbq.getv("ml")
- dbq = db.lookup(table="event", field="evname", record="dbNULL")
- evname_width = dbq.query("dbFIELD_SIZE")
-
- kdb = ds.dbopen(keydbname, "r+")
- descname = kdb.query("dbDATABASE_FILENAME")
- if os.path.exists(descname):
- schemaname = kdb.query("dbSCHEMA_NAME")
- if schemaname != keyschema:
- elog.die(
- "keydb %s has wrong schema %s, should be %s"
- % (keydbname, schemaname, keyschema)
- )
- sys.exit(1)
- else:
- kdb.close()
- ds.dbcreate(keydbname, keyschema)
-
- kdb = ds.dbopen(keydbname, "r+")
- try:
- idmatch = kdb.lookup(table="idmatch")
- except Exception as e:
- elog.die("Error :", e)
-
- req = request.get(BASE_URL, timeout=30)
- gj_string = url.read()
- obj = req.json()
- data = obj["features"]
- i = len(data)
- for index in range(i):
- fdata = data[index]
- geom_type = fdata["type"]
- geometry = fdata["geometry"]
- coordinates = geometry["coordinates"]
- lon = coordinates[0]
- lat = coordinates[1]
- depth = coordinates[2]
- properties = fdata["properties"]
- mb = ms = ml = mlnull
- time = status = cdi = place = code = felt = mag = magtype = net = evtype = ""
- ml = mb = ms = mlnull
- # be sure to convert unicode objects to string objects by calling "str(xxx)",
- # this prevents datascope from CRASHING
- for propk, propv in properties.items():
- if propk == 'time':
- etime=float(propv) / 1000.
- elif propk == 'mag':
- mag=float(propv)
- elif propk == 'magType':
- magtype=str(propv)
- elif propk == 'place':
- evname=str(propv)
- elif propk == 'cdi':
- if propv is not None:
- cdi = float(propv)
- inull = float(propv)
- elif propk == "felt":
- felt = propv
- elif propk == "net":
- net = str(propv)
- elif propk == "code":
- code = str(propv)
- elif propk == "updated":
- updated = propv / 1000.0
- elif propk == "place":
- place = str(propv)
-
- if magtype.lower() == "ml":
- ml = mag
- elif magtype.lower() == "mb":
- mb = mag
- elif magtype.lower() == "ms":
- ms = mag
- # grn, srn seems to be unimplemenmted
- gr = stock.grnumber(lat, lon)
- sr = stock.srnumber(lat, lon)
- jdate = stock.epoch2str(etime, "%Y%j")
-
- fkey = str("%s%s" % (net, code))
-
- kmatch = idmatch.lookup(table="idmatch", record="dbSCRATCH")
- try:
- kmatch.putv(('fkey', fkey))
- except Exception as e:
- print("Error :",e)
-
- matcher=kmatch.matches(idmatch,'fkey')
- rec_list=matcher()
- new_event=False
- evid=0
- updated_event=False
- if len(rec_list) > 1:
- print("found too many keys, sth strange goes on here")
- if len(rec_list) > 0:
- for rec in rec_list:
- idmatch.record = rec
- [ftime, kname, kval] = idmatch.getv("ftime", "keyname", "keyvalue")
- # print "found key %s %s" % (kname, kval)
- if kname == "evid":
- evid = kval
- if updated > ftime:
- new_event = False
- updated_event = True
- else:
- updated_event = False
-
- else:
- new_event = True
-
- if new_event:
- if verbose:
- print("new event %s" % code)
- evid = dborigin.nextid("evid")
- orid = dborigin.nextid("orid")
- orecno = dborigin.addv(
- ("time", etime),
- ("lat", lat),
- ("lon", lon),
- ("depth", depth),
- ("evid", evid),
- ("orid", orid),
- ("jdate", jdate),
- ("mb", mb),
- ("ml", ml),
- ("ms", ms),
- ("nass", 0),
- ("ndef", 0),
- ("auth", auth),
- ("grn", gr),
- ("srn", sr),
- )
- erecno = dbevent.addv(
- ("evid", evid),
- ("prefor", orid),
- ("evname", evname[:evname_width]),
- ("auth", auth),
- )
- nmrecno = dbnetmag.addv(
- ("evid", evid),
- ("orid", orid),
- ("magnitude", mag),
- ("magtype", magtype),
- ("auth", auth),
- )
- idmatch.addv(
- ("fkey", fkey),
- ("keyname", "evid"),
- ("keyvalue", evid),
- ("ftime", updated),
- )
- elif updated_event:
- if verbose:
- print("updated event %s" % code)
- idmatch.putv(("ftime", updated))
- kmatch = db.lookup(table="event", record="dbSCRATCH")
- kmatch.putv(("evid", evid))
- evmatcher = kmatch.matches(dbevent, "evid")
- evlist = evmatcher()
- if len(evlist) > 1:
- print("strange, found a few matching events for evid %d " % evid)
- if len(evlist) > 0:
- dbevent.record = evlist[0]
- [prefor] = dbevent.getv("prefor")
-
- kmatch = db.lookup(table="origin", record="dbSCRATCH")
- kmatch.putv(("orid", prefor))
- ormatcher = kmatch.matches(dborigin, "orid")
- orlist = ormatcher()
- if len(orlist) > 1:
- print("strange, found a few origind for orid %d" % prefor)
- if len(orlist) > 0:
- dborigin.record = orlist[0]
- dborigin.putv(
- ("time", etime),
- ("lat", lat),
- ("lon", lon),
- ("depth", depth),
- ("jdate", jdate),
- )
- if magtype.lower() == "ml":
- dborigin.putv(("ml", mag))
- elif magtype.lower() == "mb":
- dborigin.putv(("mb", mag))
- elif magtype.lower() == "ms":
- dborigin.putv(("ms", mag))
- kmatch = db.lookup(table="netmag", record="dbSCRATCH")
- kmatch.putv(("orid", prefor))
- magmatcher = kmatch.matches(dbnetmag, "orid")
- maglist = magmatcher()
- if len(maglist) > 1:
- print("strange, found a few netmags for origin %d" % prefor)
- if len(maglist) > 0:
- dbnetmag.record = maglist[0]
- dbnetmag.putv(
- ("magnitude", mag), ("magtype", magtype), ("auth", auth)
- )
-
- return 0
-
-
-if __name__ == "__main__":
- status = main()
- sys.exit(status)
diff --git a/bin/import/usgs2db/usgs2db.xpy b/bin/import/usgs2db/usgs2db.xpy
new file mode 120000
index 000000000..962bf17fd
--- /dev/null
+++ b/bin/import/usgs2db/usgs2db.xpy
@@ -0,0 +1 @@
+emsc2db.xpy
\ No newline at end of file
diff --git a/bin/magnitude/evprocampmag/Mampmag.3p b/bin/magnitude/evprocampmag/Mampmag.3p
new file mode 100644
index 000000000..cd466d1d6
--- /dev/null
+++ b/bin/magnitude/evprocampmag/Mampmag.3p
@@ -0,0 +1,235 @@
+.SH NAME
+Mampmag \- magnitude from velocity amplitudes, as per NMSOP, computational class for evproc generalized event processing
+.SH SYNOPSIS
+.nf
+use Mampmag ;
+
+($obj,$hashref) = new($class,"db" => $dbref,
+ "dbm" => $dbmref[,$name1,$val1[,...]]) ;
+
+display($obj[,@keys]) ;
+
+put($obj,$name1,$val1[,...]) ;
+
+@vals = get($obj,@keys) ;
+
+$hashref = getwftimes($obj) ;
+
+$hashref = process_channel($obj,$trref,$flush) ;
+
+$hashref = process_station($obj,$sta,$flush) ;
+
+$hashref = process_network($obj,$flush) ;
+
+.fi
+.SH DESCRIPTION
+This provides a perl computational class for computing
+magnitudes from velocity amplitudes, for use in \fBorbevproc(1)\fP
+and \fBdbevproc(1)\fP generalized event processing programs. The methodology
+comes from the United States National Earthquake Information Center
+through a document at ftp://hazards.cr.usgs.gov/MagnitudeWG/summary_of_WG_recommendations.pdf
+and a set of distance and depth correction factors.
+The correction tables came from a web site at
+http://jclahr.com/science/software/magnitude/mb/index.html operated by John Lahr, USGS, retired.
+If there is a more up to date and authoritative source for this we would be happy to
+update the \fBMbusneic\fP perl computational module.
+.LP
+\fBnew\fP is the constructor method and does the basic setup of the internal
+perl structures for magnitude processing. The \fBMbusneic::new\fP method
+is completely inherited unmodified from the \fBMagnitude::new\fP method (see \fBMagnitude(3p)\fP).
+.LP
+\fBdisplay\fP, \fBput\fP and \fBget\fP are also inherited unmodified
+from the \fBMagnitude\fP super class.
+.LP
+\fBgetwftimes\fP is called by \fBorb/dbevproc\fP immediately after an object
+is created and this method must setup the waveform processing for the particular event.
+Setting up the waveform processing consists of 1) parsing the
+input parameters from those passed in by \fBorb/dbevproc\fP from the \fBorbevproc.pf\fP
+and \fBdbevproc.pf\fP parameter files when the processing object was created, using \fBevproc::setup_processes\fP
+(see \fBevproc(3p)\fP),
+2) skipping \fIorigin\fPs with the wrong \fIauthor\fP codes,
+3) going through the \fIassoc\fP table
+to find the stations that are associated with the event and their corresponding distances
+to the event, 4) computing noise and signal time windows based upon predicted P arrival
+times and user input parameters and 4) creating and filling in
+a perl hash with all of the results. The disposition and output perl hash are returned
+to \fBorb/dbevproc\fP using the \fBevproc::makereturn\fP function.
+.LP
+\fBMbusneic::process_channel\fP first calls \fBMagnitude::process_channel\fP to get
+the waveform statistics. The internally cached statistic values are then used as input for computing
+the particular station-channel body wave magnitude which is also cached for subsequent processing.
+.LP
+\fBMbusneic::process_station\fP is completely inherited unmodified from \fBMagnitude::process_station\fP.
+.LP
+\fBMbusneic::process_network\fP first calls \fBMagnitude::process_network\fP to compute
+and output the network magnitude and magnitude processing results. It then deposits the
+body wave magnitude into its appropriate field in the output \fIorigin\fP table row.
+.SH "PARAMETER FILE"
+The parameter file object used by the \fBMbusneic\fP class must be specified in the original \fBorbevproc.pf\fP
+or \fBdbeveproc.pf\fP parameter files as associative arrays that are indexed through the entries in
+the \fIevent_processes\fP table (see \fBorbevproc(1)\fP). An example parameter file associative array
+for \fBMbusneic\fP follows.
+.in 2c
+.ft CW
+.nf
+
+.ne 23
+
+# This is a parameter template for Ml computation using the ampmag module
+
+mlampmag_params &Arr{
+ channels &Tbl{
+# snet_expr chan_expr noise_twin signal_twin snr_thresh clip_upper
+# sta_expr filter noise_toffset signal_toffset clip_lower
+ .* .* SHZ auto 30.0 10.0 20.0 10.0 3.0 -65000.0 +65000.0
+ .* .* BHZ_00 auto 30.0 10.0 20.0 10.0 3.0
+ }
+ reject &Tbl{
+# snet_expr sta_expr
+ IU RAR
+ }
+ update_time 10.0
+ maximum_wait_time 300.0
+ maximum_bad_fraction 0.2
+ auth_accept oa_.|oa_. dbg
+ station_number_minimum 5
+ station_percentage_minimum 90.0
+ uncertainty_maximum 0.5
+ output_magtype mb
+ output_auth orbevproc
+ output_stamag yes
+}
+
+.fi
+.ft P
+.in
+.LP
+The recipe of stations and channels to be used to compute magnitude are given
+in the \fIchannels\fP table. Each entry in the table must consist of at least 9 white space separated
+fields:
+.RS 0.5i
+.IP \fIsnet_expr\fP
+This is a regular expression that is matched against the station SEED net code, as obtained
+from the temporaray database \fIsnetsta\fP table. If it matches, then the corresponding station is used.
+This provides a convenient way to sift out stations for processing by network.
+.IP \fIsta_expr\fP
+This is a regular expression that is matched against the CSS station code, as obtained
+from the temporaray database \fIassoc\fP table. If it matches, then the station is used.
+.IP \fIchan_expr\fP
+This is a regular expression that is matched against the CSS channel codes for a particular station, as obtained
+from the metadatabase \fIsitechan\fP table. All channels that match are used in the magnitude computation.
+Traditionally, for body wave magnitude, only the vertical channel should be used and, if more
+than one channel matches for a particular station, the one that produces the
+highest magnitude is used as the station magnitude.
+.IP \fIfilter\fP
+This should be either \fB"auto"\fP, or \fB"autosp"\fP, or a legitimate filter string
+as defined by the various dynamic filter libraries that are in use (see \fBwffil(3)\fP).
+Because filter strings can have embedded white spaces and the parsing done by \fBevproc::setup_processes\fP
+is primitive, normally embedded white spaces in the filter string should be replaced with the \fB_\fP
+(underscore) character which are replaced with white spaces again automatically before being used.
+The \fB"auto"\fP key word means that the filter should be determined automatically based upon the
+\fIsegtype\fP field in the metadatabase \fIcalibration\fP table and assuming the sensor is broadband.
+Note that the input measurement used in this computational module should be in micrometers/sec of ground velocity.
+The autofilter for a broadband velocity sensor would be \fB"BW 0.5 5 5.0 5;G 0.001"\fP (A
+Butterworth bandpass from 0.5 to 5.0 hz followed by a gain
+of 0.001 to produce ground velocity in micrometers/sec).
+The \fB"autosp"\fP key word means the same as the \fB"auto"\fP key word except that it is
+assumed the sensor is a short period narrowband sensor. In this case only integrations
+are performed, once again according to the metadatabase \fIcalibration.segtype\fP value, and
+a gain is applied to convert to micrometer/second of ground velocity.
+Note that the filter must produce equivalent micrometer/second of ground velocity as output,
+so it is the duty of the user to see that this happens if not using the auto key words. The \fIcalib\fP
+value is always used from the \fItrace\fP table input to \fBMbusneic::process_channel\fP as a means
+to convert the counts to physical ground units before applying the filter.
+.IP \fInoise_twin\fP
+This should be either \fB"tproc"\fP, or a noise time window value in seconds for computing the filtered
+noise value. A noise value is computed from the filtered trace data as 1.414 times the standard deviation
+within the noise time window. The noise time window is \fInoise_twin\fP seconds long or equal to the signal
+processing time winodw if the \fB"tproc"\fP key word is used.
+.IP \fInoise_toffset\fP
+This is the number of seconds before the predicted first P arrival that will anchor the end of the
+noise time window.
+.IP \fIsignal_twin\fP
+This is the time duration in seconds for searching for the body wave magnitude signal.
+.IP \fIsignal_toffset\fP
+This is the number of seconds before the predicted first P arrival that will anchor the beginning of the
+signal search time window.
+.IP \fIsnr_thresh\fP
+This is a signal to noise ratio minimum threshold for excluding magnitude values for signals that are close
+to the noise level. If the filtered maximum body wave signal value divided by the noise value is less than
+this threshold, then the magnitude value for this channel is not used.
+.IP \fIclip_lower\fP
+This is a lower clip limit in raw counts. If any data points in the signal or noise windows range below
+this value, then the data is clipped and the station will not be used for computing magnitude.
+If no clip checking is required, then this value, along with \fIclip_upper\fP, can be omitted.
+.IP \fIclip_upper\fP
+This is a upper clip limit in raw counts. If any data points in the signal or noise windows range above
+this value, then the data is clipped and the station will not be used for computing magnitude.
+If no clip checking is required, then this value, along with \fIclip_lower\fP, can be omitted.
+.RE
+.LP
+When determining which channels to process, each line in the \fIchannels\fP table is compared against
+the SEED net code and the CSS sta and chan codes. The first line that matches defines the parameters
+for that channel. Stations that match in the \fIchannels\fP table can be rejected if they match against
+any of the lines in the \fIreject\fP table. The other parameters are as follows:
+.IP \fIupdate_time\fP
+This is a time duration in seconds (\fB0.0\fP to disable) that is passed back to \fBorbevproc\fP to
+instruct it to call \fBMbusneic::process_channel\fP every \fIupdate_time\fP seconds even if the
+particular channel is not filled.
+.IP \fImaximum_wait_time\fP
+This is a time duration in seconds (\fB0.0\fP to disable) that is passed back to \fBorbevproc\fP to
+instruct it to wait no longer than \fImaximum_wait_time\fP seconds after the end of the signal time window before
+closing out the event processing by setting the \fI$flush\fP argument in \fBprocess_channel\fP, \fBprocess_station\fP
+and \fBprocess_network\fP. Any \fBMbusneic\fP objects will stop processing, produce partial results if
+possible and expect to be destroyed by \fBorbevproc\fP.
+.IP \fImaximum_bad_fraction\fP
+This is a fractional value of tolerable missing, or bad, data sample values that will allow the production of
+results even when there are missing sample values and \fBorb/dbevproc\fP is telling the processing methods to
+flush their results. The \fBMbusneic\fP processing opjects will attempt to compute magnitude values as
+long as the missing sample values in the signal search windows are less than this fraction.
+.IP \fIauth_accept\fP
+this is a regular expression that is matched against the input \fIorigin.author\fP fields to
+determine which events to process.
+.IP \fIstation_number_minimum\fP
+This is the minimum number of stations with magnitude values that pass the other screening tests (distance, SNR)
+that will constitute a valid network magnitude. If this parameter is not specified or if it is set
+to \fB0\fP, then any number of stations greater than \fB0\fP will result in a valid network magnitude.
+.IP \fIstation_percentage_minimum\fP
+This is the similar to \fIstation_number_minimum\fP except it is expressed as a percentage of all associated stations
+used to compute magnitude.
+If this parameter is not specified or if it is set
+to \fB0\fP, then any percentage of stations greater than \fB0\fP will result in a valid network magnitude.
+.IP \fIuncertainty_maximum\fP
+This is the maximum allowed magnitude uncertainty across all stations used to compute a network magnitude.
+If the magnitude uncertainty is greater than this value, then no network magnitude will be output.
+If this parameter is not specified,
+then any uncertainty will result in a valid network magnitude.
+.IP \fIoutput_magtype\fP
+This is a string that specifies the body wave magnitude type that will be put in the output \fInetmag.magtype\fP
+and \fIstamag.magtype\fP fields. For body wave magnitude this is normally \fB"mb"\fP.
+.IP \fIoutput_author\fP
+This is a string that specifies the author that will be put in the output \fInetmag.auth\fP
+and \fIstamag.auth\fP fields. The existing \fIorigin.auth\fP field is appended with a white
+space and the value of \fIoutput_magtype\fP. Also the network magnitude result is put
+into the \fIorigin.mb\fP field.
+.IP \fIoutput_stamag\fP
+If this is set to \fB"yes"\fP, then output \fIstamag\fP entries are made for each of the
+stations that contributed to the network magnitude.
+.SH LIBRARY
+use lib $ENV{ANTELOPE}/data/evproc ;
+.SH "SEE ALSO"
+.nf
+orbevproc(1), evproc(3p), Magnitude(3p)
+.fi
+.SH "BUGS AND CAVEATS"
+We encourage the users to inspect all of the source code, written as perl modules,
+that is used to compute the magnitudes using \fBorbevproc(1)\fP and \fBdbevproc(1)\fP.
+These can be found in $ANTELOPE/data/evproc. All of the details of how the magnitudes are
+computed can be seen in the perl module source code files. If you want to change anything,
+please feel free to do so. However, please do not change any of these modules directly as they
+are supplied in the distribution. Instead, copy the modules, give them new names and
+change your own copies as you wish.
+.SH AUTHOR
+Danny Harvey
+.br
+Boulder Real Time Technologies, Inc.
diff --git a/bin/magnitude/evprocampmag/mampmag.pf b/bin/magnitude/evprocampmag/mampmag.pf
new file mode 100644
index 000000000..f8d3b46e5
--- /dev/null
+++ b/bin/magnitude/evprocampmag/mampmag.pf
@@ -0,0 +1,270 @@
+# This is the orbevproc parameter file
+
+max_events_to_thread 8 # maximum number of events to process concurrently
+
+# This is the list of processing modules to be run
+
+event_processes &Tbl{
+ #perl_file perl_class parameters
+ Magnitude.pm
+# Mlrichter.pm Mlrichter mlrichter_params
+# Mbusneic.pm Mbusneic mbusneic_params
+# Msusneic.pm Msusneic msusneic_params
+# MwpA.pm MwpA mwpa_params
+ Mampmag.pm Mampmag mlampmag_params
+ Mnoop.pm Mampmag mbampmag_params
+ Mnoop.pm Mampmag msampmag_params
+}
+
+# These are parameter templates for each of the processing modules
+
+mlampmag_params &Arr{
+ filter BW 1.0 5 10.0 5
+ time0 S # center of measuring time window
+ # P - pphasetime (see man pphasetime)
+ # S - sphasetime
+ # R - rayleigh wave - here we use deg2km(delta) / v_r
+ time_window_factor 1.0 # time window in relation to S-time -P-time
+ minimum_time_window 10.0 #time_window in seconds, in case P and S are really close
+ min_delta 0
+ max_delta 5.5
+
+ c0 -0.304
+ c1 1.66
+ channels &Tbl{
+# snet sta chan snr twin c2 c3 c4 c5
+# expr expr expr thr noise
+ OE ABNA HH[NE] 2.0 60.0 0.0 1.0 1.0 -0.7
+ OE .* HH[NE] 2.0 60.0 0.0 1.0 1.0 0.0
+ SI .* HH[NE] 2.0 60.0 0.0 1.0 1.0 0.0
+# CZ .* HH[NE] 2.0 60.0 0.0 1.0 1.0 0.0
+# GR .* BH[NE] 2.0 60.0 0.0 1.0 1.0 0.0
+ }
+ reject &Tbl{
+# snet_expr sta_expr
+ TA ADK
+ OE ARSA|VIE|UNNA|GFSA|GNLA|GAKA|GPRA|SINA
+ }
+
+ v_r 4.0 # velocity for surface waves used to determine surface wave arrival time
+ # only used when computing Ms, i.e. when time0 is set to R
+
+ update_time 10.0
+ maximum_wait_time 300.0
+ maximum_bad_fraction 0.2
+ auth_accept .*
+ output_magtype ml
+ mean_magnitude no
+ use_p2p_amplitude yes
+ output_auth am
+ output_stamag yes
+ output_wfmeas yes
+}
+mbampmag_params &Arr{
+ filter BW 0.6 3 3.0 3
+ time0 P # center of measuring time window
+ # P - pphasetime (see man pphasetime)
+ # S - sphasetime
+ # R - rayleigh wave - here we use deg2km(delta) / v_r
+ minimum_time_window 1.0 #time_window in seconds, in case P and S are really close
+ time_window_factor 0.5 # time window in relation to S-time -P-time
+ min_delta 0
+ max_delta 180
+
+ c0 -0.104
+ c1 1.66
+ channels &Tbl{
+# snet sta chan snr twin c2 c3 c4 c5
+# expr expr expr thr noise
+ XX .* HH[NE].* 2.0 60.0 0.0 1.0 1.0 0.0 -65000 65000
+ OE .* HH[NE] 2.0 60.0 0.0 1.0 1.0 0.0
+ SI .* HH[NE] 2.0 60.0 0.0 1.0 1.0 0.0
+# CZ .* HH[NE] 2.0 60.0 0.0 1.0 1.0 0.0
+# GR .* BH[NE] 2.0 60.0 0.0 1.0 1.0 0.0
+ }
+ reject &Tbl{
+# snet_expr sta_expr
+ TA ADK
+ OE ARSA|VIE|UNNA|GFSA|GNLA|GAKA|GPRA
+ }
+
+ v_r 4.0 # velocity for surface waves used to determine surface wave arrival time
+ # only used when computing Ms, i.e. when time0 is set to R
+
+ update_time 10.0
+ maximum_wait_time 300.0
+ maximum_bad_fraction 0.2
+ auth_accept .*
+ output_magtype mb
+ mean_magnitude no
+ use_p2p_amplitude yes
+ output_auth am
+ output_stamag yes
+ output_wfmeas yes
+}
+msampmag_params &Arr{
+ filter BW 0.01 5 0 0
+ time0 R # center of measuring time window
+ # P - pphasetime (see man pphasetime)
+ # S - sphasetime
+ # R - rayleigh wave - here we use deg2km(delta) / v_r
+ time_window_factor 1.5 # time window in relation to S-time -P-time
+ minimum_time_window 10.0 # time_window in seconds, in case P and S are really close
+ min_delta 5.5
+ max_delta 180
+
+ c0 0.52
+ c1 1.66
+ channels &Tbl{
+# snet sta chan snr twin c2 c3 c4 c5
+# expr expr expr thr noise
+ XX .* HH[NE].* 2.0 60.0 -1.0 0.0097 9.0 0.0 -65000 65000
+ OE .* HH[NE] 2.0 60.0 -1.0 0.0097 9.0 0.0
+ SI .* HH[NE] 2.0 60.0 -1.0 0.0097 9.0 0.0
+# CZ .* HH[NE] 2.0 60.0 -1.0 0.0097 9.0 0.0
+# GR .* BH[NE] 2.0 60.0 -1.0 0.0097 9.0 0.0
+ }
+ reject &Tbl{
+# snet_expr sta_expr
+ TA ADK
+ OE ARSA|VIE|UNNA|GFSA|GNLA|GAKA|GPRA
+ }
+
+ v_r 4.0 # velocity for surface waves used to determine surface wave arrival time
+ # only used when computing Ms, i.e. when time0 is set to R
+
+ update_time 10.0
+ maximum_wait_time 300.0
+ maximum_bad_fraction 0.2
+ auth_accept .*
+ output_magtype ms
+ mean_magnitude no
+ use_p2p_amplitude yes
+ output_auth am
+ output_stamag yes
+ output_wfmeas yes
+}
+
+
+
+
+mlrichter_params &Arr{
+ channels &Tbl{
+# snet_expr chan_expr noise_twin signal_twin snr_thresh
+# sta_expr filter noise_toffset signal_toffset
+ .* .._ARSA HH[12NE] auto tproc 10.0 f2.0 10.0 3.0
+ .* .._DAVA HH[12NE] auto tproc 10.0 f2.0 10.0 3.0
+ .* .._TRO BH[12NE] auto tproc 10.0 f2.0 10.0 3.0
+ .* .._PFO BH[12NE] auto tproc 10.0 f2.0 10.0 3.0
+ .* .._TIN BH[12NE] auto tproc 10.0 f2.0 10.0 3.0
+ .* .._BZN BH[12NE] auto tproc 10.0 f2.0 10.0 3.0
+ .* .._KNW BH[12NE] auto tproc 10.0 f2.0 10.0 3.0
+ }
+ reject &Tbl{
+# snet_expr sta_expr
+ TA ADK
+ }
+ update_time 10.0
+ maximum_wait_time 300.0
+ maximum_bad_fraction 0.2
+ auth_accept .*
+ output_magtype LM
+ output_auth evproc
+ output_stamag yes
+ output_wfmeas yes
+ station_number_minimum 2
+}
+
+mbusneic_params &Arr{
+ channels &Tbl{
+# snet_expr chan_expr noise_twin signal_twin snr_thresh
+# sta_expr filter noise_toffset signal_toffset
+ .* .* HHZ|HHZ_00 auto 30.0 10.0 70.0 10.0 3.0
+ .* .* BHZ|BHZ_00 auto 30.0 10.0 70.0 10.0 3.0
+
+ }
+ update_time 10.0
+ maximum_wait_time 300.0
+ maximum_bad_fraction 0.2
+ auth_accept .*
+ output_magtype BM
+ output_auth dbevproc
+ output_stamag yes
+ output_wfmeas yes
+}
+msusneic_params &Arr{
+ channels &Tbl{
+# snet_expr chan_expr noise_twin mingvel snr_thresh
+# sta_expr filter noise_toffset maxgvel
+ .* .* BHZ|BHZ_00 auto 600.0 10.0 2.5 4.5 10.0
+ }
+ reject &Tbl{
+# snet_expr sta_expr
+ IM .*
+ }
+ minimum_period 15.0
+ maximum_period 25.0
+ maximum_depth 100.0
+ maximum_distance 90.0
+ update_time 600.0
+ maximum_wait_time 300.0
+ maximum_bad_fraction 0.2
+ auth_accept .*
+ output_magtype SM
+ output_auth orbevproc
+ output_stamag yes
+ output_wfmeas yes
+ station_number_minimum 5
+ uncertainty_maximum 1.0
+}
+mwpa_params &Arr{
+ channels &Tbl{
+# snet_expr chan_expr filter_tpad signal_twin snr_thresh
+# sta_expr filter tpivot_toffset sarrival_toffset
+ .* .* BHZ|BHZ_00 none 30.0 5.0 500.0 0.0 3.0
+ }
+ reject &Tbl{
+# snet_expr sta_expr
+ IM .*
+ }
+ update_time 10.0
+ maximum_wait_time 300.0
+ auth_accept .*
+ output_magtype mwp
+ output_auth orbevproc
+ output_stamag yes
+ output_wfmeas yes
+ station_number_minimum 5
+ uncertainty_maximum 0.8
+ min_duration 5.0
+ snr_max_off_duration 10.0
+}
+
+
+# parameters for "smart"association
+
+assoc_method tttaup # method for computing predicted travel times
+assoc_model iasp91 # velocity model for computing predicted travel times
+assoc_phases basic # phase list for computing predicted travel times (see tt(3))
+assoc_P_thresh 10.0 # P-residual threshold for associations
+assoc_S_thresh 20.0 # S-residual threshold for associations
+assoc_ignoreiphase no # should the arrival row iphase value be ignored?
+assoc_firstphase yes # should only the earliest predicted phase be used?
+
+assoc_screen_new time
+assoc_screen_old (time-3600.0)::(time+3600.0)
+ # these are screening database expressions that should
+ # match the existing (old) origins with the new origin for
+ # association processing
+assoc_expression $nass>=$nars-2
+ # this is a database expression that should evaluate
+ # to true whenever an association is valid
+
+author_priority &Arr{ # prefor priority as a function of assoc author
+}
+
+
+pf_revision_time 1401891290
+
+
+
diff --git a/bin/rt/dbnew2orb/LICENSE b/bin/rt/dbnew2orb/LICENSE
new file mode 100644
index 000000000..8c011b6dc
--- /dev/null
+++ b/bin/rt/dbnew2orb/LICENSE
@@ -0,0 +1,39 @@
+Copyright (c) 2005,2013 Nikolaus Horn
+All rights reserved.
+
+This software is licensed under the New BSD license:
+
+Redistribution and use in source and binary forms,
+with or without modification, are permitted provided
+that the following conditions are met:
+
+* Redistributions of source code must retain the above
+copyright notice, this list of conditions and the
+following disclaimer.
+
+* Redistributions in binary form must reproduce the
+above copyright notice, this list of conditions and
+the following disclaimer in the documentation and/or
+other materials provided with the distribution.
+
+* Neither the name of Nikolaus Horn nor
+the names of its contributors may be used to endorse
+or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
diff --git a/bin/rt/dbnew2orb/dbnew2orb.1 b/bin/rt/dbnew2orb/dbnew2orb.1
index 963ca217e..b628767bf 100644
--- a/bin/rt/dbnew2orb/dbnew2orb.1
+++ b/bin/rt/dbnew2orb/dbnew2orb.1
@@ -10,7 +10,7 @@ dbnew2orb \- send new or updated database rows to an orbserver
.SH DESCRIPTION
\fBdbnew2orb\fP watches a database for modifications and sends modified rows to an orbserver.
It allows to transfer a database so that it can be used on the receiving side with programs
-that keep the database open like e.g. dbevents.
+that keep the database open like e.g. dbevents. The database can be in any database schema.
.SH OPTIONS
.IP "-sleep seconds"
\fIseconds\fP specifies the number of \fIseconds\fP to wait between iterations over all database
@@ -100,6 +100,7 @@ save the demo database on the other side:
.SH "BUGS AND CAVEATS"
The current version of the program transfers external files, i.e. those referenced by the fields dir and dfile \fIdfile\fP.
This could result in large data volume transferred.
+It can happen that orb2orb refuses to transfer database rows whose format is unknown on the instance transferring the data. This can be solved by installing database extensions on the transmitting machine as well, not only on the sending and receiving sides.
Sometimes one might see strange log entries coming from orb2dbt on the receiving side. While this looks
frigthening, it still seems to work fine.
diff --git a/bin/rt/dbnew2orb/dbnew2orb.c b/bin/rt/dbnew2orb/dbnew2orb.c
index cabbb029c..b3cd0f74f 100644
--- a/bin/rt/dbnew2orb/dbnew2orb.c
+++ b/bin/rt/dbnew2orb/dbnew2orb.c
@@ -327,7 +327,7 @@ main(int argc, char **argv)
continue;
}
}
- if (verbose) elog_notify(0,"will check table %s\n",tablename);
+ if (verbose > 1) elog_notify(0,"will check table %s\n",tablename);
pushtbl(tablenames,tablename);
}
}
diff --git a/bin/rt/orb2ringserver/ChangeLog b/bin/rt/orb2ringserver/ChangeLog
index cda6010d0..44a025aa3 100644
--- a/bin/rt/orb2ringserver/ChangeLog
+++ b/bin/rt/orb2ringserver/ChangeLog
@@ -1,3 +1,7 @@
+2023.022: 1.7
+ - Improve deliniation of diagnostic versus error messages
+ - Update libmseed to 2.19.8
+
2020.134: 1.6
- Incorporate changes from Doug Neuhauser, including these features:
# Add -F option to control flushing of data based on channel rate
diff --git a/bin/rt/orb2ringserver/libmseed/.gitignore b/bin/rt/orb2ringserver/libmseed/.gitignore
new file mode 100644
index 000000000..c6127b38c
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/.gitignore
@@ -0,0 +1,52 @@
+# Prerequisites
+*.d
+
+# Object files
+*.o
+*.ko
+*.obj
+*.elf
+
+# Linker output
+*.ilk
+*.map
+*.exp
+
+# Precompiled Headers
+*.gch
+*.pch
+
+# Libraries
+*.lib
+*.a
+*.la
+*.lo
+
+# Shared objects (inc. Windows DLLs)
+*.dll
+*.so
+*.so.*
+*.dylib
+
+# Executables
+*.exe
+*.out
+*.app
+*.i*86
+*.x86_64
+*.hex
+
+# Debug files
+*.dSYM/
+*.su
+*.idb
+*.pdb
+
+# Kernel Module Compile Results
+*.mod*
+*.cmd
+.tmp_versions/
+modules.order
+Module.symvers
+Mkfile.old
+dkms.conf
diff --git a/bin/rt/orb2ringserver/libmseed/ChangeLog b/bin/rt/orb2ringserver/libmseed/ChangeLog
index d06af2979..17508b0bc 100644
--- a/bin/rt/orb2ringserver/libmseed/ChangeLog
+++ b/bin/rt/orb2ringserver/libmseed/ChangeLog
@@ -1,3 +1,16 @@
+2022.087: 2.19.8
+ - Update numsamples and samplecnt consistently in mst_addmsr(), #33 @pn2200
+ - Fix small compiler warnings.
+
+2022.075: 2.19.7
+ - Avoid braceless multiple statements MS_SWAPBTIME macro usage.
+ - Fix statement macros by @QuLogic. #73
+ - Simplification of byte swapping routines by @QuLogic. #74
+ - Avoid string buffer overflow warnings.
+ - Makefile mods for CMake as ExternalProject by Sriram Sundararajan.
+ - Encapsulate value of MS_NSTIME2EPOCH and MS_EPOCH2NSTIME macros.
+ - Fix example mst_pack().
+
2018.240: 2.19.6
- Allow ms_readleapsecondfile() to be called multiple times, by @pn2200
- Fix compiler warning in mst_printsynclist().
diff --git a/bin/rt/orb2ringserver/libmseed/Makefile b/bin/rt/orb2ringserver/libmseed/Makefile
index 2a11fffb2..f68cef15b 100644
--- a/bin/rt/orb2ringserver/libmseed/Makefile
+++ b/bin/rt/orb2ringserver/libmseed/Makefile
@@ -26,54 +26,51 @@ LIB_SRCS = fileutils.c genutils.c gswap.c lmplatform.c lookup.c \
parseutils.c unpack.c unpackdata.c selection.c logging.c
LIB_OBJS = $(LIB_SRCS:.c=.o)
-LIB_DOBJS = $(LIB_SRCS:.c=.lo)
+LIB_LOBJS = $(LIB_SRCS:.c=.lo)
-LIB_A = libmseed.a
-LIB_SO_BASE = libmseed.so
-LIB_SO_NAME = $(LIB_SO_BASE).$(MAJOR_VER)
-LIB_SO = $(LIB_SO_BASE).$(FULL_VER)
-LIB_DYN_NAME = libmseed.dylib
-LIB_DYN = libmseed.$(FULL_VER).dylib
-LIB_FILES = Blarg
+LIB_NAME = libmseed
+LIB_A = $(LIB_NAME).a
-all: static
-
-static: $(LIB_A)
+OS := $(shell uname -s)
# Build dynamic (.dylib) on macOS/Darwin, otherwise shared (.so)
-shared dynamic:
-ifeq ($(shell uname -s),Darwin)
- $(MAKE) $(LIB_DYN)
+ifeq ($(OS), Darwin)
+ LIB_SO_BASE = $(LIB_NAME).dylib
+ LIB_SO_MAJOR = $(LIB_NAME).$(MAJOR_VER).dylib
+ LIB_SO = $(LIB_NAME).$(FULL_VER).dylib
+ LIB_OPTS = -dynamiclib -compatibility_version $(COMPAT_VER) -current_version $(FULL_VER) -install_name $(LIB_SO)
else
- $(MAKE) $(LIB_SO)
+ LIB_SO_BASE = $(LIB_NAME).so
+ LIB_SO_MAJOR = $(LIB_NAME).so.$(MAJOR_VER)
+ LIB_SO = $(LIB_NAME).so.$(FULL_VER)
+ LIB_OPTS = -shared -Wl,--version-script=libmseed.map -Wl,-soname,$(LIB_SO_MAJOR)
endif
+all: static
+
+static: $(LIB_A)
+
+shared dynamic: $(LIB_SO)
+
# Build static library
$(LIB_A): $(LIB_OBJS)
@echo "Building static library $(LIB_A)"
$(RM) -f $(LIB_A)
$(AR) -crs $(LIB_A) $(LIB_OBJS)
-# Build shared library using GCC-style options
-$(LIB_SO): $(LIB_DOBJS)
+# Build shared/dynamic library
+$(LIB_SO): $(LIB_LOBJS)
@echo "Building shared library $(LIB_SO)"
- $(RM) -f $(LIB_SO) $(LIB_SONAME) $(LIB_SO_BASE)
- $(CC) $(CFLAGS) $(LDFLAGS) -shared -Wl,--version-script=libmseed.map -Wl,-soname,$(LIB_SO_NAME) -o $(LIB_SO) $(LIB_DOBJS)
+ $(RM) -f $(LIB_SO) $(LIB_SO_MAJOR) $(LIB_SO_BASE)
+ $(CC) $(CFLAGS) $(LDFLAGS) $(LIB_OPTS) -o $(LIB_SO) $(LIB_LOBJS)
ln -s $(LIB_SO) $(LIB_SO_BASE)
- ln -s $(LIB_SO) $(LIB_SO_NAME)
-
-# Build dynamic library (usually for macOS)
-$(LIB_DYN): $(LIB_DOBJS)
- @echo "Building dynamic library $(LIB_DYN)"
- $(RM) -f $(LIB_DYN) $(LIB_DYN_NAME)
- $(CC) $(CFLAGS) -dynamiclib -compatibility_version $(COMPAT_VER) -current_version $(FULL_VER) -install_name $(LIB_DYN_NAME) -o $(LIB_DYN) $(LIB_DOBJS)
- ln -sf $(LIB_DYN) $(LIB_DYN_NAME)
+ ln -s $(LIB_SO) $(LIB_SO_MAJOR)
test check: static FORCE
@$(MAKE) -C test test
clean:
- @$(RM) -f $(LIB_OBJS) $(LIB_DOBJS) $(LIB_A) $(LIB_SO) $(LIB_SO_NAME) $(LIB_SO_BASE) $(LIB_DYN) $(LIB_DYN_NAME)
+ $(RM) $(LIB_OBJS) $(LIB_LOBJS) $(LIB_A) $(LIB_SO) $(LIB_SO_MAJOR) $(LIB_SO_BASE)
@$(MAKE) -C test clean
@echo "All clean."
@@ -82,12 +79,7 @@ install: shared
@mkdir -p $(DESTDIR)$(PREFIX)/include
@cp libmseed.h $(DESTDIR)$(PREFIX)/include
@mkdir -p $(DESTDIR)$(LIBDIR)/pkgconfig
-ifneq ("$(wildcard $(LIB_SO))","")
- @cp -a $(LIB_SO_BASE) $(LIB_SO_NAME) $(LIB_SO) $(DESTDIR)$(LIBDIR)
-endif
-ifneq ("$(wildcard $(LIB_DYN))","")
- @cp -a $(LIB_DYN_NAME) $(LIB_DYN) $(DESTDIR)$(LIBDIR)
-endif
+ @cp -a $(LIB_SO_BASE) $(LIB_SO_MAJOR) $(LIB_SO_NAME) $(LIB_SO) $(DESTDIR)$(LIBDIR)
@sed -e 's|@prefix@|$(PREFIX)|g' \
-e 's|@exec_prefix@|$(EXEC_PREFIX)|g' \
-e 's|@libdir@|$(LIBDIR)|g' \
@@ -108,7 +100,7 @@ endif
.c.o:
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
-# Standard object building for dynamic library components using -fPIC
+# Standard object building for shared library using -fPIC
.c.lo:
$(CC) $(CPPFLAGS) $(CFLAGS) -fPIC -c $< -o $@
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_addselect.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_addselect.3
deleted file mode 100644
index 625b2cd3b..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_addselect.3
+++ /dev/null
@@ -1,196 +0,0 @@
-.TH MS_SELECTION 3 2012/12/28 "Libmseed API"
-.SH NAME
-ms_selection - Routines to manage and use data selection lists.
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "Selections *\fBms_matchselect\fP ( Selections *" selections ", char *" srcname ","
-.BI " hptime_t " starttime ", hptime_t " endtime ","
-.BI " SelectTime **" ppselecttime " );"
-
-.BI "Selections *\fBmsr_matchselect\fP ( Selections *" selections ", MSRecord *" msr ","
-.BI " SelectTime **" ppselecttime " );"
-
-.BI "int \fBms_addselect\fP ( Selections **" ppselections ", char *" srcname ","
-.BI " hptime_t " starttime ", hptime_t " endtime " );"
-
-.BI "int \fBms_addselect_comp\fP ( Selections **" ppselections ", char *" net ","
-.BI " char *" sta ", char *" loc ", char *" chan ", char *" qual ","
-.BI " hptime_t " starttime ", hptime_t " endtime " );"
-
-.BI "int \fBms_readselectionsfile\fP ( Selections **" ppselections ", char *" filename " );"
-
-.BI "void \fBms_freeselections\fP ( Selections *" selections " );"
-
-.BI "void \fBms_printselections\fP ( Selections *" selections " );"
-.fi
-
-.SH DESCRIPTION
-These routines serve as a convienence facility for creating a list of
-data selections and using it to match data. The selection criteria
-are the \fIsrcname\fP and optional start and end times. The
-\fIsrcname\fP components in a selection may contain globbing
-characters for matching (wildcards, character range, etc.). A
-\fIsrcname\fP is generally composed of network, station, location,
-channel and optional quality components; normally these are created
-with \fBmsr_srcname(3)\fP and \fBmst_srcname(3)\fP.
-
-\fBms_matchselect\fP checks for an entry in the \fPselections\fP list
-that matches the supplied \fIsrcname\fP and optionally \fIstarttime\fP
-and \fIendtime\fP. The start and/or end times can be set to HTPERROR
-to mean "any" time. A selection will match the specified time range
-if there is any overlap in time coverage. If the \fIppselecttime\fP
-pointer is not NULL it will be set to the matching SelectTime entry.
-
-\fBmsr_matchselect\fP is a simple wrapper to call \fBms_matchselect\fP
-using the details from a specified MSRecord.
-
-\fBms_addselect\fP adds a selection entry to the \fIselections\fP list
-based on the \fsrcname\fP and the \fIstarttime\fP and \fIendtime\fP
-boundaries. The source name components may contain globbing
-characters for matching including wildcards and character sets, see
-\fBSRCNAME MATCHING\fP below. Note that the \fIppselections\fP is a
-pointer to a pointer, if the secondary pointer has not been allocated
-(i.e. the list is empty) the first entry will be created and the
-primary pointer updated.
-
-\fBms_addselect_comp\fP is a wrapper of \fBms_addselect\fP used to add
-a selection entry to the \fIselections\fP list. The \fInet\fP,
-\fIsta\fP, \fIloc\fP, \fIchan\fP and \fIqual\fP source name components
-are used to create a \fIsrcname\fP. The name components may contain
-globbing characters for matching including wildcards and character
-sets, see \fBSRCNAME MATCHING\fP below. If a name component is not
-specified a wildard matching all entries will be subsituted,
-i.e. \fInet\fP==NULL will be interpreted to match all network codes.
-As a special case a \fIloc\fP value of "--" will be translated to and
-empty string to match the srcname representation of a blank
-(space-space) location ID.
-
-\fBms_readselectionsfile\fP reads a file containing a list of
-selections and adds them to the specified \fIselections\fP list. As
-with \fBms_addselect\fP if the selections list is empty it will be
-created. For more details see the \fBSELECTION FILE\fR section below.
-
-\fBms_freeselections\fP frees all memory associated with
-\fIselections\fP.
-
-\fBms_printselections\fP prints all of the entries in the
-\fIselections\fP list using the ms_log() facility.
-
-.SH RETURN VALUES
-The \fBms_matchselect\fP and \fBmsr_matchselect\fP routines return a
-pointer to the matching Selections entry on success and NULL when no
-match was found. These routines will also set the \fIppselecttime\fP
-pointer to the matching SelectTime entry if supplied.
-
-\fBms_addselect\fP and \fBms_addselect_comp\fP return 0 on success and
--1 on error.
-
-\fBms_readselectionsfile\fP returns the number of selections added to
-the list or -1 on error.
-
-.SH "SELECTION FILE"
-A selection file is used to match input data records based on network,
-station, location and channel information. Optionally a quality and
-time range may also be specified for more refined selection. The
-non-time fields may use the '*' wildcard to match multiple characters
-and the '?' wildcard to match single characters. Character sets may
-also be used, for example '[ENZ]' will match either E, N or Z.
-The '#' character indicates the remaining portion of the line will be
-ignored.
-
-Example selection file entries (the first four fields are required)
-.nf
-#net sta loc chan qual start end
-IU ANMO * BH?
-II * * * Q
-IU COLA 00 LH[ENZ] R
-IU COLA 00 LHZ * 2008,100,10,00,00 2008,100,10,30,00
-.fi
-
-.SH SRCNAME MATCHING
-Entries in a Selections list include a "source name" (srcname) string
-to represent matching parameters for network, station, location,
-channel and optionally the quality name components. Each name
-component may contain globbing characters to match more than one
-unique srcname.
-
-.nf
-Valid glob patterns include:
- * matches zero or more characters
- ? matches any single character
- [set] matches any character in the set
- [^set] matches any character NOT in the set
- where a set is a group of characters or ranges. a range
- is written as two characters separated with a hyphen:
- a-z denotes all characters between a to z inclusive.
- [-set] set matches a literal hyphen and any character in the set
- []set] matches a literal close bracket and any character in the set
-
- char matches itself except where char is '*' or '?' or '['
- \char matches char, including any pattern character
-
- examples:
- a*c ac abc abbc ...
- a?c acc abc aXc ...
- a[a-z]c aac abc acc ...
- a[-a-z]c a-c aac abc ...
-.fi
-
-.SH EXAMPLE USAGE
-The primary intention of the Selections list facility is to limit data
-to a specific selection as it's read into a program. This is
-illustrated below.
-
-.nf
-main() {
- MSRecord *msr = NULL;
- Selections *selections = NULL;
- hptime_t starttime;
- hptime_t endtime;
- int retcode;
-
- ms_addselect (&selections, "IU_*_*_LH?_?", HPTERROR, HPTERROR);
-
- starttime = timestr2hptime ("2009/1/15 00:00:00.00");
- endtime = timestr2hptime ("2009/1/31 23:59:59.99");
- ms_addselect (&selections, "IU_ANMO_00_LH?_?", starttime, endtime);
-
- while ( (retcode = ms_readmsr (&msr, filename, 0, NULL, NULL, 1, 0, verbose)) == MS_NOERROR )
- {
- /* Print details if data record matches selection criteria */
- if ( msr_matchselect (selections, msr, NULL) )
- {
- msr_print (msr, verbose);
- }
- }
-
- if ( retcode != MS_ENDOFFILE )
- ms_log (2, "Error reading input file %s: %s\\n",
- filename, ms_errorstr(retcode));
-
- /* Cleanup memory and close file */
- ms_readmsr (&msr, NULL, 0, NULL, NULL, 0, 0, verbose);
-} /* End of main() */
-.fi
-
-The following two calls are equivalent:
-.nf
- ms_addselect (&selections, "IU_ANMO_00_LH?_?", starttime, endtime);
- ms_addselect_comp (&selections, "IU", "ANMO", "00", "LH?", "?", startime, endtime);
-.fi
-
-As a further convienence usage of \fBms_readselectionsfile()\fP would
-allow the selections to be specified in a simple ASCII file and avoid
-the need to directly call \fBms_addselect()\fP.
-
-.SH SEE ALSO
-\fBmsr_srcname(3)\fP and \fBmst_srcname(3)\fP.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_addselect.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_addselect.3
new file mode 120000
index 000000000..d545f287c
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_addselect.3
@@ -0,0 +1 @@
+ms_selection.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_addselect_comp.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_addselect_comp.3
deleted file mode 100644
index 625b2cd3b..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_addselect_comp.3
+++ /dev/null
@@ -1,196 +0,0 @@
-.TH MS_SELECTION 3 2012/12/28 "Libmseed API"
-.SH NAME
-ms_selection - Routines to manage and use data selection lists.
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "Selections *\fBms_matchselect\fP ( Selections *" selections ", char *" srcname ","
-.BI " hptime_t " starttime ", hptime_t " endtime ","
-.BI " SelectTime **" ppselecttime " );"
-
-.BI "Selections *\fBmsr_matchselect\fP ( Selections *" selections ", MSRecord *" msr ","
-.BI " SelectTime **" ppselecttime " );"
-
-.BI "int \fBms_addselect\fP ( Selections **" ppselections ", char *" srcname ","
-.BI " hptime_t " starttime ", hptime_t " endtime " );"
-
-.BI "int \fBms_addselect_comp\fP ( Selections **" ppselections ", char *" net ","
-.BI " char *" sta ", char *" loc ", char *" chan ", char *" qual ","
-.BI " hptime_t " starttime ", hptime_t " endtime " );"
-
-.BI "int \fBms_readselectionsfile\fP ( Selections **" ppselections ", char *" filename " );"
-
-.BI "void \fBms_freeselections\fP ( Selections *" selections " );"
-
-.BI "void \fBms_printselections\fP ( Selections *" selections " );"
-.fi
-
-.SH DESCRIPTION
-These routines serve as a convienence facility for creating a list of
-data selections and using it to match data. The selection criteria
-are the \fIsrcname\fP and optional start and end times. The
-\fIsrcname\fP components in a selection may contain globbing
-characters for matching (wildcards, character range, etc.). A
-\fIsrcname\fP is generally composed of network, station, location,
-channel and optional quality components; normally these are created
-with \fBmsr_srcname(3)\fP and \fBmst_srcname(3)\fP.
-
-\fBms_matchselect\fP checks for an entry in the \fPselections\fP list
-that matches the supplied \fIsrcname\fP and optionally \fIstarttime\fP
-and \fIendtime\fP. The start and/or end times can be set to HTPERROR
-to mean "any" time. A selection will match the specified time range
-if there is any overlap in time coverage. If the \fIppselecttime\fP
-pointer is not NULL it will be set to the matching SelectTime entry.
-
-\fBmsr_matchselect\fP is a simple wrapper to call \fBms_matchselect\fP
-using the details from a specified MSRecord.
-
-\fBms_addselect\fP adds a selection entry to the \fIselections\fP list
-based on the \fsrcname\fP and the \fIstarttime\fP and \fIendtime\fP
-boundaries. The source name components may contain globbing
-characters for matching including wildcards and character sets, see
-\fBSRCNAME MATCHING\fP below. Note that the \fIppselections\fP is a
-pointer to a pointer, if the secondary pointer has not been allocated
-(i.e. the list is empty) the first entry will be created and the
-primary pointer updated.
-
-\fBms_addselect_comp\fP is a wrapper of \fBms_addselect\fP used to add
-a selection entry to the \fIselections\fP list. The \fInet\fP,
-\fIsta\fP, \fIloc\fP, \fIchan\fP and \fIqual\fP source name components
-are used to create a \fIsrcname\fP. The name components may contain
-globbing characters for matching including wildcards and character
-sets, see \fBSRCNAME MATCHING\fP below. If a name component is not
-specified a wildard matching all entries will be subsituted,
-i.e. \fInet\fP==NULL will be interpreted to match all network codes.
-As a special case a \fIloc\fP value of "--" will be translated to and
-empty string to match the srcname representation of a blank
-(space-space) location ID.
-
-\fBms_readselectionsfile\fP reads a file containing a list of
-selections and adds them to the specified \fIselections\fP list. As
-with \fBms_addselect\fP if the selections list is empty it will be
-created. For more details see the \fBSELECTION FILE\fR section below.
-
-\fBms_freeselections\fP frees all memory associated with
-\fIselections\fP.
-
-\fBms_printselections\fP prints all of the entries in the
-\fIselections\fP list using the ms_log() facility.
-
-.SH RETURN VALUES
-The \fBms_matchselect\fP and \fBmsr_matchselect\fP routines return a
-pointer to the matching Selections entry on success and NULL when no
-match was found. These routines will also set the \fIppselecttime\fP
-pointer to the matching SelectTime entry if supplied.
-
-\fBms_addselect\fP and \fBms_addselect_comp\fP return 0 on success and
--1 on error.
-
-\fBms_readselectionsfile\fP returns the number of selections added to
-the list or -1 on error.
-
-.SH "SELECTION FILE"
-A selection file is used to match input data records based on network,
-station, location and channel information. Optionally a quality and
-time range may also be specified for more refined selection. The
-non-time fields may use the '*' wildcard to match multiple characters
-and the '?' wildcard to match single characters. Character sets may
-also be used, for example '[ENZ]' will match either E, N or Z.
-The '#' character indicates the remaining portion of the line will be
-ignored.
-
-Example selection file entries (the first four fields are required)
-.nf
-#net sta loc chan qual start end
-IU ANMO * BH?
-II * * * Q
-IU COLA 00 LH[ENZ] R
-IU COLA 00 LHZ * 2008,100,10,00,00 2008,100,10,30,00
-.fi
-
-.SH SRCNAME MATCHING
-Entries in a Selections list include a "source name" (srcname) string
-to represent matching parameters for network, station, location,
-channel and optionally the quality name components. Each name
-component may contain globbing characters to match more than one
-unique srcname.
-
-.nf
-Valid glob patterns include:
- * matches zero or more characters
- ? matches any single character
- [set] matches any character in the set
- [^set] matches any character NOT in the set
- where a set is a group of characters or ranges. a range
- is written as two characters separated with a hyphen:
- a-z denotes all characters between a to z inclusive.
- [-set] set matches a literal hyphen and any character in the set
- []set] matches a literal close bracket and any character in the set
-
- char matches itself except where char is '*' or '?' or '['
- \char matches char, including any pattern character
-
- examples:
- a*c ac abc abbc ...
- a?c acc abc aXc ...
- a[a-z]c aac abc acc ...
- a[-a-z]c a-c aac abc ...
-.fi
-
-.SH EXAMPLE USAGE
-The primary intention of the Selections list facility is to limit data
-to a specific selection as it's read into a program. This is
-illustrated below.
-
-.nf
-main() {
- MSRecord *msr = NULL;
- Selections *selections = NULL;
- hptime_t starttime;
- hptime_t endtime;
- int retcode;
-
- ms_addselect (&selections, "IU_*_*_LH?_?", HPTERROR, HPTERROR);
-
- starttime = timestr2hptime ("2009/1/15 00:00:00.00");
- endtime = timestr2hptime ("2009/1/31 23:59:59.99");
- ms_addselect (&selections, "IU_ANMO_00_LH?_?", starttime, endtime);
-
- while ( (retcode = ms_readmsr (&msr, filename, 0, NULL, NULL, 1, 0, verbose)) == MS_NOERROR )
- {
- /* Print details if data record matches selection criteria */
- if ( msr_matchselect (selections, msr, NULL) )
- {
- msr_print (msr, verbose);
- }
- }
-
- if ( retcode != MS_ENDOFFILE )
- ms_log (2, "Error reading input file %s: %s\\n",
- filename, ms_errorstr(retcode));
-
- /* Cleanup memory and close file */
- ms_readmsr (&msr, NULL, 0, NULL, NULL, 0, 0, verbose);
-} /* End of main() */
-.fi
-
-The following two calls are equivalent:
-.nf
- ms_addselect (&selections, "IU_ANMO_00_LH?_?", starttime, endtime);
- ms_addselect_comp (&selections, "IU", "ANMO", "00", "LH?", "?", startime, endtime);
-.fi
-
-As a further convienence usage of \fBms_readselectionsfile()\fP would
-allow the selections to be specified in a simple ASCII file and avoid
-the need to directly call \fBms_addselect()\fP.
-
-.SH SEE ALSO
-\fBmsr_srcname(3)\fP and \fBmst_srcname(3)\fP.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_addselect_comp.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_addselect_comp.3
new file mode 120000
index 000000000..d545f287c
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_addselect_comp.3
@@ -0,0 +1 @@
+ms_selection.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_blktdesc.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_blktdesc.3
deleted file mode 100644
index ec6b163fc..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_blktdesc.3
+++ /dev/null
@@ -1,82 +0,0 @@
-.TH MS_LOOKUP 3 2006/12/12 "Libmseed API"
-.SH NAME
-ms_lookup - Look up libmseed and Mini-SEED related information
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "char *\fBms_errorstr\fP ( int " errorcode " );"
-
-.BI "uint8_t \fBms_samplesize\fP ( const char " sampletype " );"
-
-.BI "char *\fBms_encodingstr\fP ( const char " encoding " );"
-
-.BI "char *\fBms_blktdesc\fP ( uint16_t " blkttype " );"
-
-.BI "uint16_t \fBms_blktlen\fP ( uint16_t " blkttype ", const char *" blktdata ",
-.BI " flag " swapflag " );
-.fi
-
-.SH DESCRIPTION
-\fBms_errorstr\fP returns a pointer to a string describing the
-specified libmseed error code. The error codes are defined in
-libmseed.h and returned by various functions.
-
-\fBms_samplesize\fP returns the sample size based on the specified
-\fIsampletype\fP. In general libmseed uses the following character
-sample types:
-.sp
-.nf
-"a" = 1 byte (ASCII)
-"i" = 4 bytes (integer)
-"f" = 4 bytes (float)
-"d" = 8 bytes (double)
-.fi
-
-\fBms_encoding\fP returns a pointer to a string describing the
-specified data \fIencoding\fP format. If the encoding format is
-unknown an appropriate string is return stating just that.
-
-\fBms_blktdesc\fP returns a pointer to a string describing the
-specified blockette type (\fIblkttype\fP). If the blockette type is
-unknown NULL is returned.
-
-\fBms_blktlen\fP returns the total length of the specified blockette
-type (\fIblkttype\fP) in bytes. A pointer to the blockette itself
-(\fIblkt\fP) should also be provided along with a \fIswapflag\fP that
-should be set to 1 when the blockette is known to have a different
-byte order than the host computer. The length returned includes both
-the blockette "header" (type and next fields) and "body".
-
-Technically a pointer to blockette and the swapflag only need to be
-supplied when the blockette type is a variable length blockette and
-the length is contained within the blockette itself (e.g. blockette
-type 2000). For blockettes of known fixed length (most of them) the
-\fIblkt\fP pointer and \fIswapflag\fP are not used.
-
-In the case of blockette type 405 that is variable length and not self
-describing 0 will be returned. In the case of blockette type 2000
-that is variable length and self describing the length will be read
-from a known offset into the blockette data.
-
-
-.SH RETURN VALUES
-\fBms_errorstr\fP returns a pointer to a static string.
-
-\fBms_samplesize\fP returns the sample size in bytes or 0 for unknown
-sample type.
-
-\fBms_encoding\fP returns a pointer to a static string.
-
-\fBms_blktdesc\fP returns a pointer to a static string or NULL if the
-blockette type is unknown.
-
-\fBms_blktlen\fP returns the total length of the specified blockette
-type or 0 for unknown type.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_blktdesc.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_blktdesc.3
new file mode 120000
index 000000000..4ba371489
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_blktdesc.3
@@ -0,0 +1 @@
+ms_lookup.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_blktlen.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_blktlen.3
deleted file mode 100644
index ec6b163fc..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_blktlen.3
+++ /dev/null
@@ -1,82 +0,0 @@
-.TH MS_LOOKUP 3 2006/12/12 "Libmseed API"
-.SH NAME
-ms_lookup - Look up libmseed and Mini-SEED related information
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "char *\fBms_errorstr\fP ( int " errorcode " );"
-
-.BI "uint8_t \fBms_samplesize\fP ( const char " sampletype " );"
-
-.BI "char *\fBms_encodingstr\fP ( const char " encoding " );"
-
-.BI "char *\fBms_blktdesc\fP ( uint16_t " blkttype " );"
-
-.BI "uint16_t \fBms_blktlen\fP ( uint16_t " blkttype ", const char *" blktdata ",
-.BI " flag " swapflag " );
-.fi
-
-.SH DESCRIPTION
-\fBms_errorstr\fP returns a pointer to a string describing the
-specified libmseed error code. The error codes are defined in
-libmseed.h and returned by various functions.
-
-\fBms_samplesize\fP returns the sample size based on the specified
-\fIsampletype\fP. In general libmseed uses the following character
-sample types:
-.sp
-.nf
-"a" = 1 byte (ASCII)
-"i" = 4 bytes (integer)
-"f" = 4 bytes (float)
-"d" = 8 bytes (double)
-.fi
-
-\fBms_encoding\fP returns a pointer to a string describing the
-specified data \fIencoding\fP format. If the encoding format is
-unknown an appropriate string is return stating just that.
-
-\fBms_blktdesc\fP returns a pointer to a string describing the
-specified blockette type (\fIblkttype\fP). If the blockette type is
-unknown NULL is returned.
-
-\fBms_blktlen\fP returns the total length of the specified blockette
-type (\fIblkttype\fP) in bytes. A pointer to the blockette itself
-(\fIblkt\fP) should also be provided along with a \fIswapflag\fP that
-should be set to 1 when the blockette is known to have a different
-byte order than the host computer. The length returned includes both
-the blockette "header" (type and next fields) and "body".
-
-Technically a pointer to blockette and the swapflag only need to be
-supplied when the blockette type is a variable length blockette and
-the length is contained within the blockette itself (e.g. blockette
-type 2000). For blockettes of known fixed length (most of them) the
-\fIblkt\fP pointer and \fIswapflag\fP are not used.
-
-In the case of blockette type 405 that is variable length and not self
-describing 0 will be returned. In the case of blockette type 2000
-that is variable length and self describing the length will be read
-from a known offset into the blockette data.
-
-
-.SH RETURN VALUES
-\fBms_errorstr\fP returns a pointer to a static string.
-
-\fBms_samplesize\fP returns the sample size in bytes or 0 for unknown
-sample type.
-
-\fBms_encoding\fP returns a pointer to a static string.
-
-\fBms_blktdesc\fP returns a pointer to a static string or NULL if the
-blockette type is unknown.
-
-\fBms_blktlen\fP returns the total length of the specified blockette
-type or 0 for unknown type.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_blktlen.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_blktlen.3
new file mode 120000
index 000000000..4ba371489
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_blktlen.3
@@ -0,0 +1 @@
+ms_lookup.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_btime2isotimestr.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_btime2isotimestr.3
deleted file mode 100644
index d9d1c6371..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_btime2isotimestr.3
+++ /dev/null
@@ -1,202 +0,0 @@
-.TH MS_TIME 3 2013/02/22 "Libmseed API"
-.SH NAME
-ms_time - Time conversion and string generation
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "MS_EPOCH2HPTIME(X) X * (hptime_t) HPTMODULUS"
-.BI "MS_HPTIME2EPOCH(X) X / HPTMODULUS"
-
-.BI "hptime_t \fBms_btime2hptime\fP ( BTime *" btime " );"
-
-.BI "char *\fBms_btime2isotimestr\fP ( BTime *" btime ", char *" isotimestr " );"
-
-.BI "char *\fBms_btime2mdtimestr\fP ( BTime *" btime ", char *" mdtimestr " );"
-
-.BI "char *\fBms_btime2seedtimestr\fP ( BTime *" btime ", char *" seedtimestr " );"
-
-.BI "int \fBms_hptime2btime\fP ( hptime_t " hptime ", BTime *" btime " );"
-
-.BI "char *\fBms_hptime2isotimestr\fP ( hptime_t " hptime ", char *" isotimestr ","
-.BI " flag " subseconds " );"
-
-.BI "char *\fBms_hptime2mdtimestr\fP ( hptime_t " hptime ", char *" mdtimestr ","
-.BI " flag " subseconds " );"
-
-.BI "char *\fBms_hptime2seedtimestr\fP ( hptime_t " hptime ", char *" seedtimestr ","
-.BI " flag " subseconds " );"
-
-.BI "hptime_t \fBms_time2hptime\fP ( int " year ", int " day ", int " hour ", int " min ","
-.BI " int " sec ", int " usec " );"
-
-.BI "hptime_t \fBms_seedtimestr2hptime\fP ( char *" seedtimestr " );"
-
-.BI "hptime_t \fBms_timestr2hptime\fP ( char *" timestr " );"
-.fi
-
-.SH DESCRIPTION
-These routines convert between various time formats. Internally,
-libmseed represents time values as high precision epoch times
-(hptime), the number of ticks from the epoch: 00:00:00.00 1 January
-1970. By default a tick is defined as a microsecond (0.000001
-seconds). See \fBINTERNAL HPTIME\fP below for more details. Also
-used is the SEED binary time represented by the following data
-structure (defined in libmseed.h):
-.sp
-.nf
-typedef struct btime_s
-{
- uint16_t year; /* year with century */
- uint16_t day; /* day, 1 - 366 */
- uint8_t hour; /* hour, 0 - 23 */
- uint8_t min; /* minute, 0 - 59 */
- uint8_t sec; /* second, 0 - 60 (60 = leap second) */
- uint8_t unused; /* unused alignment byte */
- uint16_t fract; /* fractional seconds, 0 - 9999 */
-} BTime;
-.fi
-
-\fBMS_EPOCH2HPTIME\fP is a macro which converts a Unix/POSIX epoch
-time (elapsed seconds since 1 January 1970) to a hptime which are
-related by a simple scaling factor.
-
-\fBMS_HPTIME2EPOCH\fP is a macro which converts an hptime to a
-Unix/POSIX epoch time (elapsed seconds since 1 January 1970) which are
-related by a simple scaling factor. The result can be cast to an
-integer, in which cast no rounding is performed and sub-second
-precision is truncated, or can be cast into a double to get a double
-precision epoch time.
-
-\fBms_btime2hptime\fP converts a \fIbtime\fP to a hptime.
-
-\fBms_btime2isotimestr\fP generates an ISO recommended format time
-string from a \fIbtime\fP. Example: '2001-07-29T12:38:00.0000'. The
-\fIisotimestr\fP must have enough room for 25 characters. The
-resulting string will be NULL terminated.
-
-\fBms_btime2mdtimestr\fP generates a month-day formatted time string
-from a \fIbtime\fP. Example: '2001-07-29 12:38:00.0000'. The
-\fImdtimestr\fP must have enough room for 25 characters. The
-resulting string will be NULL terminated.
-
-\fBms_btime2seedtimestr\fP generates a SEED format time string from a
-\fIbtime\fP. Example: '2001,195,12:38:00.0000'. The
-\fIseedtimestr\fP must have enough room for 23 characters. The
-resulting string will be NULL terminated.
-
-\fBms_hptime2btime\fP converts a \fIhptime\fP to a \fIbtime\fP. By
-default, hptime has microsecond precision whereas a BTime structure
-can only represent time to 0.0001 seconds. The precision will be lost
-during this conversion, it will not be accounted for by rounding but
-will be truncated. This behavior is by design.
-
-\fBms_hptime2isotimestr\fP generates an ISO recommended format time
-string from a \fIhptime\fP. Example: '2001-07-29T12:38:00.000000'
-or '2001-07-29T12:38:00'. The \fIisotimestr\fP must have enough room
-for 27 characters. The \fIsubseconds\fP flag controls whether the
-sub-second precision is included or not. The resulting string will be
-NULL terminated.
-
-\fBms_hptime2mdtimestr\fP generates a month-day formatted time string
-from a \fIhptime\fP. Example: '2001-07-29 12:38:00.000000'
-or '2001-07-29 12:38:00'. The \fIisotimestr\fP must have enough room
-for 27 characters. The \fIsubseconds\fP flag controls whether the
-sub-second precision is included or not. The resulting string will be
-NULL terminated.
-
-\fBms_hptime2seedtimestr\fP generates a SEED format time string from a
-\fIhptime\fP. Example: '2001,195,12:38:00.000000'
-or '2001,195,12:38:00'. The \fIseedtimestr\fP must have enough room
-for 25 characters. The \fIsubseconds\fP flag controls whether the
-sub-second precision is included or not. The resulting string will be
-NULL terminated.
-
-\fBms_time2hptime\fP converts the time represented by the specified
-\fIyear\fP, \fIday\fP, \fIhour\fP, \fImin\fP, \fIsec\fP and \fIusec\fP
-(microseconds) to an hptime. The range expected for each value is as
-follows:
-.sp
-.nf
-year : 1800 - 5000
-day : 1 - 366 (366 = last day of leap year)
-hour : 0 - 23
-min : 0 - 59
-sec : 0 - 60 (60 = leap second)
-usec : 0 - 999999
-.fi
-
-\fBNOTE:\fP miniSEED data records are only supported by limbseed with
-a year range between 1900 and 2100. These routines allow a wider
-range to support times for metadata, etc.
-
-\fBms_seedtimestr2hptime\fP converts a SEED time string (day-of-year
-style) to a high precision epoch time. The time format expected is
-"YYYY[,DDD,HH,MM,SS.FFFFFF]", the delimiter can be a comma [,], dash
-[-], colon [:] or period [.]. Additionally a 'T' or space may be used
-to seprate the day and hour fields. The fractional seconds ("FFFFFF")
-must begin with a period [.] if present.
-
-\fBms_timestr2hptime\fP converts a generic time string to a high
-precision epoch time. SEED time format is
-"YYYY[/MM/DD HH:MM:SS.FFFF]", the delimiter can be a dash [-],
-comma[,], slash [/], colon [:], or period [.]. Additionally a 'T' or
-space may be used between the date and time fields. The fractional
-seconds ("FFFFFF") must begin with a period [.] if present.
-
-For both \fBms_seedtimestr2hptime\fP and \fBms_timestr2hptime\fP the
-input time string may be "short", in which case the vales omitted on
-the right hand side are assumed to be 0 (with the exception of month
-and day which are assumed to be 1). The year is always required.
-This characteristic means that these time string parsers are very
-lenient and should not be used for validation or considered to be
-applying any strict validation.
-
-.SH RETURN VALUES
-\fBms_btime2hptime\fP, \fBms_time2hptime\fP,
-\fBms_seedtimestr2hptime\fP and \fBms_timestr2hptime\fP return a
-hptime on success and HPTERROR on error.
-
-\fBms_btime2isotimestr\fP, \fBms_btime2mdtimestr\fP,
-\fBms_btime2seedtimestr\fP, \fBms_hptime2isotimestr\fP,
-\fBms_hptime2mdtimestr\fP and \fBms_hptime2seedtimestr\fP return a
-pointer to the resulting string or NULL on error.
-
-\fBms_hptime2btime\fP returns 0 on success and -1 on error.
-
-.SH INTERNAL HPTIME
-The time values internal to libmseed are defined as the number of
-ticks from the epoch: 00:00:00.00 1 January 1970 and often referred to
-as hptime. By default a tick is defined as a microsecond (0.000001
-seconds). The tick interval, and thus hptime precision, is controlled
-by the definition of HPTMODULUS in libmseed.h. It is not recommended
-to change HPTMODULUS from the default value of 1000000.
-
-This epoch time system is similar to the Unix/POSIX epoch times except
-that the ticks are higher precision than the 1-second ticks used in
-POSIX. An hptime can always be converted to a Unix/POSIX epoch time
-by dividing hptime by HPTMODULUS (reducing the hptime to second
-precision) and vise-versa, see the documentation for the
-MS_HPTIME2EPOCH and MS_EPOCH2HPTIME macros above.
-
-As long as the system's \fPgmtime\fP function supports negative epoch
-times the internal time routines will be able to represent times
-earlier than the epoch, i.e. times earlier than 1 January 1970.
-
-The hptime values are stored as 64-bit integers to allow high
-precision and avoid accumulation errors associated with floating point
-values.
-
-A special value defined as HPTERROR in libmseed.h is used to represent
-errors for routines returning hptime.
-
-.SH ACKNOWLEDGEMENTS
-
-With software provided by http://2038bug.com/ (site offline, checked Oct. 2017)
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_btime2isotimestr.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_btime2isotimestr.3
new file mode 120000
index 000000000..e8efb393e
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_btime2isotimestr.3
@@ -0,0 +1 @@
+ms_time.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_btime2mdtimestr.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_btime2mdtimestr.3
deleted file mode 100644
index d9d1c6371..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_btime2mdtimestr.3
+++ /dev/null
@@ -1,202 +0,0 @@
-.TH MS_TIME 3 2013/02/22 "Libmseed API"
-.SH NAME
-ms_time - Time conversion and string generation
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "MS_EPOCH2HPTIME(X) X * (hptime_t) HPTMODULUS"
-.BI "MS_HPTIME2EPOCH(X) X / HPTMODULUS"
-
-.BI "hptime_t \fBms_btime2hptime\fP ( BTime *" btime " );"
-
-.BI "char *\fBms_btime2isotimestr\fP ( BTime *" btime ", char *" isotimestr " );"
-
-.BI "char *\fBms_btime2mdtimestr\fP ( BTime *" btime ", char *" mdtimestr " );"
-
-.BI "char *\fBms_btime2seedtimestr\fP ( BTime *" btime ", char *" seedtimestr " );"
-
-.BI "int \fBms_hptime2btime\fP ( hptime_t " hptime ", BTime *" btime " );"
-
-.BI "char *\fBms_hptime2isotimestr\fP ( hptime_t " hptime ", char *" isotimestr ","
-.BI " flag " subseconds " );"
-
-.BI "char *\fBms_hptime2mdtimestr\fP ( hptime_t " hptime ", char *" mdtimestr ","
-.BI " flag " subseconds " );"
-
-.BI "char *\fBms_hptime2seedtimestr\fP ( hptime_t " hptime ", char *" seedtimestr ","
-.BI " flag " subseconds " );"
-
-.BI "hptime_t \fBms_time2hptime\fP ( int " year ", int " day ", int " hour ", int " min ","
-.BI " int " sec ", int " usec " );"
-
-.BI "hptime_t \fBms_seedtimestr2hptime\fP ( char *" seedtimestr " );"
-
-.BI "hptime_t \fBms_timestr2hptime\fP ( char *" timestr " );"
-.fi
-
-.SH DESCRIPTION
-These routines convert between various time formats. Internally,
-libmseed represents time values as high precision epoch times
-(hptime), the number of ticks from the epoch: 00:00:00.00 1 January
-1970. By default a tick is defined as a microsecond (0.000001
-seconds). See \fBINTERNAL HPTIME\fP below for more details. Also
-used is the SEED binary time represented by the following data
-structure (defined in libmseed.h):
-.sp
-.nf
-typedef struct btime_s
-{
- uint16_t year; /* year with century */
- uint16_t day; /* day, 1 - 366 */
- uint8_t hour; /* hour, 0 - 23 */
- uint8_t min; /* minute, 0 - 59 */
- uint8_t sec; /* second, 0 - 60 (60 = leap second) */
- uint8_t unused; /* unused alignment byte */
- uint16_t fract; /* fractional seconds, 0 - 9999 */
-} BTime;
-.fi
-
-\fBMS_EPOCH2HPTIME\fP is a macro which converts a Unix/POSIX epoch
-time (elapsed seconds since 1 January 1970) to a hptime which are
-related by a simple scaling factor.
-
-\fBMS_HPTIME2EPOCH\fP is a macro which converts an hptime to a
-Unix/POSIX epoch time (elapsed seconds since 1 January 1970) which are
-related by a simple scaling factor. The result can be cast to an
-integer, in which cast no rounding is performed and sub-second
-precision is truncated, or can be cast into a double to get a double
-precision epoch time.
-
-\fBms_btime2hptime\fP converts a \fIbtime\fP to a hptime.
-
-\fBms_btime2isotimestr\fP generates an ISO recommended format time
-string from a \fIbtime\fP. Example: '2001-07-29T12:38:00.0000'. The
-\fIisotimestr\fP must have enough room for 25 characters. The
-resulting string will be NULL terminated.
-
-\fBms_btime2mdtimestr\fP generates a month-day formatted time string
-from a \fIbtime\fP. Example: '2001-07-29 12:38:00.0000'. The
-\fImdtimestr\fP must have enough room for 25 characters. The
-resulting string will be NULL terminated.
-
-\fBms_btime2seedtimestr\fP generates a SEED format time string from a
-\fIbtime\fP. Example: '2001,195,12:38:00.0000'. The
-\fIseedtimestr\fP must have enough room for 23 characters. The
-resulting string will be NULL terminated.
-
-\fBms_hptime2btime\fP converts a \fIhptime\fP to a \fIbtime\fP. By
-default, hptime has microsecond precision whereas a BTime structure
-can only represent time to 0.0001 seconds. The precision will be lost
-during this conversion, it will not be accounted for by rounding but
-will be truncated. This behavior is by design.
-
-\fBms_hptime2isotimestr\fP generates an ISO recommended format time
-string from a \fIhptime\fP. Example: '2001-07-29T12:38:00.000000'
-or '2001-07-29T12:38:00'. The \fIisotimestr\fP must have enough room
-for 27 characters. The \fIsubseconds\fP flag controls whether the
-sub-second precision is included or not. The resulting string will be
-NULL terminated.
-
-\fBms_hptime2mdtimestr\fP generates a month-day formatted time string
-from a \fIhptime\fP. Example: '2001-07-29 12:38:00.000000'
-or '2001-07-29 12:38:00'. The \fIisotimestr\fP must have enough room
-for 27 characters. The \fIsubseconds\fP flag controls whether the
-sub-second precision is included or not. The resulting string will be
-NULL terminated.
-
-\fBms_hptime2seedtimestr\fP generates a SEED format time string from a
-\fIhptime\fP. Example: '2001,195,12:38:00.000000'
-or '2001,195,12:38:00'. The \fIseedtimestr\fP must have enough room
-for 25 characters. The \fIsubseconds\fP flag controls whether the
-sub-second precision is included or not. The resulting string will be
-NULL terminated.
-
-\fBms_time2hptime\fP converts the time represented by the specified
-\fIyear\fP, \fIday\fP, \fIhour\fP, \fImin\fP, \fIsec\fP and \fIusec\fP
-(microseconds) to an hptime. The range expected for each value is as
-follows:
-.sp
-.nf
-year : 1800 - 5000
-day : 1 - 366 (366 = last day of leap year)
-hour : 0 - 23
-min : 0 - 59
-sec : 0 - 60 (60 = leap second)
-usec : 0 - 999999
-.fi
-
-\fBNOTE:\fP miniSEED data records are only supported by limbseed with
-a year range between 1900 and 2100. These routines allow a wider
-range to support times for metadata, etc.
-
-\fBms_seedtimestr2hptime\fP converts a SEED time string (day-of-year
-style) to a high precision epoch time. The time format expected is
-"YYYY[,DDD,HH,MM,SS.FFFFFF]", the delimiter can be a comma [,], dash
-[-], colon [:] or period [.]. Additionally a 'T' or space may be used
-to seprate the day and hour fields. The fractional seconds ("FFFFFF")
-must begin with a period [.] if present.
-
-\fBms_timestr2hptime\fP converts a generic time string to a high
-precision epoch time. SEED time format is
-"YYYY[/MM/DD HH:MM:SS.FFFF]", the delimiter can be a dash [-],
-comma[,], slash [/], colon [:], or period [.]. Additionally a 'T' or
-space may be used between the date and time fields. The fractional
-seconds ("FFFFFF") must begin with a period [.] if present.
-
-For both \fBms_seedtimestr2hptime\fP and \fBms_timestr2hptime\fP the
-input time string may be "short", in which case the vales omitted on
-the right hand side are assumed to be 0 (with the exception of month
-and day which are assumed to be 1). The year is always required.
-This characteristic means that these time string parsers are very
-lenient and should not be used for validation or considered to be
-applying any strict validation.
-
-.SH RETURN VALUES
-\fBms_btime2hptime\fP, \fBms_time2hptime\fP,
-\fBms_seedtimestr2hptime\fP and \fBms_timestr2hptime\fP return a
-hptime on success and HPTERROR on error.
-
-\fBms_btime2isotimestr\fP, \fBms_btime2mdtimestr\fP,
-\fBms_btime2seedtimestr\fP, \fBms_hptime2isotimestr\fP,
-\fBms_hptime2mdtimestr\fP and \fBms_hptime2seedtimestr\fP return a
-pointer to the resulting string or NULL on error.
-
-\fBms_hptime2btime\fP returns 0 on success and -1 on error.
-
-.SH INTERNAL HPTIME
-The time values internal to libmseed are defined as the number of
-ticks from the epoch: 00:00:00.00 1 January 1970 and often referred to
-as hptime. By default a tick is defined as a microsecond (0.000001
-seconds). The tick interval, and thus hptime precision, is controlled
-by the definition of HPTMODULUS in libmseed.h. It is not recommended
-to change HPTMODULUS from the default value of 1000000.
-
-This epoch time system is similar to the Unix/POSIX epoch times except
-that the ticks are higher precision than the 1-second ticks used in
-POSIX. An hptime can always be converted to a Unix/POSIX epoch time
-by dividing hptime by HPTMODULUS (reducing the hptime to second
-precision) and vise-versa, see the documentation for the
-MS_HPTIME2EPOCH and MS_EPOCH2HPTIME macros above.
-
-As long as the system's \fPgmtime\fP function supports negative epoch
-times the internal time routines will be able to represent times
-earlier than the epoch, i.e. times earlier than 1 January 1970.
-
-The hptime values are stored as 64-bit integers to allow high
-precision and avoid accumulation errors associated with floating point
-values.
-
-A special value defined as HPTERROR in libmseed.h is used to represent
-errors for routines returning hptime.
-
-.SH ACKNOWLEDGEMENTS
-
-With software provided by http://2038bug.com/ (site offline, checked Oct. 2017)
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_btime2mdtimestr.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_btime2mdtimestr.3
new file mode 120000
index 000000000..e8efb393e
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_btime2mdtimestr.3
@@ -0,0 +1 @@
+ms_time.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_btime2seedtimestr.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_btime2seedtimestr.3
deleted file mode 100644
index d9d1c6371..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_btime2seedtimestr.3
+++ /dev/null
@@ -1,202 +0,0 @@
-.TH MS_TIME 3 2013/02/22 "Libmseed API"
-.SH NAME
-ms_time - Time conversion and string generation
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "MS_EPOCH2HPTIME(X) X * (hptime_t) HPTMODULUS"
-.BI "MS_HPTIME2EPOCH(X) X / HPTMODULUS"
-
-.BI "hptime_t \fBms_btime2hptime\fP ( BTime *" btime " );"
-
-.BI "char *\fBms_btime2isotimestr\fP ( BTime *" btime ", char *" isotimestr " );"
-
-.BI "char *\fBms_btime2mdtimestr\fP ( BTime *" btime ", char *" mdtimestr " );"
-
-.BI "char *\fBms_btime2seedtimestr\fP ( BTime *" btime ", char *" seedtimestr " );"
-
-.BI "int \fBms_hptime2btime\fP ( hptime_t " hptime ", BTime *" btime " );"
-
-.BI "char *\fBms_hptime2isotimestr\fP ( hptime_t " hptime ", char *" isotimestr ","
-.BI " flag " subseconds " );"
-
-.BI "char *\fBms_hptime2mdtimestr\fP ( hptime_t " hptime ", char *" mdtimestr ","
-.BI " flag " subseconds " );"
-
-.BI "char *\fBms_hptime2seedtimestr\fP ( hptime_t " hptime ", char *" seedtimestr ","
-.BI " flag " subseconds " );"
-
-.BI "hptime_t \fBms_time2hptime\fP ( int " year ", int " day ", int " hour ", int " min ","
-.BI " int " sec ", int " usec " );"
-
-.BI "hptime_t \fBms_seedtimestr2hptime\fP ( char *" seedtimestr " );"
-
-.BI "hptime_t \fBms_timestr2hptime\fP ( char *" timestr " );"
-.fi
-
-.SH DESCRIPTION
-These routines convert between various time formats. Internally,
-libmseed represents time values as high precision epoch times
-(hptime), the number of ticks from the epoch: 00:00:00.00 1 January
-1970. By default a tick is defined as a microsecond (0.000001
-seconds). See \fBINTERNAL HPTIME\fP below for more details. Also
-used is the SEED binary time represented by the following data
-structure (defined in libmseed.h):
-.sp
-.nf
-typedef struct btime_s
-{
- uint16_t year; /* year with century */
- uint16_t day; /* day, 1 - 366 */
- uint8_t hour; /* hour, 0 - 23 */
- uint8_t min; /* minute, 0 - 59 */
- uint8_t sec; /* second, 0 - 60 (60 = leap second) */
- uint8_t unused; /* unused alignment byte */
- uint16_t fract; /* fractional seconds, 0 - 9999 */
-} BTime;
-.fi
-
-\fBMS_EPOCH2HPTIME\fP is a macro which converts a Unix/POSIX epoch
-time (elapsed seconds since 1 January 1970) to a hptime which are
-related by a simple scaling factor.
-
-\fBMS_HPTIME2EPOCH\fP is a macro which converts an hptime to a
-Unix/POSIX epoch time (elapsed seconds since 1 January 1970) which are
-related by a simple scaling factor. The result can be cast to an
-integer, in which cast no rounding is performed and sub-second
-precision is truncated, or can be cast into a double to get a double
-precision epoch time.
-
-\fBms_btime2hptime\fP converts a \fIbtime\fP to a hptime.
-
-\fBms_btime2isotimestr\fP generates an ISO recommended format time
-string from a \fIbtime\fP. Example: '2001-07-29T12:38:00.0000'. The
-\fIisotimestr\fP must have enough room for 25 characters. The
-resulting string will be NULL terminated.
-
-\fBms_btime2mdtimestr\fP generates a month-day formatted time string
-from a \fIbtime\fP. Example: '2001-07-29 12:38:00.0000'. The
-\fImdtimestr\fP must have enough room for 25 characters. The
-resulting string will be NULL terminated.
-
-\fBms_btime2seedtimestr\fP generates a SEED format time string from a
-\fIbtime\fP. Example: '2001,195,12:38:00.0000'. The
-\fIseedtimestr\fP must have enough room for 23 characters. The
-resulting string will be NULL terminated.
-
-\fBms_hptime2btime\fP converts a \fIhptime\fP to a \fIbtime\fP. By
-default, hptime has microsecond precision whereas a BTime structure
-can only represent time to 0.0001 seconds. The precision will be lost
-during this conversion, it will not be accounted for by rounding but
-will be truncated. This behavior is by design.
-
-\fBms_hptime2isotimestr\fP generates an ISO recommended format time
-string from a \fIhptime\fP. Example: '2001-07-29T12:38:00.000000'
-or '2001-07-29T12:38:00'. The \fIisotimestr\fP must have enough room
-for 27 characters. The \fIsubseconds\fP flag controls whether the
-sub-second precision is included or not. The resulting string will be
-NULL terminated.
-
-\fBms_hptime2mdtimestr\fP generates a month-day formatted time string
-from a \fIhptime\fP. Example: '2001-07-29 12:38:00.000000'
-or '2001-07-29 12:38:00'. The \fIisotimestr\fP must have enough room
-for 27 characters. The \fIsubseconds\fP flag controls whether the
-sub-second precision is included or not. The resulting string will be
-NULL terminated.
-
-\fBms_hptime2seedtimestr\fP generates a SEED format time string from a
-\fIhptime\fP. Example: '2001,195,12:38:00.000000'
-or '2001,195,12:38:00'. The \fIseedtimestr\fP must have enough room
-for 25 characters. The \fIsubseconds\fP flag controls whether the
-sub-second precision is included or not. The resulting string will be
-NULL terminated.
-
-\fBms_time2hptime\fP converts the time represented by the specified
-\fIyear\fP, \fIday\fP, \fIhour\fP, \fImin\fP, \fIsec\fP and \fIusec\fP
-(microseconds) to an hptime. The range expected for each value is as
-follows:
-.sp
-.nf
-year : 1800 - 5000
-day : 1 - 366 (366 = last day of leap year)
-hour : 0 - 23
-min : 0 - 59
-sec : 0 - 60 (60 = leap second)
-usec : 0 - 999999
-.fi
-
-\fBNOTE:\fP miniSEED data records are only supported by limbseed with
-a year range between 1900 and 2100. These routines allow a wider
-range to support times for metadata, etc.
-
-\fBms_seedtimestr2hptime\fP converts a SEED time string (day-of-year
-style) to a high precision epoch time. The time format expected is
-"YYYY[,DDD,HH,MM,SS.FFFFFF]", the delimiter can be a comma [,], dash
-[-], colon [:] or period [.]. Additionally a 'T' or space may be used
-to seprate the day and hour fields. The fractional seconds ("FFFFFF")
-must begin with a period [.] if present.
-
-\fBms_timestr2hptime\fP converts a generic time string to a high
-precision epoch time. SEED time format is
-"YYYY[/MM/DD HH:MM:SS.FFFF]", the delimiter can be a dash [-],
-comma[,], slash [/], colon [:], or period [.]. Additionally a 'T' or
-space may be used between the date and time fields. The fractional
-seconds ("FFFFFF") must begin with a period [.] if present.
-
-For both \fBms_seedtimestr2hptime\fP and \fBms_timestr2hptime\fP the
-input time string may be "short", in which case the vales omitted on
-the right hand side are assumed to be 0 (with the exception of month
-and day which are assumed to be 1). The year is always required.
-This characteristic means that these time string parsers are very
-lenient and should not be used for validation or considered to be
-applying any strict validation.
-
-.SH RETURN VALUES
-\fBms_btime2hptime\fP, \fBms_time2hptime\fP,
-\fBms_seedtimestr2hptime\fP and \fBms_timestr2hptime\fP return a
-hptime on success and HPTERROR on error.
-
-\fBms_btime2isotimestr\fP, \fBms_btime2mdtimestr\fP,
-\fBms_btime2seedtimestr\fP, \fBms_hptime2isotimestr\fP,
-\fBms_hptime2mdtimestr\fP and \fBms_hptime2seedtimestr\fP return a
-pointer to the resulting string or NULL on error.
-
-\fBms_hptime2btime\fP returns 0 on success and -1 on error.
-
-.SH INTERNAL HPTIME
-The time values internal to libmseed are defined as the number of
-ticks from the epoch: 00:00:00.00 1 January 1970 and often referred to
-as hptime. By default a tick is defined as a microsecond (0.000001
-seconds). The tick interval, and thus hptime precision, is controlled
-by the definition of HPTMODULUS in libmseed.h. It is not recommended
-to change HPTMODULUS from the default value of 1000000.
-
-This epoch time system is similar to the Unix/POSIX epoch times except
-that the ticks are higher precision than the 1-second ticks used in
-POSIX. An hptime can always be converted to a Unix/POSIX epoch time
-by dividing hptime by HPTMODULUS (reducing the hptime to second
-precision) and vise-versa, see the documentation for the
-MS_HPTIME2EPOCH and MS_EPOCH2HPTIME macros above.
-
-As long as the system's \fPgmtime\fP function supports negative epoch
-times the internal time routines will be able to represent times
-earlier than the epoch, i.e. times earlier than 1 January 1970.
-
-The hptime values are stored as 64-bit integers to allow high
-precision and avoid accumulation errors associated with floating point
-values.
-
-A special value defined as HPTERROR in libmseed.h is used to represent
-errors for routines returning hptime.
-
-.SH ACKNOWLEDGEMENTS
-
-With software provided by http://2038bug.com/ (site offline, checked Oct. 2017)
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_btime2seedtimestr.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_btime2seedtimestr.3
new file mode 120000
index 000000000..e8efb393e
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_btime2seedtimestr.3
@@ -0,0 +1 @@
+ms_time.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_btime3hptime.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_btime3hptime.3
deleted file mode 100644
index d9d1c6371..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_btime3hptime.3
+++ /dev/null
@@ -1,202 +0,0 @@
-.TH MS_TIME 3 2013/02/22 "Libmseed API"
-.SH NAME
-ms_time - Time conversion and string generation
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "MS_EPOCH2HPTIME(X) X * (hptime_t) HPTMODULUS"
-.BI "MS_HPTIME2EPOCH(X) X / HPTMODULUS"
-
-.BI "hptime_t \fBms_btime2hptime\fP ( BTime *" btime " );"
-
-.BI "char *\fBms_btime2isotimestr\fP ( BTime *" btime ", char *" isotimestr " );"
-
-.BI "char *\fBms_btime2mdtimestr\fP ( BTime *" btime ", char *" mdtimestr " );"
-
-.BI "char *\fBms_btime2seedtimestr\fP ( BTime *" btime ", char *" seedtimestr " );"
-
-.BI "int \fBms_hptime2btime\fP ( hptime_t " hptime ", BTime *" btime " );"
-
-.BI "char *\fBms_hptime2isotimestr\fP ( hptime_t " hptime ", char *" isotimestr ","
-.BI " flag " subseconds " );"
-
-.BI "char *\fBms_hptime2mdtimestr\fP ( hptime_t " hptime ", char *" mdtimestr ","
-.BI " flag " subseconds " );"
-
-.BI "char *\fBms_hptime2seedtimestr\fP ( hptime_t " hptime ", char *" seedtimestr ","
-.BI " flag " subseconds " );"
-
-.BI "hptime_t \fBms_time2hptime\fP ( int " year ", int " day ", int " hour ", int " min ","
-.BI " int " sec ", int " usec " );"
-
-.BI "hptime_t \fBms_seedtimestr2hptime\fP ( char *" seedtimestr " );"
-
-.BI "hptime_t \fBms_timestr2hptime\fP ( char *" timestr " );"
-.fi
-
-.SH DESCRIPTION
-These routines convert between various time formats. Internally,
-libmseed represents time values as high precision epoch times
-(hptime), the number of ticks from the epoch: 00:00:00.00 1 January
-1970. By default a tick is defined as a microsecond (0.000001
-seconds). See \fBINTERNAL HPTIME\fP below for more details. Also
-used is the SEED binary time represented by the following data
-structure (defined in libmseed.h):
-.sp
-.nf
-typedef struct btime_s
-{
- uint16_t year; /* year with century */
- uint16_t day; /* day, 1 - 366 */
- uint8_t hour; /* hour, 0 - 23 */
- uint8_t min; /* minute, 0 - 59 */
- uint8_t sec; /* second, 0 - 60 (60 = leap second) */
- uint8_t unused; /* unused alignment byte */
- uint16_t fract; /* fractional seconds, 0 - 9999 */
-} BTime;
-.fi
-
-\fBMS_EPOCH2HPTIME\fP is a macro which converts a Unix/POSIX epoch
-time (elapsed seconds since 1 January 1970) to a hptime which are
-related by a simple scaling factor.
-
-\fBMS_HPTIME2EPOCH\fP is a macro which converts an hptime to a
-Unix/POSIX epoch time (elapsed seconds since 1 January 1970) which are
-related by a simple scaling factor. The result can be cast to an
-integer, in which cast no rounding is performed and sub-second
-precision is truncated, or can be cast into a double to get a double
-precision epoch time.
-
-\fBms_btime2hptime\fP converts a \fIbtime\fP to a hptime.
-
-\fBms_btime2isotimestr\fP generates an ISO recommended format time
-string from a \fIbtime\fP. Example: '2001-07-29T12:38:00.0000'. The
-\fIisotimestr\fP must have enough room for 25 characters. The
-resulting string will be NULL terminated.
-
-\fBms_btime2mdtimestr\fP generates a month-day formatted time string
-from a \fIbtime\fP. Example: '2001-07-29 12:38:00.0000'. The
-\fImdtimestr\fP must have enough room for 25 characters. The
-resulting string will be NULL terminated.
-
-\fBms_btime2seedtimestr\fP generates a SEED format time string from a
-\fIbtime\fP. Example: '2001,195,12:38:00.0000'. The
-\fIseedtimestr\fP must have enough room for 23 characters. The
-resulting string will be NULL terminated.
-
-\fBms_hptime2btime\fP converts a \fIhptime\fP to a \fIbtime\fP. By
-default, hptime has microsecond precision whereas a BTime structure
-can only represent time to 0.0001 seconds. The precision will be lost
-during this conversion, it will not be accounted for by rounding but
-will be truncated. This behavior is by design.
-
-\fBms_hptime2isotimestr\fP generates an ISO recommended format time
-string from a \fIhptime\fP. Example: '2001-07-29T12:38:00.000000'
-or '2001-07-29T12:38:00'. The \fIisotimestr\fP must have enough room
-for 27 characters. The \fIsubseconds\fP flag controls whether the
-sub-second precision is included or not. The resulting string will be
-NULL terminated.
-
-\fBms_hptime2mdtimestr\fP generates a month-day formatted time string
-from a \fIhptime\fP. Example: '2001-07-29 12:38:00.000000'
-or '2001-07-29 12:38:00'. The \fIisotimestr\fP must have enough room
-for 27 characters. The \fIsubseconds\fP flag controls whether the
-sub-second precision is included or not. The resulting string will be
-NULL terminated.
-
-\fBms_hptime2seedtimestr\fP generates a SEED format time string from a
-\fIhptime\fP. Example: '2001,195,12:38:00.000000'
-or '2001,195,12:38:00'. The \fIseedtimestr\fP must have enough room
-for 25 characters. The \fIsubseconds\fP flag controls whether the
-sub-second precision is included or not. The resulting string will be
-NULL terminated.
-
-\fBms_time2hptime\fP converts the time represented by the specified
-\fIyear\fP, \fIday\fP, \fIhour\fP, \fImin\fP, \fIsec\fP and \fIusec\fP
-(microseconds) to an hptime. The range expected for each value is as
-follows:
-.sp
-.nf
-year : 1800 - 5000
-day : 1 - 366 (366 = last day of leap year)
-hour : 0 - 23
-min : 0 - 59
-sec : 0 - 60 (60 = leap second)
-usec : 0 - 999999
-.fi
-
-\fBNOTE:\fP miniSEED data records are only supported by limbseed with
-a year range between 1900 and 2100. These routines allow a wider
-range to support times for metadata, etc.
-
-\fBms_seedtimestr2hptime\fP converts a SEED time string (day-of-year
-style) to a high precision epoch time. The time format expected is
-"YYYY[,DDD,HH,MM,SS.FFFFFF]", the delimiter can be a comma [,], dash
-[-], colon [:] or period [.]. Additionally a 'T' or space may be used
-to seprate the day and hour fields. The fractional seconds ("FFFFFF")
-must begin with a period [.] if present.
-
-\fBms_timestr2hptime\fP converts a generic time string to a high
-precision epoch time. SEED time format is
-"YYYY[/MM/DD HH:MM:SS.FFFF]", the delimiter can be a dash [-],
-comma[,], slash [/], colon [:], or period [.]. Additionally a 'T' or
-space may be used between the date and time fields. The fractional
-seconds ("FFFFFF") must begin with a period [.] if present.
-
-For both \fBms_seedtimestr2hptime\fP and \fBms_timestr2hptime\fP the
-input time string may be "short", in which case the vales omitted on
-the right hand side are assumed to be 0 (with the exception of month
-and day which are assumed to be 1). The year is always required.
-This characteristic means that these time string parsers are very
-lenient and should not be used for validation or considered to be
-applying any strict validation.
-
-.SH RETURN VALUES
-\fBms_btime2hptime\fP, \fBms_time2hptime\fP,
-\fBms_seedtimestr2hptime\fP and \fBms_timestr2hptime\fP return a
-hptime on success and HPTERROR on error.
-
-\fBms_btime2isotimestr\fP, \fBms_btime2mdtimestr\fP,
-\fBms_btime2seedtimestr\fP, \fBms_hptime2isotimestr\fP,
-\fBms_hptime2mdtimestr\fP and \fBms_hptime2seedtimestr\fP return a
-pointer to the resulting string or NULL on error.
-
-\fBms_hptime2btime\fP returns 0 on success and -1 on error.
-
-.SH INTERNAL HPTIME
-The time values internal to libmseed are defined as the number of
-ticks from the epoch: 00:00:00.00 1 January 1970 and often referred to
-as hptime. By default a tick is defined as a microsecond (0.000001
-seconds). The tick interval, and thus hptime precision, is controlled
-by the definition of HPTMODULUS in libmseed.h. It is not recommended
-to change HPTMODULUS from the default value of 1000000.
-
-This epoch time system is similar to the Unix/POSIX epoch times except
-that the ticks are higher precision than the 1-second ticks used in
-POSIX. An hptime can always be converted to a Unix/POSIX epoch time
-by dividing hptime by HPTMODULUS (reducing the hptime to second
-precision) and vise-versa, see the documentation for the
-MS_HPTIME2EPOCH and MS_EPOCH2HPTIME macros above.
-
-As long as the system's \fPgmtime\fP function supports negative epoch
-times the internal time routines will be able to represent times
-earlier than the epoch, i.e. times earlier than 1 January 1970.
-
-The hptime values are stored as 64-bit integers to allow high
-precision and avoid accumulation errors associated with floating point
-values.
-
-A special value defined as HPTERROR in libmseed.h is used to represent
-errors for routines returning hptime.
-
-.SH ACKNOWLEDGEMENTS
-
-With software provided by http://2038bug.com/ (site offline, checked Oct. 2017)
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_btime3hptime.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_btime3hptime.3
new file mode 120000
index 000000000..e8efb393e
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_btime3hptime.3
@@ -0,0 +1 @@
+ms_time.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_detect.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_detect.3
deleted file mode 100644
index 7de7376b3..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_detect.3
+++ /dev/null
@@ -1,128 +0,0 @@
-.TH MSR_PARSE 3 2013/01/07 "Libmseed API"
-.SH NAME
-msr_parse - Detect and parse a SEED data record from a memory buffer
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "int \fBmsr_parse\fP ( char *" record ", int " recbuflen ", MSRecord " **ppmsr ","
-.BI " int " reclen ", flag " dataflag ", flag " verbose " );"
-
-.BI "int \fBmsr_parse_selection\fP ( char *" recbuf ", int " recbuflen ","
-.BI " int64_t *" offset ", MSRecord " **ppmsr ","
-.BI " int " reclen ", Selections *" selections ","
-.BI " flag " dataflag ", flag " verbose " );"
-
-.BI "int \fBms_detect\fP ( const char *" record ", int " recbuflen " );"
-
-.SH DESCRIPTION
-\fBmsr_parse\fP will parse a SEED data record from the \fIrecord\fP
-buffer and populate the MSRecord structure at \fIppmsr\fP, allocating
-one if needed. The \fIrecbuflen\fP argument is the length of the
-\fIrecord\fP buffer. Records must begin at the start of the buffer.
-
-If \fIreclen\fP is 0 or negative the length of record is automatically
-determined, otherwise \fIreclen\fP should be the correct record
-length. For auto detection of record length the record should include
-a 1000 blockette or be followed by another record header in the
-buffer.
-
-If \fIdataflag\fP is true (non-zero) the data samples will be unpacked
-when parsing the record. This argument is passed directly to
-\fBmsr_unpack(3)\fP.
-
-\fBmsr_parse_selection\fP will parse the first SEED data record from
-the \fIrecbuf\fP buffer that matches the optional \fIselections\fP.
-The \fIoffset\fP value indicates where to start searching the buffer.
-On success, the MSRecord structure at \fIppmsr\fP is populated and the
-\fIoffset\fP to the record in the buffer is set. See the example
-below for the intended usage pattern.
-
-\fBms_detect\fP determines whether the supplied \fIrecord\fP buffer
-contains a SEED data record by verifying known signatures, if a record
-is found the record length is determined by:
-
-1) Searching the buffer up to \fIrecbuflen\fP for a Blockette 1000.
-
-2) If no Blockette 1000 is found search at MINRECLEN-byte offsets
-for the fixed section of the next header in the buffer, thereby
-implying the record length.
-
-.SH RETURN VALUES
-\fBmsr_parse\fP returns values:
-.nf
- 0 : On success and populates the supplied MSRecord.
- >0 : Data record was detected but not enough data is present in buffer,
- the value returned is a hint of how much more data is needed.
- <0 : On error a negative libmseed error value is returned.
-
-\fBms_detect\fP returns values:
-.nf
- -1 : Data record not detected or error
- 0 : Data record detected but could not determine length
- >0 : Length of the data record in bytes
-.fi
-
-.SH EXAMPLE USAGE OF MS_PARSE_SELECTION()
-The \fBms_parse_selection()\fP routine uses the initial setting of
-\fIoffset\fP as the starting point to search the buffer. On
-successful parsing of a miniSEED record the value of \fIoffset\fP will
-be the offset in the buffer to the record parsed.
-
-To properly parse all records matching specificed selection criteria,
-a caller must check and manage the value of \fIoffset\fP. In
-particular, when the end of the buffer is reached a value of
-MS_GENERROR will be returned and the caller should check if the offset
-is still within the buffer length to determine if this is a parsing
-error or simply the end of the buffer.
-
-The following example illustrates the intended usage:
-
-.nf
- char *recbuf = ;
- int64_t recbuflen = ;
- int64_t offset = 0;
- MSRecord *msr = NULL;
- int reclen = -1;
- Selections *selections = NULL;
- flag dataflag = 1;
- flag verbose = 0;
-
- // You probaby want to set Selections
- // For example with a call to ms_readselectionsfile (&selections, selectfile)
-
- /* Loop over all selected records in recbuf */
- while ( offset < recbuflen )
- {
- if ( msr_parse_selection (recbuf, recbuflen, &offset, &msr, reclen, selections, dataflag, verbose) )
- {
- /* Only print error if offset is still within buffer length */
- if ( verbose && offset < recbuflen )
- ms_log (2, "Error parsing record at offset %"PRId64"\n", offset);
- }
- else /* Successfully found and parsed record */
- {
- /* Do something with the record, for example print the details */
- msr_print (msr, verbose);
-
- /* Increment offset in buffer for subsequent call to msr_parse_selection() */
- offset += msr->reclen;
- }
- }
-
- /* Clean up */
- msr_free (&msr);
-
- if ( selections )
- ms_freeselections (selections);
-.fi
-
-.SH SEE ALSO
-\fBmsr_unpack(3)\fP, \fBms_parse_raw(3)\fP and \fBms_errorstr(3)\fP
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_detect.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_detect.3
new file mode 120000
index 000000000..c995cdfc8
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_detect.3
@@ -0,0 +1 @@
+msr_parse.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_encodingstr.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_encodingstr.3
deleted file mode 100644
index ec6b163fc..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_encodingstr.3
+++ /dev/null
@@ -1,82 +0,0 @@
-.TH MS_LOOKUP 3 2006/12/12 "Libmseed API"
-.SH NAME
-ms_lookup - Look up libmseed and Mini-SEED related information
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "char *\fBms_errorstr\fP ( int " errorcode " );"
-
-.BI "uint8_t \fBms_samplesize\fP ( const char " sampletype " );"
-
-.BI "char *\fBms_encodingstr\fP ( const char " encoding " );"
-
-.BI "char *\fBms_blktdesc\fP ( uint16_t " blkttype " );"
-
-.BI "uint16_t \fBms_blktlen\fP ( uint16_t " blkttype ", const char *" blktdata ",
-.BI " flag " swapflag " );
-.fi
-
-.SH DESCRIPTION
-\fBms_errorstr\fP returns a pointer to a string describing the
-specified libmseed error code. The error codes are defined in
-libmseed.h and returned by various functions.
-
-\fBms_samplesize\fP returns the sample size based on the specified
-\fIsampletype\fP. In general libmseed uses the following character
-sample types:
-.sp
-.nf
-"a" = 1 byte (ASCII)
-"i" = 4 bytes (integer)
-"f" = 4 bytes (float)
-"d" = 8 bytes (double)
-.fi
-
-\fBms_encoding\fP returns a pointer to a string describing the
-specified data \fIencoding\fP format. If the encoding format is
-unknown an appropriate string is return stating just that.
-
-\fBms_blktdesc\fP returns a pointer to a string describing the
-specified blockette type (\fIblkttype\fP). If the blockette type is
-unknown NULL is returned.
-
-\fBms_blktlen\fP returns the total length of the specified blockette
-type (\fIblkttype\fP) in bytes. A pointer to the blockette itself
-(\fIblkt\fP) should also be provided along with a \fIswapflag\fP that
-should be set to 1 when the blockette is known to have a different
-byte order than the host computer. The length returned includes both
-the blockette "header" (type and next fields) and "body".
-
-Technically a pointer to blockette and the swapflag only need to be
-supplied when the blockette type is a variable length blockette and
-the length is contained within the blockette itself (e.g. blockette
-type 2000). For blockettes of known fixed length (most of them) the
-\fIblkt\fP pointer and \fIswapflag\fP are not used.
-
-In the case of blockette type 405 that is variable length and not self
-describing 0 will be returned. In the case of blockette type 2000
-that is variable length and self describing the length will be read
-from a known offset into the blockette data.
-
-
-.SH RETURN VALUES
-\fBms_errorstr\fP returns a pointer to a static string.
-
-\fBms_samplesize\fP returns the sample size in bytes or 0 for unknown
-sample type.
-
-\fBms_encoding\fP returns a pointer to a static string.
-
-\fBms_blktdesc\fP returns a pointer to a static string or NULL if the
-blockette type is unknown.
-
-\fBms_blktlen\fP returns the total length of the specified blockette
-type or 0 for unknown type.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_encodingstr.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_encodingstr.3
new file mode 120000
index 000000000..4ba371489
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_encodingstr.3
@@ -0,0 +1 @@
+ms_lookup.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_errorstr.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_errorstr.3
deleted file mode 100644
index ec6b163fc..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_errorstr.3
+++ /dev/null
@@ -1,82 +0,0 @@
-.TH MS_LOOKUP 3 2006/12/12 "Libmseed API"
-.SH NAME
-ms_lookup - Look up libmseed and Mini-SEED related information
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "char *\fBms_errorstr\fP ( int " errorcode " );"
-
-.BI "uint8_t \fBms_samplesize\fP ( const char " sampletype " );"
-
-.BI "char *\fBms_encodingstr\fP ( const char " encoding " );"
-
-.BI "char *\fBms_blktdesc\fP ( uint16_t " blkttype " );"
-
-.BI "uint16_t \fBms_blktlen\fP ( uint16_t " blkttype ", const char *" blktdata ",
-.BI " flag " swapflag " );
-.fi
-
-.SH DESCRIPTION
-\fBms_errorstr\fP returns a pointer to a string describing the
-specified libmseed error code. The error codes are defined in
-libmseed.h and returned by various functions.
-
-\fBms_samplesize\fP returns the sample size based on the specified
-\fIsampletype\fP. In general libmseed uses the following character
-sample types:
-.sp
-.nf
-"a" = 1 byte (ASCII)
-"i" = 4 bytes (integer)
-"f" = 4 bytes (float)
-"d" = 8 bytes (double)
-.fi
-
-\fBms_encoding\fP returns a pointer to a string describing the
-specified data \fIencoding\fP format. If the encoding format is
-unknown an appropriate string is return stating just that.
-
-\fBms_blktdesc\fP returns a pointer to a string describing the
-specified blockette type (\fIblkttype\fP). If the blockette type is
-unknown NULL is returned.
-
-\fBms_blktlen\fP returns the total length of the specified blockette
-type (\fIblkttype\fP) in bytes. A pointer to the blockette itself
-(\fIblkt\fP) should also be provided along with a \fIswapflag\fP that
-should be set to 1 when the blockette is known to have a different
-byte order than the host computer. The length returned includes both
-the blockette "header" (type and next fields) and "body".
-
-Technically a pointer to blockette and the swapflag only need to be
-supplied when the blockette type is a variable length blockette and
-the length is contained within the blockette itself (e.g. blockette
-type 2000). For blockettes of known fixed length (most of them) the
-\fIblkt\fP pointer and \fIswapflag\fP are not used.
-
-In the case of blockette type 405 that is variable length and not self
-describing 0 will be returned. In the case of blockette type 2000
-that is variable length and self describing the length will be read
-from a known offset into the blockette data.
-
-
-.SH RETURN VALUES
-\fBms_errorstr\fP returns a pointer to a static string.
-
-\fBms_samplesize\fP returns the sample size in bytes or 0 for unknown
-sample type.
-
-\fBms_encoding\fP returns a pointer to a static string.
-
-\fBms_blktdesc\fP returns a pointer to a static string or NULL if the
-blockette type is unknown.
-
-\fBms_blktlen\fP returns the total length of the specified blockette
-type or 0 for unknown type.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_errorstr.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_errorstr.3
new file mode 120000
index 000000000..4ba371489
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_errorstr.3
@@ -0,0 +1 @@
+ms_lookup.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_freeselections.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_freeselections.3
deleted file mode 100644
index 625b2cd3b..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_freeselections.3
+++ /dev/null
@@ -1,196 +0,0 @@
-.TH MS_SELECTION 3 2012/12/28 "Libmseed API"
-.SH NAME
-ms_selection - Routines to manage and use data selection lists.
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "Selections *\fBms_matchselect\fP ( Selections *" selections ", char *" srcname ","
-.BI " hptime_t " starttime ", hptime_t " endtime ","
-.BI " SelectTime **" ppselecttime " );"
-
-.BI "Selections *\fBmsr_matchselect\fP ( Selections *" selections ", MSRecord *" msr ","
-.BI " SelectTime **" ppselecttime " );"
-
-.BI "int \fBms_addselect\fP ( Selections **" ppselections ", char *" srcname ","
-.BI " hptime_t " starttime ", hptime_t " endtime " );"
-
-.BI "int \fBms_addselect_comp\fP ( Selections **" ppselections ", char *" net ","
-.BI " char *" sta ", char *" loc ", char *" chan ", char *" qual ","
-.BI " hptime_t " starttime ", hptime_t " endtime " );"
-
-.BI "int \fBms_readselectionsfile\fP ( Selections **" ppselections ", char *" filename " );"
-
-.BI "void \fBms_freeselections\fP ( Selections *" selections " );"
-
-.BI "void \fBms_printselections\fP ( Selections *" selections " );"
-.fi
-
-.SH DESCRIPTION
-These routines serve as a convienence facility for creating a list of
-data selections and using it to match data. The selection criteria
-are the \fIsrcname\fP and optional start and end times. The
-\fIsrcname\fP components in a selection may contain globbing
-characters for matching (wildcards, character range, etc.). A
-\fIsrcname\fP is generally composed of network, station, location,
-channel and optional quality components; normally these are created
-with \fBmsr_srcname(3)\fP and \fBmst_srcname(3)\fP.
-
-\fBms_matchselect\fP checks for an entry in the \fPselections\fP list
-that matches the supplied \fIsrcname\fP and optionally \fIstarttime\fP
-and \fIendtime\fP. The start and/or end times can be set to HTPERROR
-to mean "any" time. A selection will match the specified time range
-if there is any overlap in time coverage. If the \fIppselecttime\fP
-pointer is not NULL it will be set to the matching SelectTime entry.
-
-\fBmsr_matchselect\fP is a simple wrapper to call \fBms_matchselect\fP
-using the details from a specified MSRecord.
-
-\fBms_addselect\fP adds a selection entry to the \fIselections\fP list
-based on the \fsrcname\fP and the \fIstarttime\fP and \fIendtime\fP
-boundaries. The source name components may contain globbing
-characters for matching including wildcards and character sets, see
-\fBSRCNAME MATCHING\fP below. Note that the \fIppselections\fP is a
-pointer to a pointer, if the secondary pointer has not been allocated
-(i.e. the list is empty) the first entry will be created and the
-primary pointer updated.
-
-\fBms_addselect_comp\fP is a wrapper of \fBms_addselect\fP used to add
-a selection entry to the \fIselections\fP list. The \fInet\fP,
-\fIsta\fP, \fIloc\fP, \fIchan\fP and \fIqual\fP source name components
-are used to create a \fIsrcname\fP. The name components may contain
-globbing characters for matching including wildcards and character
-sets, see \fBSRCNAME MATCHING\fP below. If a name component is not
-specified a wildard matching all entries will be subsituted,
-i.e. \fInet\fP==NULL will be interpreted to match all network codes.
-As a special case a \fIloc\fP value of "--" will be translated to and
-empty string to match the srcname representation of a blank
-(space-space) location ID.
-
-\fBms_readselectionsfile\fP reads a file containing a list of
-selections and adds them to the specified \fIselections\fP list. As
-with \fBms_addselect\fP if the selections list is empty it will be
-created. For more details see the \fBSELECTION FILE\fR section below.
-
-\fBms_freeselections\fP frees all memory associated with
-\fIselections\fP.
-
-\fBms_printselections\fP prints all of the entries in the
-\fIselections\fP list using the ms_log() facility.
-
-.SH RETURN VALUES
-The \fBms_matchselect\fP and \fBmsr_matchselect\fP routines return a
-pointer to the matching Selections entry on success and NULL when no
-match was found. These routines will also set the \fIppselecttime\fP
-pointer to the matching SelectTime entry if supplied.
-
-\fBms_addselect\fP and \fBms_addselect_comp\fP return 0 on success and
--1 on error.
-
-\fBms_readselectionsfile\fP returns the number of selections added to
-the list or -1 on error.
-
-.SH "SELECTION FILE"
-A selection file is used to match input data records based on network,
-station, location and channel information. Optionally a quality and
-time range may also be specified for more refined selection. The
-non-time fields may use the '*' wildcard to match multiple characters
-and the '?' wildcard to match single characters. Character sets may
-also be used, for example '[ENZ]' will match either E, N or Z.
-The '#' character indicates the remaining portion of the line will be
-ignored.
-
-Example selection file entries (the first four fields are required)
-.nf
-#net sta loc chan qual start end
-IU ANMO * BH?
-II * * * Q
-IU COLA 00 LH[ENZ] R
-IU COLA 00 LHZ * 2008,100,10,00,00 2008,100,10,30,00
-.fi
-
-.SH SRCNAME MATCHING
-Entries in a Selections list include a "source name" (srcname) string
-to represent matching parameters for network, station, location,
-channel and optionally the quality name components. Each name
-component may contain globbing characters to match more than one
-unique srcname.
-
-.nf
-Valid glob patterns include:
- * matches zero or more characters
- ? matches any single character
- [set] matches any character in the set
- [^set] matches any character NOT in the set
- where a set is a group of characters or ranges. a range
- is written as two characters separated with a hyphen:
- a-z denotes all characters between a to z inclusive.
- [-set] set matches a literal hyphen and any character in the set
- []set] matches a literal close bracket and any character in the set
-
- char matches itself except where char is '*' or '?' or '['
- \char matches char, including any pattern character
-
- examples:
- a*c ac abc abbc ...
- a?c acc abc aXc ...
- a[a-z]c aac abc acc ...
- a[-a-z]c a-c aac abc ...
-.fi
-
-.SH EXAMPLE USAGE
-The primary intention of the Selections list facility is to limit data
-to a specific selection as it's read into a program. This is
-illustrated below.
-
-.nf
-main() {
- MSRecord *msr = NULL;
- Selections *selections = NULL;
- hptime_t starttime;
- hptime_t endtime;
- int retcode;
-
- ms_addselect (&selections, "IU_*_*_LH?_?", HPTERROR, HPTERROR);
-
- starttime = timestr2hptime ("2009/1/15 00:00:00.00");
- endtime = timestr2hptime ("2009/1/31 23:59:59.99");
- ms_addselect (&selections, "IU_ANMO_00_LH?_?", starttime, endtime);
-
- while ( (retcode = ms_readmsr (&msr, filename, 0, NULL, NULL, 1, 0, verbose)) == MS_NOERROR )
- {
- /* Print details if data record matches selection criteria */
- if ( msr_matchselect (selections, msr, NULL) )
- {
- msr_print (msr, verbose);
- }
- }
-
- if ( retcode != MS_ENDOFFILE )
- ms_log (2, "Error reading input file %s: %s\\n",
- filename, ms_errorstr(retcode));
-
- /* Cleanup memory and close file */
- ms_readmsr (&msr, NULL, 0, NULL, NULL, 0, 0, verbose);
-} /* End of main() */
-.fi
-
-The following two calls are equivalent:
-.nf
- ms_addselect (&selections, "IU_ANMO_00_LH?_?", starttime, endtime);
- ms_addselect_comp (&selections, "IU", "ANMO", "00", "LH?", "?", startime, endtime);
-.fi
-
-As a further convienence usage of \fBms_readselectionsfile()\fP would
-allow the selections to be specified in a simple ASCII file and avoid
-the need to directly call \fBms_addselect()\fP.
-
-.SH SEE ALSO
-\fBmsr_srcname(3)\fP and \fBmst_srcname(3)\fP.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_freeselections.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_freeselections.3
new file mode 120000
index 000000000..d545f287c
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_freeselections.3
@@ -0,0 +1 @@
+ms_selection.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_gswap.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_gswap.3
index cf3291298..5dff01525 100644
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_gswap.3
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_gswap.3
@@ -23,13 +23,11 @@ ms_gswap - Generalized, in-place byte swapping routines
.SH DESCRIPTION
These routines swap between LSBF (little-endian) and MSBF (big-endian)
-byte orders. The specified quantities are swapped in-place. There
-are two versions of most routines: a generic one that works on
-quantities regardless of memory alignment (ms_gswap#) and one that works
-on memory aligned quantities (ms_gswap#a). The versions for memory
-aligned quantities are much faster than their generic versions, but
-the memory *must* be aligned. You have been warned. There is only a
-generic version for 3-byte quantities.
+byte orders. The specified quantities are swapped in-place.
+
+The \fBms_gswap*a\fP routines are provided for backwards compatibility, but
+should not be used in new code. They are aliases for the regular versions
+above.
.SH AUTHOR
.nf
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_gswap2.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_gswap2.3
deleted file mode 100644
index cf3291298..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_gswap2.3
+++ /dev/null
@@ -1,38 +0,0 @@
-.TH MS_GSWAP 3 2006/12/20 "Libmseed API"
-.SH NAME
-ms_gswap - Generalized, in-place byte swapping routines
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "void \fBms_gswap2\fP ( void *" data2 " );"
-
-.BI "void \fBms_gswap3\fP ( void *" data3 " );"
-
-.BI "void \fBms_gswap4\fP ( void *" data4 " );"
-
-.BI "void \fBms_gswap8\fP ( void *" data8 " );"
-
-.BI "void \fBms_gswap2a\fP ( void *" data2 " );"
-
-.BI "void \fBms_gswap4a\fP ( void *" data4 " );"
-
-.BI "void \fBms_gswap8a\fP ( void *" data8 " );"
-.fi
-
-.SH DESCRIPTION
-These routines swap between LSBF (little-endian) and MSBF (big-endian)
-byte orders. The specified quantities are swapped in-place. There
-are two versions of most routines: a generic one that works on
-quantities regardless of memory alignment (ms_gswap#) and one that works
-on memory aligned quantities (ms_gswap#a). The versions for memory
-aligned quantities are much faster than their generic versions, but
-the memory *must* be aligned. You have been warned. There is only a
-generic version for 3-byte quantities.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_gswap2.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_gswap2.3
new file mode 120000
index 000000000..3aeb80a92
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_gswap2.3
@@ -0,0 +1 @@
+ms_gswap.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_gswap2a.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_gswap2a.3
deleted file mode 100644
index cf3291298..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_gswap2a.3
+++ /dev/null
@@ -1,38 +0,0 @@
-.TH MS_GSWAP 3 2006/12/20 "Libmseed API"
-.SH NAME
-ms_gswap - Generalized, in-place byte swapping routines
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "void \fBms_gswap2\fP ( void *" data2 " );"
-
-.BI "void \fBms_gswap3\fP ( void *" data3 " );"
-
-.BI "void \fBms_gswap4\fP ( void *" data4 " );"
-
-.BI "void \fBms_gswap8\fP ( void *" data8 " );"
-
-.BI "void \fBms_gswap2a\fP ( void *" data2 " );"
-
-.BI "void \fBms_gswap4a\fP ( void *" data4 " );"
-
-.BI "void \fBms_gswap8a\fP ( void *" data8 " );"
-.fi
-
-.SH DESCRIPTION
-These routines swap between LSBF (little-endian) and MSBF (big-endian)
-byte orders. The specified quantities are swapped in-place. There
-are two versions of most routines: a generic one that works on
-quantities regardless of memory alignment (ms_gswap#) and one that works
-on memory aligned quantities (ms_gswap#a). The versions for memory
-aligned quantities are much faster than their generic versions, but
-the memory *must* be aligned. You have been warned. There is only a
-generic version for 3-byte quantities.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_gswap2a.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_gswap2a.3
new file mode 120000
index 000000000..3aeb80a92
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_gswap2a.3
@@ -0,0 +1 @@
+ms_gswap.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_gswap3.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_gswap3.3
deleted file mode 100644
index cf3291298..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_gswap3.3
+++ /dev/null
@@ -1,38 +0,0 @@
-.TH MS_GSWAP 3 2006/12/20 "Libmseed API"
-.SH NAME
-ms_gswap - Generalized, in-place byte swapping routines
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "void \fBms_gswap2\fP ( void *" data2 " );"
-
-.BI "void \fBms_gswap3\fP ( void *" data3 " );"
-
-.BI "void \fBms_gswap4\fP ( void *" data4 " );"
-
-.BI "void \fBms_gswap8\fP ( void *" data8 " );"
-
-.BI "void \fBms_gswap2a\fP ( void *" data2 " );"
-
-.BI "void \fBms_gswap4a\fP ( void *" data4 " );"
-
-.BI "void \fBms_gswap8a\fP ( void *" data8 " );"
-.fi
-
-.SH DESCRIPTION
-These routines swap between LSBF (little-endian) and MSBF (big-endian)
-byte orders. The specified quantities are swapped in-place. There
-are two versions of most routines: a generic one that works on
-quantities regardless of memory alignment (ms_gswap#) and one that works
-on memory aligned quantities (ms_gswap#a). The versions for memory
-aligned quantities are much faster than their generic versions, but
-the memory *must* be aligned. You have been warned. There is only a
-generic version for 3-byte quantities.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_gswap3.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_gswap3.3
new file mode 120000
index 000000000..3aeb80a92
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_gswap3.3
@@ -0,0 +1 @@
+ms_gswap.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_gswap4.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_gswap4.3
deleted file mode 100644
index cf3291298..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_gswap4.3
+++ /dev/null
@@ -1,38 +0,0 @@
-.TH MS_GSWAP 3 2006/12/20 "Libmseed API"
-.SH NAME
-ms_gswap - Generalized, in-place byte swapping routines
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "void \fBms_gswap2\fP ( void *" data2 " );"
-
-.BI "void \fBms_gswap3\fP ( void *" data3 " );"
-
-.BI "void \fBms_gswap4\fP ( void *" data4 " );"
-
-.BI "void \fBms_gswap8\fP ( void *" data8 " );"
-
-.BI "void \fBms_gswap2a\fP ( void *" data2 " );"
-
-.BI "void \fBms_gswap4a\fP ( void *" data4 " );"
-
-.BI "void \fBms_gswap8a\fP ( void *" data8 " );"
-.fi
-
-.SH DESCRIPTION
-These routines swap between LSBF (little-endian) and MSBF (big-endian)
-byte orders. The specified quantities are swapped in-place. There
-are two versions of most routines: a generic one that works on
-quantities regardless of memory alignment (ms_gswap#) and one that works
-on memory aligned quantities (ms_gswap#a). The versions for memory
-aligned quantities are much faster than their generic versions, but
-the memory *must* be aligned. You have been warned. There is only a
-generic version for 3-byte quantities.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_gswap4.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_gswap4.3
new file mode 120000
index 000000000..3aeb80a92
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_gswap4.3
@@ -0,0 +1 @@
+ms_gswap.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_gswap4a.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_gswap4a.3
deleted file mode 100644
index cf3291298..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_gswap4a.3
+++ /dev/null
@@ -1,38 +0,0 @@
-.TH MS_GSWAP 3 2006/12/20 "Libmseed API"
-.SH NAME
-ms_gswap - Generalized, in-place byte swapping routines
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "void \fBms_gswap2\fP ( void *" data2 " );"
-
-.BI "void \fBms_gswap3\fP ( void *" data3 " );"
-
-.BI "void \fBms_gswap4\fP ( void *" data4 " );"
-
-.BI "void \fBms_gswap8\fP ( void *" data8 " );"
-
-.BI "void \fBms_gswap2a\fP ( void *" data2 " );"
-
-.BI "void \fBms_gswap4a\fP ( void *" data4 " );"
-
-.BI "void \fBms_gswap8a\fP ( void *" data8 " );"
-.fi
-
-.SH DESCRIPTION
-These routines swap between LSBF (little-endian) and MSBF (big-endian)
-byte orders. The specified quantities are swapped in-place. There
-are two versions of most routines: a generic one that works on
-quantities regardless of memory alignment (ms_gswap#) and one that works
-on memory aligned quantities (ms_gswap#a). The versions for memory
-aligned quantities are much faster than their generic versions, but
-the memory *must* be aligned. You have been warned. There is only a
-generic version for 3-byte quantities.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_gswap4a.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_gswap4a.3
new file mode 120000
index 000000000..3aeb80a92
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_gswap4a.3
@@ -0,0 +1 @@
+ms_gswap.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_gswap8.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_gswap8.3
deleted file mode 100644
index cf3291298..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_gswap8.3
+++ /dev/null
@@ -1,38 +0,0 @@
-.TH MS_GSWAP 3 2006/12/20 "Libmseed API"
-.SH NAME
-ms_gswap - Generalized, in-place byte swapping routines
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "void \fBms_gswap2\fP ( void *" data2 " );"
-
-.BI "void \fBms_gswap3\fP ( void *" data3 " );"
-
-.BI "void \fBms_gswap4\fP ( void *" data4 " );"
-
-.BI "void \fBms_gswap8\fP ( void *" data8 " );"
-
-.BI "void \fBms_gswap2a\fP ( void *" data2 " );"
-
-.BI "void \fBms_gswap4a\fP ( void *" data4 " );"
-
-.BI "void \fBms_gswap8a\fP ( void *" data8 " );"
-.fi
-
-.SH DESCRIPTION
-These routines swap between LSBF (little-endian) and MSBF (big-endian)
-byte orders. The specified quantities are swapped in-place. There
-are two versions of most routines: a generic one that works on
-quantities regardless of memory alignment (ms_gswap#) and one that works
-on memory aligned quantities (ms_gswap#a). The versions for memory
-aligned quantities are much faster than their generic versions, but
-the memory *must* be aligned. You have been warned. There is only a
-generic version for 3-byte quantities.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_gswap8.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_gswap8.3
new file mode 120000
index 000000000..3aeb80a92
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_gswap8.3
@@ -0,0 +1 @@
+ms_gswap.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_gswap8a.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_gswap8a.3
deleted file mode 100644
index cf3291298..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_gswap8a.3
+++ /dev/null
@@ -1,38 +0,0 @@
-.TH MS_GSWAP 3 2006/12/20 "Libmseed API"
-.SH NAME
-ms_gswap - Generalized, in-place byte swapping routines
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "void \fBms_gswap2\fP ( void *" data2 " );"
-
-.BI "void \fBms_gswap3\fP ( void *" data3 " );"
-
-.BI "void \fBms_gswap4\fP ( void *" data4 " );"
-
-.BI "void \fBms_gswap8\fP ( void *" data8 " );"
-
-.BI "void \fBms_gswap2a\fP ( void *" data2 " );"
-
-.BI "void \fBms_gswap4a\fP ( void *" data4 " );"
-
-.BI "void \fBms_gswap8a\fP ( void *" data8 " );"
-.fi
-
-.SH DESCRIPTION
-These routines swap between LSBF (little-endian) and MSBF (big-endian)
-byte orders. The specified quantities are swapped in-place. There
-are two versions of most routines: a generic one that works on
-quantities regardless of memory alignment (ms_gswap#) and one that works
-on memory aligned quantities (ms_gswap#a). The versions for memory
-aligned quantities are much faster than their generic versions, but
-the memory *must* be aligned. You have been warned. There is only a
-generic version for 3-byte quantities.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_gswap8a.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_gswap8a.3
new file mode 120000
index 000000000..3aeb80a92
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_gswap8a.3
@@ -0,0 +1 @@
+ms_gswap.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_hptime2btime.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_hptime2btime.3
deleted file mode 100644
index d9d1c6371..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_hptime2btime.3
+++ /dev/null
@@ -1,202 +0,0 @@
-.TH MS_TIME 3 2013/02/22 "Libmseed API"
-.SH NAME
-ms_time - Time conversion and string generation
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "MS_EPOCH2HPTIME(X) X * (hptime_t) HPTMODULUS"
-.BI "MS_HPTIME2EPOCH(X) X / HPTMODULUS"
-
-.BI "hptime_t \fBms_btime2hptime\fP ( BTime *" btime " );"
-
-.BI "char *\fBms_btime2isotimestr\fP ( BTime *" btime ", char *" isotimestr " );"
-
-.BI "char *\fBms_btime2mdtimestr\fP ( BTime *" btime ", char *" mdtimestr " );"
-
-.BI "char *\fBms_btime2seedtimestr\fP ( BTime *" btime ", char *" seedtimestr " );"
-
-.BI "int \fBms_hptime2btime\fP ( hptime_t " hptime ", BTime *" btime " );"
-
-.BI "char *\fBms_hptime2isotimestr\fP ( hptime_t " hptime ", char *" isotimestr ","
-.BI " flag " subseconds " );"
-
-.BI "char *\fBms_hptime2mdtimestr\fP ( hptime_t " hptime ", char *" mdtimestr ","
-.BI " flag " subseconds " );"
-
-.BI "char *\fBms_hptime2seedtimestr\fP ( hptime_t " hptime ", char *" seedtimestr ","
-.BI " flag " subseconds " );"
-
-.BI "hptime_t \fBms_time2hptime\fP ( int " year ", int " day ", int " hour ", int " min ","
-.BI " int " sec ", int " usec " );"
-
-.BI "hptime_t \fBms_seedtimestr2hptime\fP ( char *" seedtimestr " );"
-
-.BI "hptime_t \fBms_timestr2hptime\fP ( char *" timestr " );"
-.fi
-
-.SH DESCRIPTION
-These routines convert between various time formats. Internally,
-libmseed represents time values as high precision epoch times
-(hptime), the number of ticks from the epoch: 00:00:00.00 1 January
-1970. By default a tick is defined as a microsecond (0.000001
-seconds). See \fBINTERNAL HPTIME\fP below for more details. Also
-used is the SEED binary time represented by the following data
-structure (defined in libmseed.h):
-.sp
-.nf
-typedef struct btime_s
-{
- uint16_t year; /* year with century */
- uint16_t day; /* day, 1 - 366 */
- uint8_t hour; /* hour, 0 - 23 */
- uint8_t min; /* minute, 0 - 59 */
- uint8_t sec; /* second, 0 - 60 (60 = leap second) */
- uint8_t unused; /* unused alignment byte */
- uint16_t fract; /* fractional seconds, 0 - 9999 */
-} BTime;
-.fi
-
-\fBMS_EPOCH2HPTIME\fP is a macro which converts a Unix/POSIX epoch
-time (elapsed seconds since 1 January 1970) to a hptime which are
-related by a simple scaling factor.
-
-\fBMS_HPTIME2EPOCH\fP is a macro which converts an hptime to a
-Unix/POSIX epoch time (elapsed seconds since 1 January 1970) which are
-related by a simple scaling factor. The result can be cast to an
-integer, in which cast no rounding is performed and sub-second
-precision is truncated, or can be cast into a double to get a double
-precision epoch time.
-
-\fBms_btime2hptime\fP converts a \fIbtime\fP to a hptime.
-
-\fBms_btime2isotimestr\fP generates an ISO recommended format time
-string from a \fIbtime\fP. Example: '2001-07-29T12:38:00.0000'. The
-\fIisotimestr\fP must have enough room for 25 characters. The
-resulting string will be NULL terminated.
-
-\fBms_btime2mdtimestr\fP generates a month-day formatted time string
-from a \fIbtime\fP. Example: '2001-07-29 12:38:00.0000'. The
-\fImdtimestr\fP must have enough room for 25 characters. The
-resulting string will be NULL terminated.
-
-\fBms_btime2seedtimestr\fP generates a SEED format time string from a
-\fIbtime\fP. Example: '2001,195,12:38:00.0000'. The
-\fIseedtimestr\fP must have enough room for 23 characters. The
-resulting string will be NULL terminated.
-
-\fBms_hptime2btime\fP converts a \fIhptime\fP to a \fIbtime\fP. By
-default, hptime has microsecond precision whereas a BTime structure
-can only represent time to 0.0001 seconds. The precision will be lost
-during this conversion, it will not be accounted for by rounding but
-will be truncated. This behavior is by design.
-
-\fBms_hptime2isotimestr\fP generates an ISO recommended format time
-string from a \fIhptime\fP. Example: '2001-07-29T12:38:00.000000'
-or '2001-07-29T12:38:00'. The \fIisotimestr\fP must have enough room
-for 27 characters. The \fIsubseconds\fP flag controls whether the
-sub-second precision is included or not. The resulting string will be
-NULL terminated.
-
-\fBms_hptime2mdtimestr\fP generates a month-day formatted time string
-from a \fIhptime\fP. Example: '2001-07-29 12:38:00.000000'
-or '2001-07-29 12:38:00'. The \fIisotimestr\fP must have enough room
-for 27 characters. The \fIsubseconds\fP flag controls whether the
-sub-second precision is included or not. The resulting string will be
-NULL terminated.
-
-\fBms_hptime2seedtimestr\fP generates a SEED format time string from a
-\fIhptime\fP. Example: '2001,195,12:38:00.000000'
-or '2001,195,12:38:00'. The \fIseedtimestr\fP must have enough room
-for 25 characters. The \fIsubseconds\fP flag controls whether the
-sub-second precision is included or not. The resulting string will be
-NULL terminated.
-
-\fBms_time2hptime\fP converts the time represented by the specified
-\fIyear\fP, \fIday\fP, \fIhour\fP, \fImin\fP, \fIsec\fP and \fIusec\fP
-(microseconds) to an hptime. The range expected for each value is as
-follows:
-.sp
-.nf
-year : 1800 - 5000
-day : 1 - 366 (366 = last day of leap year)
-hour : 0 - 23
-min : 0 - 59
-sec : 0 - 60 (60 = leap second)
-usec : 0 - 999999
-.fi
-
-\fBNOTE:\fP miniSEED data records are only supported by limbseed with
-a year range between 1900 and 2100. These routines allow a wider
-range to support times for metadata, etc.
-
-\fBms_seedtimestr2hptime\fP converts a SEED time string (day-of-year
-style) to a high precision epoch time. The time format expected is
-"YYYY[,DDD,HH,MM,SS.FFFFFF]", the delimiter can be a comma [,], dash
-[-], colon [:] or period [.]. Additionally a 'T' or space may be used
-to seprate the day and hour fields. The fractional seconds ("FFFFFF")
-must begin with a period [.] if present.
-
-\fBms_timestr2hptime\fP converts a generic time string to a high
-precision epoch time. SEED time format is
-"YYYY[/MM/DD HH:MM:SS.FFFF]", the delimiter can be a dash [-],
-comma[,], slash [/], colon [:], or period [.]. Additionally a 'T' or
-space may be used between the date and time fields. The fractional
-seconds ("FFFFFF") must begin with a period [.] if present.
-
-For both \fBms_seedtimestr2hptime\fP and \fBms_timestr2hptime\fP the
-input time string may be "short", in which case the vales omitted on
-the right hand side are assumed to be 0 (with the exception of month
-and day which are assumed to be 1). The year is always required.
-This characteristic means that these time string parsers are very
-lenient and should not be used for validation or considered to be
-applying any strict validation.
-
-.SH RETURN VALUES
-\fBms_btime2hptime\fP, \fBms_time2hptime\fP,
-\fBms_seedtimestr2hptime\fP and \fBms_timestr2hptime\fP return a
-hptime on success and HPTERROR on error.
-
-\fBms_btime2isotimestr\fP, \fBms_btime2mdtimestr\fP,
-\fBms_btime2seedtimestr\fP, \fBms_hptime2isotimestr\fP,
-\fBms_hptime2mdtimestr\fP and \fBms_hptime2seedtimestr\fP return a
-pointer to the resulting string or NULL on error.
-
-\fBms_hptime2btime\fP returns 0 on success and -1 on error.
-
-.SH INTERNAL HPTIME
-The time values internal to libmseed are defined as the number of
-ticks from the epoch: 00:00:00.00 1 January 1970 and often referred to
-as hptime. By default a tick is defined as a microsecond (0.000001
-seconds). The tick interval, and thus hptime precision, is controlled
-by the definition of HPTMODULUS in libmseed.h. It is not recommended
-to change HPTMODULUS from the default value of 1000000.
-
-This epoch time system is similar to the Unix/POSIX epoch times except
-that the ticks are higher precision than the 1-second ticks used in
-POSIX. An hptime can always be converted to a Unix/POSIX epoch time
-by dividing hptime by HPTMODULUS (reducing the hptime to second
-precision) and vise-versa, see the documentation for the
-MS_HPTIME2EPOCH and MS_EPOCH2HPTIME macros above.
-
-As long as the system's \fPgmtime\fP function supports negative epoch
-times the internal time routines will be able to represent times
-earlier than the epoch, i.e. times earlier than 1 January 1970.
-
-The hptime values are stored as 64-bit integers to allow high
-precision and avoid accumulation errors associated with floating point
-values.
-
-A special value defined as HPTERROR in libmseed.h is used to represent
-errors for routines returning hptime.
-
-.SH ACKNOWLEDGEMENTS
-
-With software provided by http://2038bug.com/ (site offline, checked Oct. 2017)
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_hptime2btime.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_hptime2btime.3
new file mode 120000
index 000000000..e8efb393e
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_hptime2btime.3
@@ -0,0 +1 @@
+ms_time.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_hptime2isotimestr.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_hptime2isotimestr.3
deleted file mode 100644
index d9d1c6371..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_hptime2isotimestr.3
+++ /dev/null
@@ -1,202 +0,0 @@
-.TH MS_TIME 3 2013/02/22 "Libmseed API"
-.SH NAME
-ms_time - Time conversion and string generation
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "MS_EPOCH2HPTIME(X) X * (hptime_t) HPTMODULUS"
-.BI "MS_HPTIME2EPOCH(X) X / HPTMODULUS"
-
-.BI "hptime_t \fBms_btime2hptime\fP ( BTime *" btime " );"
-
-.BI "char *\fBms_btime2isotimestr\fP ( BTime *" btime ", char *" isotimestr " );"
-
-.BI "char *\fBms_btime2mdtimestr\fP ( BTime *" btime ", char *" mdtimestr " );"
-
-.BI "char *\fBms_btime2seedtimestr\fP ( BTime *" btime ", char *" seedtimestr " );"
-
-.BI "int \fBms_hptime2btime\fP ( hptime_t " hptime ", BTime *" btime " );"
-
-.BI "char *\fBms_hptime2isotimestr\fP ( hptime_t " hptime ", char *" isotimestr ","
-.BI " flag " subseconds " );"
-
-.BI "char *\fBms_hptime2mdtimestr\fP ( hptime_t " hptime ", char *" mdtimestr ","
-.BI " flag " subseconds " );"
-
-.BI "char *\fBms_hptime2seedtimestr\fP ( hptime_t " hptime ", char *" seedtimestr ","
-.BI " flag " subseconds " );"
-
-.BI "hptime_t \fBms_time2hptime\fP ( int " year ", int " day ", int " hour ", int " min ","
-.BI " int " sec ", int " usec " );"
-
-.BI "hptime_t \fBms_seedtimestr2hptime\fP ( char *" seedtimestr " );"
-
-.BI "hptime_t \fBms_timestr2hptime\fP ( char *" timestr " );"
-.fi
-
-.SH DESCRIPTION
-These routines convert between various time formats. Internally,
-libmseed represents time values as high precision epoch times
-(hptime), the number of ticks from the epoch: 00:00:00.00 1 January
-1970. By default a tick is defined as a microsecond (0.000001
-seconds). See \fBINTERNAL HPTIME\fP below for more details. Also
-used is the SEED binary time represented by the following data
-structure (defined in libmseed.h):
-.sp
-.nf
-typedef struct btime_s
-{
- uint16_t year; /* year with century */
- uint16_t day; /* day, 1 - 366 */
- uint8_t hour; /* hour, 0 - 23 */
- uint8_t min; /* minute, 0 - 59 */
- uint8_t sec; /* second, 0 - 60 (60 = leap second) */
- uint8_t unused; /* unused alignment byte */
- uint16_t fract; /* fractional seconds, 0 - 9999 */
-} BTime;
-.fi
-
-\fBMS_EPOCH2HPTIME\fP is a macro which converts a Unix/POSIX epoch
-time (elapsed seconds since 1 January 1970) to a hptime which are
-related by a simple scaling factor.
-
-\fBMS_HPTIME2EPOCH\fP is a macro which converts an hptime to a
-Unix/POSIX epoch time (elapsed seconds since 1 January 1970) which are
-related by a simple scaling factor. The result can be cast to an
-integer, in which cast no rounding is performed and sub-second
-precision is truncated, or can be cast into a double to get a double
-precision epoch time.
-
-\fBms_btime2hptime\fP converts a \fIbtime\fP to a hptime.
-
-\fBms_btime2isotimestr\fP generates an ISO recommended format time
-string from a \fIbtime\fP. Example: '2001-07-29T12:38:00.0000'. The
-\fIisotimestr\fP must have enough room for 25 characters. The
-resulting string will be NULL terminated.
-
-\fBms_btime2mdtimestr\fP generates a month-day formatted time string
-from a \fIbtime\fP. Example: '2001-07-29 12:38:00.0000'. The
-\fImdtimestr\fP must have enough room for 25 characters. The
-resulting string will be NULL terminated.
-
-\fBms_btime2seedtimestr\fP generates a SEED format time string from a
-\fIbtime\fP. Example: '2001,195,12:38:00.0000'. The
-\fIseedtimestr\fP must have enough room for 23 characters. The
-resulting string will be NULL terminated.
-
-\fBms_hptime2btime\fP converts a \fIhptime\fP to a \fIbtime\fP. By
-default, hptime has microsecond precision whereas a BTime structure
-can only represent time to 0.0001 seconds. The precision will be lost
-during this conversion, it will not be accounted for by rounding but
-will be truncated. This behavior is by design.
-
-\fBms_hptime2isotimestr\fP generates an ISO recommended format time
-string from a \fIhptime\fP. Example: '2001-07-29T12:38:00.000000'
-or '2001-07-29T12:38:00'. The \fIisotimestr\fP must have enough room
-for 27 characters. The \fIsubseconds\fP flag controls whether the
-sub-second precision is included or not. The resulting string will be
-NULL terminated.
-
-\fBms_hptime2mdtimestr\fP generates a month-day formatted time string
-from a \fIhptime\fP. Example: '2001-07-29 12:38:00.000000'
-or '2001-07-29 12:38:00'. The \fIisotimestr\fP must have enough room
-for 27 characters. The \fIsubseconds\fP flag controls whether the
-sub-second precision is included or not. The resulting string will be
-NULL terminated.
-
-\fBms_hptime2seedtimestr\fP generates a SEED format time string from a
-\fIhptime\fP. Example: '2001,195,12:38:00.000000'
-or '2001,195,12:38:00'. The \fIseedtimestr\fP must have enough room
-for 25 characters. The \fIsubseconds\fP flag controls whether the
-sub-second precision is included or not. The resulting string will be
-NULL terminated.
-
-\fBms_time2hptime\fP converts the time represented by the specified
-\fIyear\fP, \fIday\fP, \fIhour\fP, \fImin\fP, \fIsec\fP and \fIusec\fP
-(microseconds) to an hptime. The range expected for each value is as
-follows:
-.sp
-.nf
-year : 1800 - 5000
-day : 1 - 366 (366 = last day of leap year)
-hour : 0 - 23
-min : 0 - 59
-sec : 0 - 60 (60 = leap second)
-usec : 0 - 999999
-.fi
-
-\fBNOTE:\fP miniSEED data records are only supported by limbseed with
-a year range between 1900 and 2100. These routines allow a wider
-range to support times for metadata, etc.
-
-\fBms_seedtimestr2hptime\fP converts a SEED time string (day-of-year
-style) to a high precision epoch time. The time format expected is
-"YYYY[,DDD,HH,MM,SS.FFFFFF]", the delimiter can be a comma [,], dash
-[-], colon [:] or period [.]. Additionally a 'T' or space may be used
-to seprate the day and hour fields. The fractional seconds ("FFFFFF")
-must begin with a period [.] if present.
-
-\fBms_timestr2hptime\fP converts a generic time string to a high
-precision epoch time. SEED time format is
-"YYYY[/MM/DD HH:MM:SS.FFFF]", the delimiter can be a dash [-],
-comma[,], slash [/], colon [:], or period [.]. Additionally a 'T' or
-space may be used between the date and time fields. The fractional
-seconds ("FFFFFF") must begin with a period [.] if present.
-
-For both \fBms_seedtimestr2hptime\fP and \fBms_timestr2hptime\fP the
-input time string may be "short", in which case the vales omitted on
-the right hand side are assumed to be 0 (with the exception of month
-and day which are assumed to be 1). The year is always required.
-This characteristic means that these time string parsers are very
-lenient and should not be used for validation or considered to be
-applying any strict validation.
-
-.SH RETURN VALUES
-\fBms_btime2hptime\fP, \fBms_time2hptime\fP,
-\fBms_seedtimestr2hptime\fP and \fBms_timestr2hptime\fP return a
-hptime on success and HPTERROR on error.
-
-\fBms_btime2isotimestr\fP, \fBms_btime2mdtimestr\fP,
-\fBms_btime2seedtimestr\fP, \fBms_hptime2isotimestr\fP,
-\fBms_hptime2mdtimestr\fP and \fBms_hptime2seedtimestr\fP return a
-pointer to the resulting string or NULL on error.
-
-\fBms_hptime2btime\fP returns 0 on success and -1 on error.
-
-.SH INTERNAL HPTIME
-The time values internal to libmseed are defined as the number of
-ticks from the epoch: 00:00:00.00 1 January 1970 and often referred to
-as hptime. By default a tick is defined as a microsecond (0.000001
-seconds). The tick interval, and thus hptime precision, is controlled
-by the definition of HPTMODULUS in libmseed.h. It is not recommended
-to change HPTMODULUS from the default value of 1000000.
-
-This epoch time system is similar to the Unix/POSIX epoch times except
-that the ticks are higher precision than the 1-second ticks used in
-POSIX. An hptime can always be converted to a Unix/POSIX epoch time
-by dividing hptime by HPTMODULUS (reducing the hptime to second
-precision) and vise-versa, see the documentation for the
-MS_HPTIME2EPOCH and MS_EPOCH2HPTIME macros above.
-
-As long as the system's \fPgmtime\fP function supports negative epoch
-times the internal time routines will be able to represent times
-earlier than the epoch, i.e. times earlier than 1 January 1970.
-
-The hptime values are stored as 64-bit integers to allow high
-precision and avoid accumulation errors associated with floating point
-values.
-
-A special value defined as HPTERROR in libmseed.h is used to represent
-errors for routines returning hptime.
-
-.SH ACKNOWLEDGEMENTS
-
-With software provided by http://2038bug.com/ (site offline, checked Oct. 2017)
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_hptime2isotimestr.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_hptime2isotimestr.3
new file mode 120000
index 000000000..e8efb393e
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_hptime2isotimestr.3
@@ -0,0 +1 @@
+ms_time.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_hptime2mdtimestr.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_hptime2mdtimestr.3
deleted file mode 100644
index d9d1c6371..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_hptime2mdtimestr.3
+++ /dev/null
@@ -1,202 +0,0 @@
-.TH MS_TIME 3 2013/02/22 "Libmseed API"
-.SH NAME
-ms_time - Time conversion and string generation
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "MS_EPOCH2HPTIME(X) X * (hptime_t) HPTMODULUS"
-.BI "MS_HPTIME2EPOCH(X) X / HPTMODULUS"
-
-.BI "hptime_t \fBms_btime2hptime\fP ( BTime *" btime " );"
-
-.BI "char *\fBms_btime2isotimestr\fP ( BTime *" btime ", char *" isotimestr " );"
-
-.BI "char *\fBms_btime2mdtimestr\fP ( BTime *" btime ", char *" mdtimestr " );"
-
-.BI "char *\fBms_btime2seedtimestr\fP ( BTime *" btime ", char *" seedtimestr " );"
-
-.BI "int \fBms_hptime2btime\fP ( hptime_t " hptime ", BTime *" btime " );"
-
-.BI "char *\fBms_hptime2isotimestr\fP ( hptime_t " hptime ", char *" isotimestr ","
-.BI " flag " subseconds " );"
-
-.BI "char *\fBms_hptime2mdtimestr\fP ( hptime_t " hptime ", char *" mdtimestr ","
-.BI " flag " subseconds " );"
-
-.BI "char *\fBms_hptime2seedtimestr\fP ( hptime_t " hptime ", char *" seedtimestr ","
-.BI " flag " subseconds " );"
-
-.BI "hptime_t \fBms_time2hptime\fP ( int " year ", int " day ", int " hour ", int " min ","
-.BI " int " sec ", int " usec " );"
-
-.BI "hptime_t \fBms_seedtimestr2hptime\fP ( char *" seedtimestr " );"
-
-.BI "hptime_t \fBms_timestr2hptime\fP ( char *" timestr " );"
-.fi
-
-.SH DESCRIPTION
-These routines convert between various time formats. Internally,
-libmseed represents time values as high precision epoch times
-(hptime), the number of ticks from the epoch: 00:00:00.00 1 January
-1970. By default a tick is defined as a microsecond (0.000001
-seconds). See \fBINTERNAL HPTIME\fP below for more details. Also
-used is the SEED binary time represented by the following data
-structure (defined in libmseed.h):
-.sp
-.nf
-typedef struct btime_s
-{
- uint16_t year; /* year with century */
- uint16_t day; /* day, 1 - 366 */
- uint8_t hour; /* hour, 0 - 23 */
- uint8_t min; /* minute, 0 - 59 */
- uint8_t sec; /* second, 0 - 60 (60 = leap second) */
- uint8_t unused; /* unused alignment byte */
- uint16_t fract; /* fractional seconds, 0 - 9999 */
-} BTime;
-.fi
-
-\fBMS_EPOCH2HPTIME\fP is a macro which converts a Unix/POSIX epoch
-time (elapsed seconds since 1 January 1970) to a hptime which are
-related by a simple scaling factor.
-
-\fBMS_HPTIME2EPOCH\fP is a macro which converts an hptime to a
-Unix/POSIX epoch time (elapsed seconds since 1 January 1970) which are
-related by a simple scaling factor. The result can be cast to an
-integer, in which cast no rounding is performed and sub-second
-precision is truncated, or can be cast into a double to get a double
-precision epoch time.
-
-\fBms_btime2hptime\fP converts a \fIbtime\fP to a hptime.
-
-\fBms_btime2isotimestr\fP generates an ISO recommended format time
-string from a \fIbtime\fP. Example: '2001-07-29T12:38:00.0000'. The
-\fIisotimestr\fP must have enough room for 25 characters. The
-resulting string will be NULL terminated.
-
-\fBms_btime2mdtimestr\fP generates a month-day formatted time string
-from a \fIbtime\fP. Example: '2001-07-29 12:38:00.0000'. The
-\fImdtimestr\fP must have enough room for 25 characters. The
-resulting string will be NULL terminated.
-
-\fBms_btime2seedtimestr\fP generates a SEED format time string from a
-\fIbtime\fP. Example: '2001,195,12:38:00.0000'. The
-\fIseedtimestr\fP must have enough room for 23 characters. The
-resulting string will be NULL terminated.
-
-\fBms_hptime2btime\fP converts a \fIhptime\fP to a \fIbtime\fP. By
-default, hptime has microsecond precision whereas a BTime structure
-can only represent time to 0.0001 seconds. The precision will be lost
-during this conversion, it will not be accounted for by rounding but
-will be truncated. This behavior is by design.
-
-\fBms_hptime2isotimestr\fP generates an ISO recommended format time
-string from a \fIhptime\fP. Example: '2001-07-29T12:38:00.000000'
-or '2001-07-29T12:38:00'. The \fIisotimestr\fP must have enough room
-for 27 characters. The \fIsubseconds\fP flag controls whether the
-sub-second precision is included or not. The resulting string will be
-NULL terminated.
-
-\fBms_hptime2mdtimestr\fP generates a month-day formatted time string
-from a \fIhptime\fP. Example: '2001-07-29 12:38:00.000000'
-or '2001-07-29 12:38:00'. The \fIisotimestr\fP must have enough room
-for 27 characters. The \fIsubseconds\fP flag controls whether the
-sub-second precision is included or not. The resulting string will be
-NULL terminated.
-
-\fBms_hptime2seedtimestr\fP generates a SEED format time string from a
-\fIhptime\fP. Example: '2001,195,12:38:00.000000'
-or '2001,195,12:38:00'. The \fIseedtimestr\fP must have enough room
-for 25 characters. The \fIsubseconds\fP flag controls whether the
-sub-second precision is included or not. The resulting string will be
-NULL terminated.
-
-\fBms_time2hptime\fP converts the time represented by the specified
-\fIyear\fP, \fIday\fP, \fIhour\fP, \fImin\fP, \fIsec\fP and \fIusec\fP
-(microseconds) to an hptime. The range expected for each value is as
-follows:
-.sp
-.nf
-year : 1800 - 5000
-day : 1 - 366 (366 = last day of leap year)
-hour : 0 - 23
-min : 0 - 59
-sec : 0 - 60 (60 = leap second)
-usec : 0 - 999999
-.fi
-
-\fBNOTE:\fP miniSEED data records are only supported by limbseed with
-a year range between 1900 and 2100. These routines allow a wider
-range to support times for metadata, etc.
-
-\fBms_seedtimestr2hptime\fP converts a SEED time string (day-of-year
-style) to a high precision epoch time. The time format expected is
-"YYYY[,DDD,HH,MM,SS.FFFFFF]", the delimiter can be a comma [,], dash
-[-], colon [:] or period [.]. Additionally a 'T' or space may be used
-to seprate the day and hour fields. The fractional seconds ("FFFFFF")
-must begin with a period [.] if present.
-
-\fBms_timestr2hptime\fP converts a generic time string to a high
-precision epoch time. SEED time format is
-"YYYY[/MM/DD HH:MM:SS.FFFF]", the delimiter can be a dash [-],
-comma[,], slash [/], colon [:], or period [.]. Additionally a 'T' or
-space may be used between the date and time fields. The fractional
-seconds ("FFFFFF") must begin with a period [.] if present.
-
-For both \fBms_seedtimestr2hptime\fP and \fBms_timestr2hptime\fP the
-input time string may be "short", in which case the vales omitted on
-the right hand side are assumed to be 0 (with the exception of month
-and day which are assumed to be 1). The year is always required.
-This characteristic means that these time string parsers are very
-lenient and should not be used for validation or considered to be
-applying any strict validation.
-
-.SH RETURN VALUES
-\fBms_btime2hptime\fP, \fBms_time2hptime\fP,
-\fBms_seedtimestr2hptime\fP and \fBms_timestr2hptime\fP return a
-hptime on success and HPTERROR on error.
-
-\fBms_btime2isotimestr\fP, \fBms_btime2mdtimestr\fP,
-\fBms_btime2seedtimestr\fP, \fBms_hptime2isotimestr\fP,
-\fBms_hptime2mdtimestr\fP and \fBms_hptime2seedtimestr\fP return a
-pointer to the resulting string or NULL on error.
-
-\fBms_hptime2btime\fP returns 0 on success and -1 on error.
-
-.SH INTERNAL HPTIME
-The time values internal to libmseed are defined as the number of
-ticks from the epoch: 00:00:00.00 1 January 1970 and often referred to
-as hptime. By default a tick is defined as a microsecond (0.000001
-seconds). The tick interval, and thus hptime precision, is controlled
-by the definition of HPTMODULUS in libmseed.h. It is not recommended
-to change HPTMODULUS from the default value of 1000000.
-
-This epoch time system is similar to the Unix/POSIX epoch times except
-that the ticks are higher precision than the 1-second ticks used in
-POSIX. An hptime can always be converted to a Unix/POSIX epoch time
-by dividing hptime by HPTMODULUS (reducing the hptime to second
-precision) and vise-versa, see the documentation for the
-MS_HPTIME2EPOCH and MS_EPOCH2HPTIME macros above.
-
-As long as the system's \fPgmtime\fP function supports negative epoch
-times the internal time routines will be able to represent times
-earlier than the epoch, i.e. times earlier than 1 January 1970.
-
-The hptime values are stored as 64-bit integers to allow high
-precision and avoid accumulation errors associated with floating point
-values.
-
-A special value defined as HPTERROR in libmseed.h is used to represent
-errors for routines returning hptime.
-
-.SH ACKNOWLEDGEMENTS
-
-With software provided by http://2038bug.com/ (site offline, checked Oct. 2017)
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_hptime2mdtimestr.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_hptime2mdtimestr.3
new file mode 120000
index 000000000..e8efb393e
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_hptime2mdtimestr.3
@@ -0,0 +1 @@
+ms_time.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_hptime2seedtimestr.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_hptime2seedtimestr.3
deleted file mode 100644
index d9d1c6371..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_hptime2seedtimestr.3
+++ /dev/null
@@ -1,202 +0,0 @@
-.TH MS_TIME 3 2013/02/22 "Libmseed API"
-.SH NAME
-ms_time - Time conversion and string generation
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "MS_EPOCH2HPTIME(X) X * (hptime_t) HPTMODULUS"
-.BI "MS_HPTIME2EPOCH(X) X / HPTMODULUS"
-
-.BI "hptime_t \fBms_btime2hptime\fP ( BTime *" btime " );"
-
-.BI "char *\fBms_btime2isotimestr\fP ( BTime *" btime ", char *" isotimestr " );"
-
-.BI "char *\fBms_btime2mdtimestr\fP ( BTime *" btime ", char *" mdtimestr " );"
-
-.BI "char *\fBms_btime2seedtimestr\fP ( BTime *" btime ", char *" seedtimestr " );"
-
-.BI "int \fBms_hptime2btime\fP ( hptime_t " hptime ", BTime *" btime " );"
-
-.BI "char *\fBms_hptime2isotimestr\fP ( hptime_t " hptime ", char *" isotimestr ","
-.BI " flag " subseconds " );"
-
-.BI "char *\fBms_hptime2mdtimestr\fP ( hptime_t " hptime ", char *" mdtimestr ","
-.BI " flag " subseconds " );"
-
-.BI "char *\fBms_hptime2seedtimestr\fP ( hptime_t " hptime ", char *" seedtimestr ","
-.BI " flag " subseconds " );"
-
-.BI "hptime_t \fBms_time2hptime\fP ( int " year ", int " day ", int " hour ", int " min ","
-.BI " int " sec ", int " usec " );"
-
-.BI "hptime_t \fBms_seedtimestr2hptime\fP ( char *" seedtimestr " );"
-
-.BI "hptime_t \fBms_timestr2hptime\fP ( char *" timestr " );"
-.fi
-
-.SH DESCRIPTION
-These routines convert between various time formats. Internally,
-libmseed represents time values as high precision epoch times
-(hptime), the number of ticks from the epoch: 00:00:00.00 1 January
-1970. By default a tick is defined as a microsecond (0.000001
-seconds). See \fBINTERNAL HPTIME\fP below for more details. Also
-used is the SEED binary time represented by the following data
-structure (defined in libmseed.h):
-.sp
-.nf
-typedef struct btime_s
-{
- uint16_t year; /* year with century */
- uint16_t day; /* day, 1 - 366 */
- uint8_t hour; /* hour, 0 - 23 */
- uint8_t min; /* minute, 0 - 59 */
- uint8_t sec; /* second, 0 - 60 (60 = leap second) */
- uint8_t unused; /* unused alignment byte */
- uint16_t fract; /* fractional seconds, 0 - 9999 */
-} BTime;
-.fi
-
-\fBMS_EPOCH2HPTIME\fP is a macro which converts a Unix/POSIX epoch
-time (elapsed seconds since 1 January 1970) to a hptime which are
-related by a simple scaling factor.
-
-\fBMS_HPTIME2EPOCH\fP is a macro which converts an hptime to a
-Unix/POSIX epoch time (elapsed seconds since 1 January 1970) which are
-related by a simple scaling factor. The result can be cast to an
-integer, in which cast no rounding is performed and sub-second
-precision is truncated, or can be cast into a double to get a double
-precision epoch time.
-
-\fBms_btime2hptime\fP converts a \fIbtime\fP to a hptime.
-
-\fBms_btime2isotimestr\fP generates an ISO recommended format time
-string from a \fIbtime\fP. Example: '2001-07-29T12:38:00.0000'. The
-\fIisotimestr\fP must have enough room for 25 characters. The
-resulting string will be NULL terminated.
-
-\fBms_btime2mdtimestr\fP generates a month-day formatted time string
-from a \fIbtime\fP. Example: '2001-07-29 12:38:00.0000'. The
-\fImdtimestr\fP must have enough room for 25 characters. The
-resulting string will be NULL terminated.
-
-\fBms_btime2seedtimestr\fP generates a SEED format time string from a
-\fIbtime\fP. Example: '2001,195,12:38:00.0000'. The
-\fIseedtimestr\fP must have enough room for 23 characters. The
-resulting string will be NULL terminated.
-
-\fBms_hptime2btime\fP converts a \fIhptime\fP to a \fIbtime\fP. By
-default, hptime has microsecond precision whereas a BTime structure
-can only represent time to 0.0001 seconds. The precision will be lost
-during this conversion, it will not be accounted for by rounding but
-will be truncated. This behavior is by design.
-
-\fBms_hptime2isotimestr\fP generates an ISO recommended format time
-string from a \fIhptime\fP. Example: '2001-07-29T12:38:00.000000'
-or '2001-07-29T12:38:00'. The \fIisotimestr\fP must have enough room
-for 27 characters. The \fIsubseconds\fP flag controls whether the
-sub-second precision is included or not. The resulting string will be
-NULL terminated.
-
-\fBms_hptime2mdtimestr\fP generates a month-day formatted time string
-from a \fIhptime\fP. Example: '2001-07-29 12:38:00.000000'
-or '2001-07-29 12:38:00'. The \fIisotimestr\fP must have enough room
-for 27 characters. The \fIsubseconds\fP flag controls whether the
-sub-second precision is included or not. The resulting string will be
-NULL terminated.
-
-\fBms_hptime2seedtimestr\fP generates a SEED format time string from a
-\fIhptime\fP. Example: '2001,195,12:38:00.000000'
-or '2001,195,12:38:00'. The \fIseedtimestr\fP must have enough room
-for 25 characters. The \fIsubseconds\fP flag controls whether the
-sub-second precision is included or not. The resulting string will be
-NULL terminated.
-
-\fBms_time2hptime\fP converts the time represented by the specified
-\fIyear\fP, \fIday\fP, \fIhour\fP, \fImin\fP, \fIsec\fP and \fIusec\fP
-(microseconds) to an hptime. The range expected for each value is as
-follows:
-.sp
-.nf
-year : 1800 - 5000
-day : 1 - 366 (366 = last day of leap year)
-hour : 0 - 23
-min : 0 - 59
-sec : 0 - 60 (60 = leap second)
-usec : 0 - 999999
-.fi
-
-\fBNOTE:\fP miniSEED data records are only supported by limbseed with
-a year range between 1900 and 2100. These routines allow a wider
-range to support times for metadata, etc.
-
-\fBms_seedtimestr2hptime\fP converts a SEED time string (day-of-year
-style) to a high precision epoch time. The time format expected is
-"YYYY[,DDD,HH,MM,SS.FFFFFF]", the delimiter can be a comma [,], dash
-[-], colon [:] or period [.]. Additionally a 'T' or space may be used
-to seprate the day and hour fields. The fractional seconds ("FFFFFF")
-must begin with a period [.] if present.
-
-\fBms_timestr2hptime\fP converts a generic time string to a high
-precision epoch time. SEED time format is
-"YYYY[/MM/DD HH:MM:SS.FFFF]", the delimiter can be a dash [-],
-comma[,], slash [/], colon [:], or period [.]. Additionally a 'T' or
-space may be used between the date and time fields. The fractional
-seconds ("FFFFFF") must begin with a period [.] if present.
-
-For both \fBms_seedtimestr2hptime\fP and \fBms_timestr2hptime\fP the
-input time string may be "short", in which case the vales omitted on
-the right hand side are assumed to be 0 (with the exception of month
-and day which are assumed to be 1). The year is always required.
-This characteristic means that these time string parsers are very
-lenient and should not be used for validation or considered to be
-applying any strict validation.
-
-.SH RETURN VALUES
-\fBms_btime2hptime\fP, \fBms_time2hptime\fP,
-\fBms_seedtimestr2hptime\fP and \fBms_timestr2hptime\fP return a
-hptime on success and HPTERROR on error.
-
-\fBms_btime2isotimestr\fP, \fBms_btime2mdtimestr\fP,
-\fBms_btime2seedtimestr\fP, \fBms_hptime2isotimestr\fP,
-\fBms_hptime2mdtimestr\fP and \fBms_hptime2seedtimestr\fP return a
-pointer to the resulting string or NULL on error.
-
-\fBms_hptime2btime\fP returns 0 on success and -1 on error.
-
-.SH INTERNAL HPTIME
-The time values internal to libmseed are defined as the number of
-ticks from the epoch: 00:00:00.00 1 January 1970 and often referred to
-as hptime. By default a tick is defined as a microsecond (0.000001
-seconds). The tick interval, and thus hptime precision, is controlled
-by the definition of HPTMODULUS in libmseed.h. It is not recommended
-to change HPTMODULUS from the default value of 1000000.
-
-This epoch time system is similar to the Unix/POSIX epoch times except
-that the ticks are higher precision than the 1-second ticks used in
-POSIX. An hptime can always be converted to a Unix/POSIX epoch time
-by dividing hptime by HPTMODULUS (reducing the hptime to second
-precision) and vise-versa, see the documentation for the
-MS_HPTIME2EPOCH and MS_EPOCH2HPTIME macros above.
-
-As long as the system's \fPgmtime\fP function supports negative epoch
-times the internal time routines will be able to represent times
-earlier than the epoch, i.e. times earlier than 1 January 1970.
-
-The hptime values are stored as 64-bit integers to allow high
-precision and avoid accumulation errors associated with floating point
-values.
-
-A special value defined as HPTERROR in libmseed.h is used to represent
-errors for routines returning hptime.
-
-.SH ACKNOWLEDGEMENTS
-
-With software provided by http://2038bug.com/ (site offline, checked Oct. 2017)
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_hptime2seedtimestr.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_hptime2seedtimestr.3
new file mode 120000
index 000000000..e8efb393e
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_hptime2seedtimestr.3
@@ -0,0 +1 @@
+ms_time.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_intro.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_intro.3
index 21a14f431..2ee19fba4 100644
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_intro.3
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_intro.3
@@ -537,7 +537,8 @@ main() {
the packing routine, the datasamples array must be dynamic memory
allocated by the malloc() family of routines. */
mst->datasamples = dataptr; /* pointer to 32-bit integer data samples */
- mst->numsamples = 1234;
+ mst->numsamples = 1234; /* number of samples in array at dataptr */
+ mst->samplecnt = mst->numsamples;
mst->sampletype = 'i'; /* declare type to be 32-bit integers */
mst_srcname (mst, srcname, 0);
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_log_l.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_log_l.3
deleted file mode 100644
index 0e4272ab3..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_log_l.3
+++ /dev/null
@@ -1,125 +0,0 @@
-.TH MS_LOG 3 2014/07/16
-.SH NAME
-ms_log - Central logging facility for libmseed
-
-.SH SYNOPSIS
-.nf
-.B #include
-.sp
-.BI "int \fBms_log\fP (int " level ", const char *" format ", ...);
-.sp
-.BI "int \fBms_log_l\fP (MSLogParam *" logp ", int " level ", const char *" format ", ...);
-.sp
-.BI "void \fBms_loginit\fP (void (*" log_print ")(char*), const char *" logprefix ",
-.BI " void (*" diag_print ")(char*), const char *" errprefix ");
-.sp
-.BI "MSLogParam * \fBms_loginit_l\fP (MSLogParam *" logp ",
-.BI " void (*" log_print ")(char*), const char *" logprefix ",
-.BI " void (*" diag_print ")(char*), const char *" errprefix ");
-.fi
-.SH DESCRIPTION
-The \fBms_log\fP functions are the central logging facility for
-all output from libmseed functions. They are also intended to be used
-by libmseed based programs if desired.
-
-Three message levels are recognized:
- 0 : Normal log messages, printed using log_print with logprefix
- 1 : Diagnostic messages, printed using diag_print with logprefix
- 2+ : Error messages, printed using diag_print with errprefix
-
-It is the task of the \fBms_log\fP functions to format a message using
-\fBprintf\fP conventions and pass the formatted string to the
-appropriate printing function (\fIlog_print\fP or \fIdiag_print\fP).
-
-\fBms_log\fP will process messages using the global logging
-parameters.
-
-\fBms_log_l\fP is a reentrant version of \fBms_log\fP. It will use
-the logging parameters specified in the supplied MSLogParam struct.
-If \fBlogp\fP is NULL global parameters will be used, this would be
-equivalent to a call to ms_log(). This is intended for use only when
-complicated logging schemes are desired, e.g. in a threaded
-application. Note that it is not possible to set thread specific
-logging parameters for the internal library functions because global
-parameters are used.
-
-The \fBms_loginit\fP functions are used to set the log and error
-printing functions and the log and error message prefixes used by the
-\fBms_log\fP functions.
-
-\fBms_loginit\fP will operate on the global logging parameters.
-
-\fBms_loginit_l\fP is a reentrant version of \fBms_loginit\fP. It
-will initialize or change the logging parameters specified in the
-MSLogParam struct. If \fIlogp\fP is NULL a new MSLogParam struct will
-be allocated. A pointer to the created or re-initialized MSLogParam
-struct will be returned. The returned pointer is suitable for use with
-\fBms_log_l\fP.
-
-Use NULL for the print function pointers or the prefixes if they
-should not be changed from previously set or default values.
-
-The default values for the logging parameters are:
- log_print = fprintf (printing to standard out)
- log_prefix = ""
- diag_print = fprintf (printing to standard error)
- err_prefix = "Error: "
-
-By setting the printing functions it is possible to re-direct all of
-the output from these logging routines. This is useful when the
-libmseed based software is embedded in a system with its own logging
-facilities.
-
-Most of the libmseed internal messages are logged at either the
-diagnostic or error level.
-
-.SH RETURN VALUES
-\fBms_log\fP and \fBms_log_l\fP return the number of characters
-formatted on success, and a negative value on error.
-
-\fBms_loginit_l\fP returns a pointer to the MSLogParam struct that it
-operated on. If the input MSLogParam struct is NULL a new struct will
-be allocated with \fBmalloc()\bP.
-
-.SH EXAMPLE
-Unless a complicated logging scheme is needed most uses of this
-logging facility will be limited to the ms_loginit and ms_log
-functions.
-
-An example of setting the printing functions:
-
-.nf
-#include
-
-void log_print (const char *message);
-void diag_print (const char *message);
-
-main () {
- ms_loginit (&log_print, "LOG: ", &diag_print, "ERR: ");
-
- /* Normal log message, "LOG: " will be prefixed */
- ms_log (0, "Normal log message for %s\n", argv[0]);
-
- /* Diagnostic message, "LOG: " will be prefixed */
- ms_log (1, "Diagnostic message for %s\n", argv[0]);
-
- /* Error message, "ERR: " will be prefixed */
- ms_log (2, "Error message for %s\n", argv[0]);
-}
-
-void log_print (const char *message) {
- /* Send message to external log message facility */
- send_log(message);
-}
-
-void diag_print (const char *message) {
- /* Send message to external error message facility */
- send_error(message);
-}
-.fi
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_log_l.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_log_l.3
new file mode 120000
index 000000000..fd3ff552d
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_log_l.3
@@ -0,0 +1 @@
+ms_log.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_loginit.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_loginit.3
deleted file mode 100644
index 0e4272ab3..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_loginit.3
+++ /dev/null
@@ -1,125 +0,0 @@
-.TH MS_LOG 3 2014/07/16
-.SH NAME
-ms_log - Central logging facility for libmseed
-
-.SH SYNOPSIS
-.nf
-.B #include
-.sp
-.BI "int \fBms_log\fP (int " level ", const char *" format ", ...);
-.sp
-.BI "int \fBms_log_l\fP (MSLogParam *" logp ", int " level ", const char *" format ", ...);
-.sp
-.BI "void \fBms_loginit\fP (void (*" log_print ")(char*), const char *" logprefix ",
-.BI " void (*" diag_print ")(char*), const char *" errprefix ");
-.sp
-.BI "MSLogParam * \fBms_loginit_l\fP (MSLogParam *" logp ",
-.BI " void (*" log_print ")(char*), const char *" logprefix ",
-.BI " void (*" diag_print ")(char*), const char *" errprefix ");
-.fi
-.SH DESCRIPTION
-The \fBms_log\fP functions are the central logging facility for
-all output from libmseed functions. They are also intended to be used
-by libmseed based programs if desired.
-
-Three message levels are recognized:
- 0 : Normal log messages, printed using log_print with logprefix
- 1 : Diagnostic messages, printed using diag_print with logprefix
- 2+ : Error messages, printed using diag_print with errprefix
-
-It is the task of the \fBms_log\fP functions to format a message using
-\fBprintf\fP conventions and pass the formatted string to the
-appropriate printing function (\fIlog_print\fP or \fIdiag_print\fP).
-
-\fBms_log\fP will process messages using the global logging
-parameters.
-
-\fBms_log_l\fP is a reentrant version of \fBms_log\fP. It will use
-the logging parameters specified in the supplied MSLogParam struct.
-If \fBlogp\fP is NULL global parameters will be used, this would be
-equivalent to a call to ms_log(). This is intended for use only when
-complicated logging schemes are desired, e.g. in a threaded
-application. Note that it is not possible to set thread specific
-logging parameters for the internal library functions because global
-parameters are used.
-
-The \fBms_loginit\fP functions are used to set the log and error
-printing functions and the log and error message prefixes used by the
-\fBms_log\fP functions.
-
-\fBms_loginit\fP will operate on the global logging parameters.
-
-\fBms_loginit_l\fP is a reentrant version of \fBms_loginit\fP. It
-will initialize or change the logging parameters specified in the
-MSLogParam struct. If \fIlogp\fP is NULL a new MSLogParam struct will
-be allocated. A pointer to the created or re-initialized MSLogParam
-struct will be returned. The returned pointer is suitable for use with
-\fBms_log_l\fP.
-
-Use NULL for the print function pointers or the prefixes if they
-should not be changed from previously set or default values.
-
-The default values for the logging parameters are:
- log_print = fprintf (printing to standard out)
- log_prefix = ""
- diag_print = fprintf (printing to standard error)
- err_prefix = "Error: "
-
-By setting the printing functions it is possible to re-direct all of
-the output from these logging routines. This is useful when the
-libmseed based software is embedded in a system with its own logging
-facilities.
-
-Most of the libmseed internal messages are logged at either the
-diagnostic or error level.
-
-.SH RETURN VALUES
-\fBms_log\fP and \fBms_log_l\fP return the number of characters
-formatted on success, and a negative value on error.
-
-\fBms_loginit_l\fP returns a pointer to the MSLogParam struct that it
-operated on. If the input MSLogParam struct is NULL a new struct will
-be allocated with \fBmalloc()\bP.
-
-.SH EXAMPLE
-Unless a complicated logging scheme is needed most uses of this
-logging facility will be limited to the ms_loginit and ms_log
-functions.
-
-An example of setting the printing functions:
-
-.nf
-#include
-
-void log_print (const char *message);
-void diag_print (const char *message);
-
-main () {
- ms_loginit (&log_print, "LOG: ", &diag_print, "ERR: ");
-
- /* Normal log message, "LOG: " will be prefixed */
- ms_log (0, "Normal log message for %s\n", argv[0]);
-
- /* Diagnostic message, "LOG: " will be prefixed */
- ms_log (1, "Diagnostic message for %s\n", argv[0]);
-
- /* Error message, "ERR: " will be prefixed */
- ms_log (2, "Error message for %s\n", argv[0]);
-}
-
-void log_print (const char *message) {
- /* Send message to external log message facility */
- send_log(message);
-}
-
-void diag_print (const char *message) {
- /* Send message to external error message facility */
- send_error(message);
-}
-.fi
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_loginit.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_loginit.3
new file mode 120000
index 000000000..fd3ff552d
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_loginit.3
@@ -0,0 +1 @@
+ms_log.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_loginit_l.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_loginit_l.3
deleted file mode 100644
index 0e4272ab3..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_loginit_l.3
+++ /dev/null
@@ -1,125 +0,0 @@
-.TH MS_LOG 3 2014/07/16
-.SH NAME
-ms_log - Central logging facility for libmseed
-
-.SH SYNOPSIS
-.nf
-.B #include
-.sp
-.BI "int \fBms_log\fP (int " level ", const char *" format ", ...);
-.sp
-.BI "int \fBms_log_l\fP (MSLogParam *" logp ", int " level ", const char *" format ", ...);
-.sp
-.BI "void \fBms_loginit\fP (void (*" log_print ")(char*), const char *" logprefix ",
-.BI " void (*" diag_print ")(char*), const char *" errprefix ");
-.sp
-.BI "MSLogParam * \fBms_loginit_l\fP (MSLogParam *" logp ",
-.BI " void (*" log_print ")(char*), const char *" logprefix ",
-.BI " void (*" diag_print ")(char*), const char *" errprefix ");
-.fi
-.SH DESCRIPTION
-The \fBms_log\fP functions are the central logging facility for
-all output from libmseed functions. They are also intended to be used
-by libmseed based programs if desired.
-
-Three message levels are recognized:
- 0 : Normal log messages, printed using log_print with logprefix
- 1 : Diagnostic messages, printed using diag_print with logprefix
- 2+ : Error messages, printed using diag_print with errprefix
-
-It is the task of the \fBms_log\fP functions to format a message using
-\fBprintf\fP conventions and pass the formatted string to the
-appropriate printing function (\fIlog_print\fP or \fIdiag_print\fP).
-
-\fBms_log\fP will process messages using the global logging
-parameters.
-
-\fBms_log_l\fP is a reentrant version of \fBms_log\fP. It will use
-the logging parameters specified in the supplied MSLogParam struct.
-If \fBlogp\fP is NULL global parameters will be used, this would be
-equivalent to a call to ms_log(). This is intended for use only when
-complicated logging schemes are desired, e.g. in a threaded
-application. Note that it is not possible to set thread specific
-logging parameters for the internal library functions because global
-parameters are used.
-
-The \fBms_loginit\fP functions are used to set the log and error
-printing functions and the log and error message prefixes used by the
-\fBms_log\fP functions.
-
-\fBms_loginit\fP will operate on the global logging parameters.
-
-\fBms_loginit_l\fP is a reentrant version of \fBms_loginit\fP. It
-will initialize or change the logging parameters specified in the
-MSLogParam struct. If \fIlogp\fP is NULL a new MSLogParam struct will
-be allocated. A pointer to the created or re-initialized MSLogParam
-struct will be returned. The returned pointer is suitable for use with
-\fBms_log_l\fP.
-
-Use NULL for the print function pointers or the prefixes if they
-should not be changed from previously set or default values.
-
-The default values for the logging parameters are:
- log_print = fprintf (printing to standard out)
- log_prefix = ""
- diag_print = fprintf (printing to standard error)
- err_prefix = "Error: "
-
-By setting the printing functions it is possible to re-direct all of
-the output from these logging routines. This is useful when the
-libmseed based software is embedded in a system with its own logging
-facilities.
-
-Most of the libmseed internal messages are logged at either the
-diagnostic or error level.
-
-.SH RETURN VALUES
-\fBms_log\fP and \fBms_log_l\fP return the number of characters
-formatted on success, and a negative value on error.
-
-\fBms_loginit_l\fP returns a pointer to the MSLogParam struct that it
-operated on. If the input MSLogParam struct is NULL a new struct will
-be allocated with \fBmalloc()\bP.
-
-.SH EXAMPLE
-Unless a complicated logging scheme is needed most uses of this
-logging facility will be limited to the ms_loginit and ms_log
-functions.
-
-An example of setting the printing functions:
-
-.nf
-#include
-
-void log_print (const char *message);
-void diag_print (const char *message);
-
-main () {
- ms_loginit (&log_print, "LOG: ", &diag_print, "ERR: ");
-
- /* Normal log message, "LOG: " will be prefixed */
- ms_log (0, "Normal log message for %s\n", argv[0]);
-
- /* Diagnostic message, "LOG: " will be prefixed */
- ms_log (1, "Diagnostic message for %s\n", argv[0]);
-
- /* Error message, "ERR: " will be prefixed */
- ms_log (2, "Error message for %s\n", argv[0]);
-}
-
-void log_print (const char *message) {
- /* Send message to external log message facility */
- send_log(message);
-}
-
-void diag_print (const char *message) {
- /* Send message to external error message facility */
- send_error(message);
-}
-.fi
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_loginit_l.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_loginit_l.3
new file mode 120000
index 000000000..fd3ff552d
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_loginit_l.3
@@ -0,0 +1 @@
+ms_log.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_matchselect.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_matchselect.3
deleted file mode 100644
index 625b2cd3b..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_matchselect.3
+++ /dev/null
@@ -1,196 +0,0 @@
-.TH MS_SELECTION 3 2012/12/28 "Libmseed API"
-.SH NAME
-ms_selection - Routines to manage and use data selection lists.
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "Selections *\fBms_matchselect\fP ( Selections *" selections ", char *" srcname ","
-.BI " hptime_t " starttime ", hptime_t " endtime ","
-.BI " SelectTime **" ppselecttime " );"
-
-.BI "Selections *\fBmsr_matchselect\fP ( Selections *" selections ", MSRecord *" msr ","
-.BI " SelectTime **" ppselecttime " );"
-
-.BI "int \fBms_addselect\fP ( Selections **" ppselections ", char *" srcname ","
-.BI " hptime_t " starttime ", hptime_t " endtime " );"
-
-.BI "int \fBms_addselect_comp\fP ( Selections **" ppselections ", char *" net ","
-.BI " char *" sta ", char *" loc ", char *" chan ", char *" qual ","
-.BI " hptime_t " starttime ", hptime_t " endtime " );"
-
-.BI "int \fBms_readselectionsfile\fP ( Selections **" ppselections ", char *" filename " );"
-
-.BI "void \fBms_freeselections\fP ( Selections *" selections " );"
-
-.BI "void \fBms_printselections\fP ( Selections *" selections " );"
-.fi
-
-.SH DESCRIPTION
-These routines serve as a convienence facility for creating a list of
-data selections and using it to match data. The selection criteria
-are the \fIsrcname\fP and optional start and end times. The
-\fIsrcname\fP components in a selection may contain globbing
-characters for matching (wildcards, character range, etc.). A
-\fIsrcname\fP is generally composed of network, station, location,
-channel and optional quality components; normally these are created
-with \fBmsr_srcname(3)\fP and \fBmst_srcname(3)\fP.
-
-\fBms_matchselect\fP checks for an entry in the \fPselections\fP list
-that matches the supplied \fIsrcname\fP and optionally \fIstarttime\fP
-and \fIendtime\fP. The start and/or end times can be set to HTPERROR
-to mean "any" time. A selection will match the specified time range
-if there is any overlap in time coverage. If the \fIppselecttime\fP
-pointer is not NULL it will be set to the matching SelectTime entry.
-
-\fBmsr_matchselect\fP is a simple wrapper to call \fBms_matchselect\fP
-using the details from a specified MSRecord.
-
-\fBms_addselect\fP adds a selection entry to the \fIselections\fP list
-based on the \fsrcname\fP and the \fIstarttime\fP and \fIendtime\fP
-boundaries. The source name components may contain globbing
-characters for matching including wildcards and character sets, see
-\fBSRCNAME MATCHING\fP below. Note that the \fIppselections\fP is a
-pointer to a pointer, if the secondary pointer has not been allocated
-(i.e. the list is empty) the first entry will be created and the
-primary pointer updated.
-
-\fBms_addselect_comp\fP is a wrapper of \fBms_addselect\fP used to add
-a selection entry to the \fIselections\fP list. The \fInet\fP,
-\fIsta\fP, \fIloc\fP, \fIchan\fP and \fIqual\fP source name components
-are used to create a \fIsrcname\fP. The name components may contain
-globbing characters for matching including wildcards and character
-sets, see \fBSRCNAME MATCHING\fP below. If a name component is not
-specified a wildard matching all entries will be subsituted,
-i.e. \fInet\fP==NULL will be interpreted to match all network codes.
-As a special case a \fIloc\fP value of "--" will be translated to and
-empty string to match the srcname representation of a blank
-(space-space) location ID.
-
-\fBms_readselectionsfile\fP reads a file containing a list of
-selections and adds them to the specified \fIselections\fP list. As
-with \fBms_addselect\fP if the selections list is empty it will be
-created. For more details see the \fBSELECTION FILE\fR section below.
-
-\fBms_freeselections\fP frees all memory associated with
-\fIselections\fP.
-
-\fBms_printselections\fP prints all of the entries in the
-\fIselections\fP list using the ms_log() facility.
-
-.SH RETURN VALUES
-The \fBms_matchselect\fP and \fBmsr_matchselect\fP routines return a
-pointer to the matching Selections entry on success and NULL when no
-match was found. These routines will also set the \fIppselecttime\fP
-pointer to the matching SelectTime entry if supplied.
-
-\fBms_addselect\fP and \fBms_addselect_comp\fP return 0 on success and
--1 on error.
-
-\fBms_readselectionsfile\fP returns the number of selections added to
-the list or -1 on error.
-
-.SH "SELECTION FILE"
-A selection file is used to match input data records based on network,
-station, location and channel information. Optionally a quality and
-time range may also be specified for more refined selection. The
-non-time fields may use the '*' wildcard to match multiple characters
-and the '?' wildcard to match single characters. Character sets may
-also be used, for example '[ENZ]' will match either E, N or Z.
-The '#' character indicates the remaining portion of the line will be
-ignored.
-
-Example selection file entries (the first four fields are required)
-.nf
-#net sta loc chan qual start end
-IU ANMO * BH?
-II * * * Q
-IU COLA 00 LH[ENZ] R
-IU COLA 00 LHZ * 2008,100,10,00,00 2008,100,10,30,00
-.fi
-
-.SH SRCNAME MATCHING
-Entries in a Selections list include a "source name" (srcname) string
-to represent matching parameters for network, station, location,
-channel and optionally the quality name components. Each name
-component may contain globbing characters to match more than one
-unique srcname.
-
-.nf
-Valid glob patterns include:
- * matches zero or more characters
- ? matches any single character
- [set] matches any character in the set
- [^set] matches any character NOT in the set
- where a set is a group of characters or ranges. a range
- is written as two characters separated with a hyphen:
- a-z denotes all characters between a to z inclusive.
- [-set] set matches a literal hyphen and any character in the set
- []set] matches a literal close bracket and any character in the set
-
- char matches itself except where char is '*' or '?' or '['
- \char matches char, including any pattern character
-
- examples:
- a*c ac abc abbc ...
- a?c acc abc aXc ...
- a[a-z]c aac abc acc ...
- a[-a-z]c a-c aac abc ...
-.fi
-
-.SH EXAMPLE USAGE
-The primary intention of the Selections list facility is to limit data
-to a specific selection as it's read into a program. This is
-illustrated below.
-
-.nf
-main() {
- MSRecord *msr = NULL;
- Selections *selections = NULL;
- hptime_t starttime;
- hptime_t endtime;
- int retcode;
-
- ms_addselect (&selections, "IU_*_*_LH?_?", HPTERROR, HPTERROR);
-
- starttime = timestr2hptime ("2009/1/15 00:00:00.00");
- endtime = timestr2hptime ("2009/1/31 23:59:59.99");
- ms_addselect (&selections, "IU_ANMO_00_LH?_?", starttime, endtime);
-
- while ( (retcode = ms_readmsr (&msr, filename, 0, NULL, NULL, 1, 0, verbose)) == MS_NOERROR )
- {
- /* Print details if data record matches selection criteria */
- if ( msr_matchselect (selections, msr, NULL) )
- {
- msr_print (msr, verbose);
- }
- }
-
- if ( retcode != MS_ENDOFFILE )
- ms_log (2, "Error reading input file %s: %s\\n",
- filename, ms_errorstr(retcode));
-
- /* Cleanup memory and close file */
- ms_readmsr (&msr, NULL, 0, NULL, NULL, 0, 0, verbose);
-} /* End of main() */
-.fi
-
-The following two calls are equivalent:
-.nf
- ms_addselect (&selections, "IU_ANMO_00_LH?_?", starttime, endtime);
- ms_addselect_comp (&selections, "IU", "ANMO", "00", "LH?", "?", startime, endtime);
-.fi
-
-As a further convienence usage of \fBms_readselectionsfile()\fP would
-allow the selections to be specified in a simple ASCII file and avoid
-the need to directly call \fBms_addselect()\fP.
-
-.SH SEE ALSO
-\fBmsr_srcname(3)\fP and \fBmst_srcname(3)\fP.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_matchselect.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_matchselect.3
new file mode 120000
index 000000000..d545f287c
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_matchselect.3
@@ -0,0 +1 @@
+ms_selection.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_md2doy.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_md2doy.3
deleted file mode 100644
index 1c2c50aa9..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_md2doy.3
+++ /dev/null
@@ -1,41 +0,0 @@
-.TH MS_DOY2MD 3 2004/11/22 "Libmseed API"
-.SH NAME
-ms_doy2md - Convert between day of year and month and day of month
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "int \fBms_doy2md\fP ( int " year ", int " jday ", int *" month ", int *" mday " );"
-
-.BI "int \fBms_md2doy\fP ( int " year ", int " month ", int " mday ", int *" jday " );"
-.fi
-
-.SH DESCRIPTION
-\fBms_doy2md\fP calculates the \fImonth\fP and day of month
-(\fImday\fP) for a given \fIyear\fP and day of year (\fIjday\fP).
-
-\fBms_md2doy\fP calculates the day of year (\fIjday\fP) for a given
-\fIyear\fP, \fImonth\fP and day of month (\fImday\fP).
-
-For both routines the expected and resulting ranges for each value are:
-.sp
-.nf
-year : 1900 - 2100
-jday : 1 - 366
-month : 1 - 12
-mday : 1 - 31
-.fi
-
-A day of year of 366 corresponds to the last day of a leap year.
-
-.SH RETURN VALUES
-\fBms_doy2md\fP returns 0 on success and -1 on error.
-
-\fBms_md2doy\fP returns 0 on success and -1 on error.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_md2doy.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_md2doy.3
new file mode 120000
index 000000000..22705a4b1
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_md2doy.3
@@ -0,0 +1 @@
+ms_doy2md.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_printselections.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_printselections.3
deleted file mode 100644
index 625b2cd3b..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_printselections.3
+++ /dev/null
@@ -1,196 +0,0 @@
-.TH MS_SELECTION 3 2012/12/28 "Libmseed API"
-.SH NAME
-ms_selection - Routines to manage and use data selection lists.
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "Selections *\fBms_matchselect\fP ( Selections *" selections ", char *" srcname ","
-.BI " hptime_t " starttime ", hptime_t " endtime ","
-.BI " SelectTime **" ppselecttime " );"
-
-.BI "Selections *\fBmsr_matchselect\fP ( Selections *" selections ", MSRecord *" msr ","
-.BI " SelectTime **" ppselecttime " );"
-
-.BI "int \fBms_addselect\fP ( Selections **" ppselections ", char *" srcname ","
-.BI " hptime_t " starttime ", hptime_t " endtime " );"
-
-.BI "int \fBms_addselect_comp\fP ( Selections **" ppselections ", char *" net ","
-.BI " char *" sta ", char *" loc ", char *" chan ", char *" qual ","
-.BI " hptime_t " starttime ", hptime_t " endtime " );"
-
-.BI "int \fBms_readselectionsfile\fP ( Selections **" ppselections ", char *" filename " );"
-
-.BI "void \fBms_freeselections\fP ( Selections *" selections " );"
-
-.BI "void \fBms_printselections\fP ( Selections *" selections " );"
-.fi
-
-.SH DESCRIPTION
-These routines serve as a convienence facility for creating a list of
-data selections and using it to match data. The selection criteria
-are the \fIsrcname\fP and optional start and end times. The
-\fIsrcname\fP components in a selection may contain globbing
-characters for matching (wildcards, character range, etc.). A
-\fIsrcname\fP is generally composed of network, station, location,
-channel and optional quality components; normally these are created
-with \fBmsr_srcname(3)\fP and \fBmst_srcname(3)\fP.
-
-\fBms_matchselect\fP checks for an entry in the \fPselections\fP list
-that matches the supplied \fIsrcname\fP and optionally \fIstarttime\fP
-and \fIendtime\fP. The start and/or end times can be set to HTPERROR
-to mean "any" time. A selection will match the specified time range
-if there is any overlap in time coverage. If the \fIppselecttime\fP
-pointer is not NULL it will be set to the matching SelectTime entry.
-
-\fBmsr_matchselect\fP is a simple wrapper to call \fBms_matchselect\fP
-using the details from a specified MSRecord.
-
-\fBms_addselect\fP adds a selection entry to the \fIselections\fP list
-based on the \fsrcname\fP and the \fIstarttime\fP and \fIendtime\fP
-boundaries. The source name components may contain globbing
-characters for matching including wildcards and character sets, see
-\fBSRCNAME MATCHING\fP below. Note that the \fIppselections\fP is a
-pointer to a pointer, if the secondary pointer has not been allocated
-(i.e. the list is empty) the first entry will be created and the
-primary pointer updated.
-
-\fBms_addselect_comp\fP is a wrapper of \fBms_addselect\fP used to add
-a selection entry to the \fIselections\fP list. The \fInet\fP,
-\fIsta\fP, \fIloc\fP, \fIchan\fP and \fIqual\fP source name components
-are used to create a \fIsrcname\fP. The name components may contain
-globbing characters for matching including wildcards and character
-sets, see \fBSRCNAME MATCHING\fP below. If a name component is not
-specified a wildard matching all entries will be subsituted,
-i.e. \fInet\fP==NULL will be interpreted to match all network codes.
-As a special case a \fIloc\fP value of "--" will be translated to and
-empty string to match the srcname representation of a blank
-(space-space) location ID.
-
-\fBms_readselectionsfile\fP reads a file containing a list of
-selections and adds them to the specified \fIselections\fP list. As
-with \fBms_addselect\fP if the selections list is empty it will be
-created. For more details see the \fBSELECTION FILE\fR section below.
-
-\fBms_freeselections\fP frees all memory associated with
-\fIselections\fP.
-
-\fBms_printselections\fP prints all of the entries in the
-\fIselections\fP list using the ms_log() facility.
-
-.SH RETURN VALUES
-The \fBms_matchselect\fP and \fBmsr_matchselect\fP routines return a
-pointer to the matching Selections entry on success and NULL when no
-match was found. These routines will also set the \fIppselecttime\fP
-pointer to the matching SelectTime entry if supplied.
-
-\fBms_addselect\fP and \fBms_addselect_comp\fP return 0 on success and
--1 on error.
-
-\fBms_readselectionsfile\fP returns the number of selections added to
-the list or -1 on error.
-
-.SH "SELECTION FILE"
-A selection file is used to match input data records based on network,
-station, location and channel information. Optionally a quality and
-time range may also be specified for more refined selection. The
-non-time fields may use the '*' wildcard to match multiple characters
-and the '?' wildcard to match single characters. Character sets may
-also be used, for example '[ENZ]' will match either E, N or Z.
-The '#' character indicates the remaining portion of the line will be
-ignored.
-
-Example selection file entries (the first four fields are required)
-.nf
-#net sta loc chan qual start end
-IU ANMO * BH?
-II * * * Q
-IU COLA 00 LH[ENZ] R
-IU COLA 00 LHZ * 2008,100,10,00,00 2008,100,10,30,00
-.fi
-
-.SH SRCNAME MATCHING
-Entries in a Selections list include a "source name" (srcname) string
-to represent matching parameters for network, station, location,
-channel and optionally the quality name components. Each name
-component may contain globbing characters to match more than one
-unique srcname.
-
-.nf
-Valid glob patterns include:
- * matches zero or more characters
- ? matches any single character
- [set] matches any character in the set
- [^set] matches any character NOT in the set
- where a set is a group of characters or ranges. a range
- is written as two characters separated with a hyphen:
- a-z denotes all characters between a to z inclusive.
- [-set] set matches a literal hyphen and any character in the set
- []set] matches a literal close bracket and any character in the set
-
- char matches itself except where char is '*' or '?' or '['
- \char matches char, including any pattern character
-
- examples:
- a*c ac abc abbc ...
- a?c acc abc aXc ...
- a[a-z]c aac abc acc ...
- a[-a-z]c a-c aac abc ...
-.fi
-
-.SH EXAMPLE USAGE
-The primary intention of the Selections list facility is to limit data
-to a specific selection as it's read into a program. This is
-illustrated below.
-
-.nf
-main() {
- MSRecord *msr = NULL;
- Selections *selections = NULL;
- hptime_t starttime;
- hptime_t endtime;
- int retcode;
-
- ms_addselect (&selections, "IU_*_*_LH?_?", HPTERROR, HPTERROR);
-
- starttime = timestr2hptime ("2009/1/15 00:00:00.00");
- endtime = timestr2hptime ("2009/1/31 23:59:59.99");
- ms_addselect (&selections, "IU_ANMO_00_LH?_?", starttime, endtime);
-
- while ( (retcode = ms_readmsr (&msr, filename, 0, NULL, NULL, 1, 0, verbose)) == MS_NOERROR )
- {
- /* Print details if data record matches selection criteria */
- if ( msr_matchselect (selections, msr, NULL) )
- {
- msr_print (msr, verbose);
- }
- }
-
- if ( retcode != MS_ENDOFFILE )
- ms_log (2, "Error reading input file %s: %s\\n",
- filename, ms_errorstr(retcode));
-
- /* Cleanup memory and close file */
- ms_readmsr (&msr, NULL, 0, NULL, NULL, 0, 0, verbose);
-} /* End of main() */
-.fi
-
-The following two calls are equivalent:
-.nf
- ms_addselect (&selections, "IU_ANMO_00_LH?_?", starttime, endtime);
- ms_addselect_comp (&selections, "IU", "ANMO", "00", "LH?", "?", startime, endtime);
-.fi
-
-As a further convienence usage of \fBms_readselectionsfile()\fP would
-allow the selections to be specified in a simple ASCII file and avoid
-the need to directly call \fBms_addselect()\fP.
-
-.SH SEE ALSO
-\fBmsr_srcname(3)\fP and \fBmst_srcname(3)\fP.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_printselections.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_printselections.3
new file mode 120000
index 000000000..d545f287c
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_printselections.3
@@ -0,0 +1 @@
+ms_selection.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_ratapprox.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_ratapprox.3
deleted file mode 100644
index 9cd795810..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_ratapprox.3
+++ /dev/null
@@ -1,54 +0,0 @@
-.TH MS_GENFACTMULT 3 2016/10/07 "Libmseed API"
-.SH NAME
-ms_genfactmult - Generate SEED sample rate factor and multiplier
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "int \fBms_genfactmult\fP ( double " samprate ", int16_t *" factor ",
-.BI " int16_t *" multiplier " );"
-
-.BI "int \fBms_ratapprox\fP ( double " real ", int *" num ", int *" den ",
-.BI " int " maxval ", double " precision " );"
-.fi
-
-.SH DESCRIPTION
-\fBms_genfactmult\fP generates an appropriate SEED sample rate
-\fIfactor\fP and \fImultiplier\fP pair from a double precision sample
-rate. If \fIsamprate\fP is positive it is expected to represent a
-rate in samples/second, if negative is is expected to represent a
-period in seconds/sample.
-
-Non-integer sample rates and periods are supported between 32767.0 and
-1/32767.0. An error will be returned for non-integer rates and
-periods outside this range.
-
-Integer sample rates and periods are supported between 1 and the
-maximum possible value (32767 * 32767). Values from 1 to 32767 are
-represented directly. Values larger than 32767 are factored and
-represented exactly when possible and approximated otherwise, with the
-discrepency becoming larger as the values reach the maximum possible
-value.
-
-The factor and multiplier are int16_t because that is the integer size
-needed for the fixed section of the SEED data header.
-
-\fBms_ratapprox\fP finds an approximate rational number for a real
-through continued fraction expansion. Given a double precision
-\fIreal\fP the routine tries to find a rational in numerator
-(\fInum\fP) and denominator (\fIden\fP) form whose absolute values are
-not larger than \fImaxval\fP while trying to reach a specified
-\fIprecision\fP.
-
-.SH RETURN VALUES
-\fBms_genfactmult\fP returns 0 on success and -1 when value is outside
-of the supported range or error.
-
-\fBms_ratapprox\fP returns the number of iterations performed.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_ratapprox.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_ratapprox.3
new file mode 120000
index 000000000..42f45e7e8
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_ratapprox.3
@@ -0,0 +1 @@
+ms_genfactmult.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_readleapsecondfile.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_readleapsecondfile.3
deleted file mode 100644
index d4f3c2da8..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_readleapsecondfile.3
+++ /dev/null
@@ -1,48 +0,0 @@
-.TH MS_READLEAPSECONDS 3 2016/10/01 "Libmseed API"
-.SH NAME
-ms_readleapseconds - Read a leap second file into a global buffer
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "int \fBms_readleapseconds\fP ( char *" envvarname " );"
-
-.BI "int \fBms_readleapsecondfile\fP ( char *" filename " );"
-.fi
-
-.SH DESCRIPTION
-These functions read a leap seconds file and store a list of leap
-seconds in an internal, global list. The leap seconds are used to
-determine the proper end time of a record (and consquently a trace).
-The use of this facility causes the leap second indication in the
-fixed section data header to be ignored.
-
-The \fBms_readleapseconds\fP function takes and environment variable
-name that is expected to contain the name of a leap seconds file. The
-\fBms_readleapsecondfile\fP function takes the name of a leap second
-file.
-
-.SH LEAP SECOND LIST FILE
-The leap second list file is expected to contain a list of leap second
-times and TAI-UTC difference values. The first column should be time
-stamps as seconds since the NTP epoch (Jan. 1 1900). The second
-column should be an integer number of seconds that specify the
-difference between TAI and UTC.
-
-Usually the most recent version of this file is available here:
-https://www.ietf.org/timezones/data/leap-seconds.list
-
-.SH RETURN VALUES
-\fBms_readleapseconds\fP returns the number of leap seconds read on
-success, -1 on file read errors and -2 when the environment variable
-is not set.
-
-\fBms_readleapsecondfile\fP returns the number leap seconds read on
-success and -1 on errors.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_readleapsecondfile.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_readleapsecondfile.3
new file mode 120000
index 000000000..c5fcda226
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_readleapsecondfile.3
@@ -0,0 +1 @@
+ms_readleapseconds.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_readmsr_r.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_readmsr_r.3
deleted file mode 100644
index 9ee763bc0..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_readmsr_r.3
+++ /dev/null
@@ -1,226 +0,0 @@
-.TH MS_READMSR 3 2011/01/06 "Libmseed API"
-.SH NAME
-ms_readmsr - Read Mini-SEED data from files
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "int \fBms_readmsr\fP ( MSRecord **ppmsr, char *" msfile ", int " reclen ","
-.BI " off_t *" fpos ", int *" last ", flag " skipnotdata ","
-.BI " flag " dataflag ",flag " verbose " );"
-
-.BI "int \fBms_readmsr_r\fP ( MSFileParam **ppmsfp, MSRecord **ppmsr, char *" msfile ","
-.BI " int " reclen ", off_t *" fpos ", int *" last ","
-.BI " flag " skipnotdata ", flag " dataflag ",flag " verbose " );"
-
-.BI "int \fBms_readtraces\fP ( MSTraceGroup **ppmstg, char *" msfile ", int " reclen ", "
-.BI " double " timetol ", double " sampratetol ","
-.BI " flag " dataquality ", flag " skipnotdata ","
-.BI " flag " dataflag ", flag " verbose " );"
-
-.BI "int \fBms_readtraces_timewin\fP ( MSTraceGroup **ppmstg, char *" msfile ","
-.BI " int " reclen ", double " timetol ", double " sampratetol ","
-.BI " hptime_t " starttime ", hptime_t " endtime ","
-.BI " flag " dataquality ", flag " skipnotdata ","
-.BI " flag " dataflag ", flag " verbose " );"
-
-.BI "int \fBms_readtraces_selection\fP ( MSTraceGroup **ppmstg, char *" msfile ","
-.BI " int " reclen ", double " timetol ", double " sampratetol ","
-.BI " Selections *" selections ", flag " dataquality ","
-.BI " flag " skipnotdata ", flag " dataflag ", flag " verbose " );"
-
-.BI "int \fBms_readtracelist\fP ( MSTraceList **ppmstl, char *" msfile ", int " reclen ","
-.BI " double " timetol ", double " sampratetol ","
-.BI " flag " dataquality ", flag " skipnotdata ","
-.BI " flag " dataflag ", flag " verbose " );"
-
-.BI "int \fBms_readtracelist_timewin\fP ( MSTraceList **ppmstl, char *" msfile ","
-.BI " int " reclen ", double " timetol ", double " sampratetol ","
-.BI " hptime_t " starttime ", hptime_t " endtime ","
-.BI " flag " dataquality ", flag " skipnotdata ","
-.BI " flag " dataflag ", flag " verbose " );"
-
-.BI "int \fBms_readtracelist_selection\fP ( MSTraceList **ppmstl, char *" msfile ","
-.BI " int " reclen ", double " timetol ", double " sampratetol ","
-.BI " Selections *" selections ", flag " dataquality ","
-.BI " flag " skipnotdata ", flag " dataflag ", flag " verbose " );"
-.fi
-
-.SH DESCRIPTION
-Both \fBms_readmsr\fP and \fBms_readmsr_r\fP will open and read, with
-subsequent calls, all Mini-SEED records from a specified file.
-Standard input will be opened if \fImsfile\fP is "-" (dash). As each
-record is read it is unpacked using \fBmsr_unpack(3)\fP. If the
-MSRecord struct at \fI*ppmsr\fP has not been initialized it must be
-set to NULL and it will be initialize it automatically.
-
-The \fBms_readmsr\fP version is not thread safe. The reentrant
-\fBms_readmsr_r\fP version is thread safe and can be used to read more
-than one file in parallel. \fBms_readmsr_r\fP stores all static file
-reading parameters in a MSFileParam struct. A pointer to this struct
-must be supplied by the caller (\fIppmsfp\fP), memory will be
-allocated on the initial call if the pointer is NULL.
-
-If \fIreclen\fP is 0 or negative the length of every record is
-automatically detected. For auto length detection records are first
-searched for a Blockette 1000 and if none is found a search is
-conducted for the next valid record header (the existence of the next
-record or end-of-file implying the length of the current record).
-
-If the \fIfpos\fP pointer is not NULL the value will be set to the
-file position (offset from the beginning in bytes) from where the
-returned record was read. As a special case, if \fIfpos\fP is not
-NULL and the value it points to is less than zero it will be
-interpreted as the (positive) offset in the file at which to begin
-reading data; this feature does not work with packed files.
-
-If the \fIlast\fP pointer is not NULL the value will be set to 1 when
-the record at the end of the file is being returned, otherwise it will
-be 0. This indicator will not be set when the last valid record in
-the file is followed by padding.
-
-If the \fIskipnotdata\fP flag is true (not 0) any data chunks read
-that do not have valid data record indicators (i.e. D, R, or Q) will
-be skipped.
-
-The \fIdataflag\fP argument is passed directly to \fBmsr_unpack(3)\fP
-and controls whether data samples are unpacked.
-
-After reading all the input records the controlling program should
-call it one last time with \fImsfile\fP set to NULL. This will close
-the file and cleanup allocated memory.
-
-If \fBms_readmsr\fP or \fBms_readmsr_r\fP are called with a different
-file than the one they currently have open they will close the
-currently open file, open the new file and print an error message.
-Properly coded applications should reset the function when the end of
-file has been reached as described above and not rely on this
-behavior.
-
-The \fBms_readtraces\fP and \fBms_readtracelist\fP routines read all
-Mini-SEED records from a file using \fBms_readmsr_r\fP and adds each
-one to either a MSTraceGroup or MSTraceList using
-\fBmst_addmsrtogroup(3)\fP and \fBmstl_addmsr(3)\fP respectively. The
-\fImsfile\fP, \fIreclen\fP, \fIskipnotdata\fP and \fIdataflag\fP
-arguments are passed directly to \fBms_readmsr_r\fP. The
-\fItimetol\fP, \fIsampratetol\fP and \fIdataquality\fP arguments are
-passed directly to \fBmst_addmsrtogroup(3)\fP or \fBmstl_addmsr(3)\fP.
-If the pointer to the MSTraceGroup or MSTraceList struct has not been
-initialized it must be set to NULL and it will be initialize
-automatically. The MSTraceGroup or MSTraceList structures may already
-contain entries and will be added to by these routines. These
-routines are thread safe.
-
-The \fBms_readtraces_timewin\fP and \fBms_readtracelist_timewin\fP
-routines perform the same function as \fBms_readtraces\fP and
-\fBms_readtracelist\fP but will limit the data to records containing
-samples between the specified \fIstarttime\fP and \fIendtime\fP.
-
-The \fBms_readtraces_selection\fP and \fBms_readtracelist_selection\fP
-routines perform the same function as \fBms_readtraces\fP and
-\fBms_readtracelist\fP but will limit the data to records that match
-the specified \fIselections\fP. Selections include criteria for
-source name and time window parameters, see \fBms_selection(3)\fP for
-more information.
-
-.SH RETURN VALUES
-On the successful read and parsing of a record \fBms_readmsr\fP and
-\fBms_readmsr_r\fP return MS_NOERROR and populate the MSRecord struct
-at \fI*ppmsr\fP. Upon reaching the end of the input file these
-routines return MS_ENDOFFILE. On error these routines return a
-libmseed error code (defined in libmseed.h)
-
-On the successful read and parsing of a file \fBms_readtraces\fP and
-\fBms_readtracelist\fP return MS_NOERROR and populate the MSTraceGroup
-or MSTraceList struct. On error these routines return a libmseed
-error code (defined in libmseed.h)
-
-.SH PACKED FILES
-\fBms_readmsr\fP, \fBms_readtraces\fP and \fBms_readtracelist\fP will
-read packed Mini-SEED files. Packed Mini-SEED is the indexed archive
-format used internally at the IRIS Data Management Center and probably
-not used anywhere else.
-
-.SH EXAMPLE
-Skeleton code for reading a file with \fBms_readmsr(3)\fP:
-
-.nf
-main() {
- MSRecord *msr = NULL;
- int retcode;
-
- while ( (retcode = ms_readmsr (&msr, filename, 0, NULL, NULL, 1, 0, verbose)) == MS_NOERROR )
- {
- /* Do something with the record here, e.g. print */
- msr_print (msr, verbose);
- }
-
- if ( retcode != MS_ENDOFFILE )
- ms_log (2, "Error reading input file %s: %s\\n", filename, ms_errorstr(retcode));
-
- /* Cleanup memory and close file */
- ms_readmsr (&msr, NULL, 0, NULL, NULL, 0, 0, verbose);
-}
-
-For reading a file with the thread safe \fBms_readmsr_r(3)\fP:
-
-.nf
-main() {
- MSRecord *msr = NULL;
- MSFileParam *msfp = NULL;
- int retcode;
-
- while ( (retcode = ms_readmsr_r (&msfp, &msr, filename, 0, NULL, NULL, 1, 0, verbose)) == MS_NOERROR )
- {
- /* Do something with the record here, e.g. print */
- msr_print (msr, verbose);
- }
-
- if ( retcode != MS_ENDOFFILE )
- ms_log (2, "Error reading input file %s: %s\\n", filename, ms_errorstr(retcode));
-
- /* Cleanup memory and close file */
- ms_readmsr_r (&msfp, &msr, NULL, 0, NULL, NULL, 0, 0, verbose);
-}
-
-.fi
-For reading a file with \fBms_readtraces(3)\fP:
-.nf
-
-main() {
- MSTraceList *mstl = NULL;
- int retcode;
-
- retcode = ms_readtracelist (&mstl, filename, 0, -1.0, -1.0, 0, 1, 0, verbose);
-
- if ( retcode != MS_NOERROR )
- ms_log (2, "Error reading input file %s: %s\\n", filename, ms_errorstr(retcode));
-
- retcode = ms_readtracelist (&mstl, filename2, 0, -1.0, -1.0, 0, 1, 0, verbose);
-
- if ( retcode != MS_NOERROR )
- ms_log (2, "Error reading input file %s: %s\\n", filename2, ms_errorstr(retcode));
-
- if ( ! mstl )
- {
- ms_log (2, "Error reading file\\n");
- return -1;
- }
-
- /* Do something with the traces here, e.g. print */
- mstl_printtracelist (mstl, 0, verbose, 0);
-
- mstl_free (&mstl);
-}
-.fi
-
-.SH SEE ALSO
-\fBms_intro(3)\fP, \fBmsr_unpack(3)\fP, \fBmst_addmsrtogroup(3)\fP,
-\fBmstl_addmsr(3)\fP, \fBms_log(3)\fP and \fBms_errorstr(3)\fP.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_readmsr_r.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_readmsr_r.3
new file mode 120000
index 000000000..45b3fc314
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_readmsr_r.3
@@ -0,0 +1 @@
+ms_readmsr.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_readselectionsfile.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_readselectionsfile.3
deleted file mode 100644
index 625b2cd3b..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_readselectionsfile.3
+++ /dev/null
@@ -1,196 +0,0 @@
-.TH MS_SELECTION 3 2012/12/28 "Libmseed API"
-.SH NAME
-ms_selection - Routines to manage and use data selection lists.
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "Selections *\fBms_matchselect\fP ( Selections *" selections ", char *" srcname ","
-.BI " hptime_t " starttime ", hptime_t " endtime ","
-.BI " SelectTime **" ppselecttime " );"
-
-.BI "Selections *\fBmsr_matchselect\fP ( Selections *" selections ", MSRecord *" msr ","
-.BI " SelectTime **" ppselecttime " );"
-
-.BI "int \fBms_addselect\fP ( Selections **" ppselections ", char *" srcname ","
-.BI " hptime_t " starttime ", hptime_t " endtime " );"
-
-.BI "int \fBms_addselect_comp\fP ( Selections **" ppselections ", char *" net ","
-.BI " char *" sta ", char *" loc ", char *" chan ", char *" qual ","
-.BI " hptime_t " starttime ", hptime_t " endtime " );"
-
-.BI "int \fBms_readselectionsfile\fP ( Selections **" ppselections ", char *" filename " );"
-
-.BI "void \fBms_freeselections\fP ( Selections *" selections " );"
-
-.BI "void \fBms_printselections\fP ( Selections *" selections " );"
-.fi
-
-.SH DESCRIPTION
-These routines serve as a convienence facility for creating a list of
-data selections and using it to match data. The selection criteria
-are the \fIsrcname\fP and optional start and end times. The
-\fIsrcname\fP components in a selection may contain globbing
-characters for matching (wildcards, character range, etc.). A
-\fIsrcname\fP is generally composed of network, station, location,
-channel and optional quality components; normally these are created
-with \fBmsr_srcname(3)\fP and \fBmst_srcname(3)\fP.
-
-\fBms_matchselect\fP checks for an entry in the \fPselections\fP list
-that matches the supplied \fIsrcname\fP and optionally \fIstarttime\fP
-and \fIendtime\fP. The start and/or end times can be set to HTPERROR
-to mean "any" time. A selection will match the specified time range
-if there is any overlap in time coverage. If the \fIppselecttime\fP
-pointer is not NULL it will be set to the matching SelectTime entry.
-
-\fBmsr_matchselect\fP is a simple wrapper to call \fBms_matchselect\fP
-using the details from a specified MSRecord.
-
-\fBms_addselect\fP adds a selection entry to the \fIselections\fP list
-based on the \fsrcname\fP and the \fIstarttime\fP and \fIendtime\fP
-boundaries. The source name components may contain globbing
-characters for matching including wildcards and character sets, see
-\fBSRCNAME MATCHING\fP below. Note that the \fIppselections\fP is a
-pointer to a pointer, if the secondary pointer has not been allocated
-(i.e. the list is empty) the first entry will be created and the
-primary pointer updated.
-
-\fBms_addselect_comp\fP is a wrapper of \fBms_addselect\fP used to add
-a selection entry to the \fIselections\fP list. The \fInet\fP,
-\fIsta\fP, \fIloc\fP, \fIchan\fP and \fIqual\fP source name components
-are used to create a \fIsrcname\fP. The name components may contain
-globbing characters for matching including wildcards and character
-sets, see \fBSRCNAME MATCHING\fP below. If a name component is not
-specified a wildard matching all entries will be subsituted,
-i.e. \fInet\fP==NULL will be interpreted to match all network codes.
-As a special case a \fIloc\fP value of "--" will be translated to and
-empty string to match the srcname representation of a blank
-(space-space) location ID.
-
-\fBms_readselectionsfile\fP reads a file containing a list of
-selections and adds them to the specified \fIselections\fP list. As
-with \fBms_addselect\fP if the selections list is empty it will be
-created. For more details see the \fBSELECTION FILE\fR section below.
-
-\fBms_freeselections\fP frees all memory associated with
-\fIselections\fP.
-
-\fBms_printselections\fP prints all of the entries in the
-\fIselections\fP list using the ms_log() facility.
-
-.SH RETURN VALUES
-The \fBms_matchselect\fP and \fBmsr_matchselect\fP routines return a
-pointer to the matching Selections entry on success and NULL when no
-match was found. These routines will also set the \fIppselecttime\fP
-pointer to the matching SelectTime entry if supplied.
-
-\fBms_addselect\fP and \fBms_addselect_comp\fP return 0 on success and
--1 on error.
-
-\fBms_readselectionsfile\fP returns the number of selections added to
-the list or -1 on error.
-
-.SH "SELECTION FILE"
-A selection file is used to match input data records based on network,
-station, location and channel information. Optionally a quality and
-time range may also be specified for more refined selection. The
-non-time fields may use the '*' wildcard to match multiple characters
-and the '?' wildcard to match single characters. Character sets may
-also be used, for example '[ENZ]' will match either E, N or Z.
-The '#' character indicates the remaining portion of the line will be
-ignored.
-
-Example selection file entries (the first four fields are required)
-.nf
-#net sta loc chan qual start end
-IU ANMO * BH?
-II * * * Q
-IU COLA 00 LH[ENZ] R
-IU COLA 00 LHZ * 2008,100,10,00,00 2008,100,10,30,00
-.fi
-
-.SH SRCNAME MATCHING
-Entries in a Selections list include a "source name" (srcname) string
-to represent matching parameters for network, station, location,
-channel and optionally the quality name components. Each name
-component may contain globbing characters to match more than one
-unique srcname.
-
-.nf
-Valid glob patterns include:
- * matches zero or more characters
- ? matches any single character
- [set] matches any character in the set
- [^set] matches any character NOT in the set
- where a set is a group of characters or ranges. a range
- is written as two characters separated with a hyphen:
- a-z denotes all characters between a to z inclusive.
- [-set] set matches a literal hyphen and any character in the set
- []set] matches a literal close bracket and any character in the set
-
- char matches itself except where char is '*' or '?' or '['
- \char matches char, including any pattern character
-
- examples:
- a*c ac abc abbc ...
- a?c acc abc aXc ...
- a[a-z]c aac abc acc ...
- a[-a-z]c a-c aac abc ...
-.fi
-
-.SH EXAMPLE USAGE
-The primary intention of the Selections list facility is to limit data
-to a specific selection as it's read into a program. This is
-illustrated below.
-
-.nf
-main() {
- MSRecord *msr = NULL;
- Selections *selections = NULL;
- hptime_t starttime;
- hptime_t endtime;
- int retcode;
-
- ms_addselect (&selections, "IU_*_*_LH?_?", HPTERROR, HPTERROR);
-
- starttime = timestr2hptime ("2009/1/15 00:00:00.00");
- endtime = timestr2hptime ("2009/1/31 23:59:59.99");
- ms_addselect (&selections, "IU_ANMO_00_LH?_?", starttime, endtime);
-
- while ( (retcode = ms_readmsr (&msr, filename, 0, NULL, NULL, 1, 0, verbose)) == MS_NOERROR )
- {
- /* Print details if data record matches selection criteria */
- if ( msr_matchselect (selections, msr, NULL) )
- {
- msr_print (msr, verbose);
- }
- }
-
- if ( retcode != MS_ENDOFFILE )
- ms_log (2, "Error reading input file %s: %s\\n",
- filename, ms_errorstr(retcode));
-
- /* Cleanup memory and close file */
- ms_readmsr (&msr, NULL, 0, NULL, NULL, 0, 0, verbose);
-} /* End of main() */
-.fi
-
-The following two calls are equivalent:
-.nf
- ms_addselect (&selections, "IU_ANMO_00_LH?_?", starttime, endtime);
- ms_addselect_comp (&selections, "IU", "ANMO", "00", "LH?", "?", startime, endtime);
-.fi
-
-As a further convienence usage of \fBms_readselectionsfile()\fP would
-allow the selections to be specified in a simple ASCII file and avoid
-the need to directly call \fBms_addselect()\fP.
-
-.SH SEE ALSO
-\fBmsr_srcname(3)\fP and \fBmst_srcname(3)\fP.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_readselectionsfile.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_readselectionsfile.3
new file mode 120000
index 000000000..d545f287c
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_readselectionsfile.3
@@ -0,0 +1 @@
+ms_selection.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_readtracelist.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_readtracelist.3
deleted file mode 100644
index 9ee763bc0..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_readtracelist.3
+++ /dev/null
@@ -1,226 +0,0 @@
-.TH MS_READMSR 3 2011/01/06 "Libmseed API"
-.SH NAME
-ms_readmsr - Read Mini-SEED data from files
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "int \fBms_readmsr\fP ( MSRecord **ppmsr, char *" msfile ", int " reclen ","
-.BI " off_t *" fpos ", int *" last ", flag " skipnotdata ","
-.BI " flag " dataflag ",flag " verbose " );"
-
-.BI "int \fBms_readmsr_r\fP ( MSFileParam **ppmsfp, MSRecord **ppmsr, char *" msfile ","
-.BI " int " reclen ", off_t *" fpos ", int *" last ","
-.BI " flag " skipnotdata ", flag " dataflag ",flag " verbose " );"
-
-.BI "int \fBms_readtraces\fP ( MSTraceGroup **ppmstg, char *" msfile ", int " reclen ", "
-.BI " double " timetol ", double " sampratetol ","
-.BI " flag " dataquality ", flag " skipnotdata ","
-.BI " flag " dataflag ", flag " verbose " );"
-
-.BI "int \fBms_readtraces_timewin\fP ( MSTraceGroup **ppmstg, char *" msfile ","
-.BI " int " reclen ", double " timetol ", double " sampratetol ","
-.BI " hptime_t " starttime ", hptime_t " endtime ","
-.BI " flag " dataquality ", flag " skipnotdata ","
-.BI " flag " dataflag ", flag " verbose " );"
-
-.BI "int \fBms_readtraces_selection\fP ( MSTraceGroup **ppmstg, char *" msfile ","
-.BI " int " reclen ", double " timetol ", double " sampratetol ","
-.BI " Selections *" selections ", flag " dataquality ","
-.BI " flag " skipnotdata ", flag " dataflag ", flag " verbose " );"
-
-.BI "int \fBms_readtracelist\fP ( MSTraceList **ppmstl, char *" msfile ", int " reclen ","
-.BI " double " timetol ", double " sampratetol ","
-.BI " flag " dataquality ", flag " skipnotdata ","
-.BI " flag " dataflag ", flag " verbose " );"
-
-.BI "int \fBms_readtracelist_timewin\fP ( MSTraceList **ppmstl, char *" msfile ","
-.BI " int " reclen ", double " timetol ", double " sampratetol ","
-.BI " hptime_t " starttime ", hptime_t " endtime ","
-.BI " flag " dataquality ", flag " skipnotdata ","
-.BI " flag " dataflag ", flag " verbose " );"
-
-.BI "int \fBms_readtracelist_selection\fP ( MSTraceList **ppmstl, char *" msfile ","
-.BI " int " reclen ", double " timetol ", double " sampratetol ","
-.BI " Selections *" selections ", flag " dataquality ","
-.BI " flag " skipnotdata ", flag " dataflag ", flag " verbose " );"
-.fi
-
-.SH DESCRIPTION
-Both \fBms_readmsr\fP and \fBms_readmsr_r\fP will open and read, with
-subsequent calls, all Mini-SEED records from a specified file.
-Standard input will be opened if \fImsfile\fP is "-" (dash). As each
-record is read it is unpacked using \fBmsr_unpack(3)\fP. If the
-MSRecord struct at \fI*ppmsr\fP has not been initialized it must be
-set to NULL and it will be initialize it automatically.
-
-The \fBms_readmsr\fP version is not thread safe. The reentrant
-\fBms_readmsr_r\fP version is thread safe and can be used to read more
-than one file in parallel. \fBms_readmsr_r\fP stores all static file
-reading parameters in a MSFileParam struct. A pointer to this struct
-must be supplied by the caller (\fIppmsfp\fP), memory will be
-allocated on the initial call if the pointer is NULL.
-
-If \fIreclen\fP is 0 or negative the length of every record is
-automatically detected. For auto length detection records are first
-searched for a Blockette 1000 and if none is found a search is
-conducted for the next valid record header (the existence of the next
-record or end-of-file implying the length of the current record).
-
-If the \fIfpos\fP pointer is not NULL the value will be set to the
-file position (offset from the beginning in bytes) from where the
-returned record was read. As a special case, if \fIfpos\fP is not
-NULL and the value it points to is less than zero it will be
-interpreted as the (positive) offset in the file at which to begin
-reading data; this feature does not work with packed files.
-
-If the \fIlast\fP pointer is not NULL the value will be set to 1 when
-the record at the end of the file is being returned, otherwise it will
-be 0. This indicator will not be set when the last valid record in
-the file is followed by padding.
-
-If the \fIskipnotdata\fP flag is true (not 0) any data chunks read
-that do not have valid data record indicators (i.e. D, R, or Q) will
-be skipped.
-
-The \fIdataflag\fP argument is passed directly to \fBmsr_unpack(3)\fP
-and controls whether data samples are unpacked.
-
-After reading all the input records the controlling program should
-call it one last time with \fImsfile\fP set to NULL. This will close
-the file and cleanup allocated memory.
-
-If \fBms_readmsr\fP or \fBms_readmsr_r\fP are called with a different
-file than the one they currently have open they will close the
-currently open file, open the new file and print an error message.
-Properly coded applications should reset the function when the end of
-file has been reached as described above and not rely on this
-behavior.
-
-The \fBms_readtraces\fP and \fBms_readtracelist\fP routines read all
-Mini-SEED records from a file using \fBms_readmsr_r\fP and adds each
-one to either a MSTraceGroup or MSTraceList using
-\fBmst_addmsrtogroup(3)\fP and \fBmstl_addmsr(3)\fP respectively. The
-\fImsfile\fP, \fIreclen\fP, \fIskipnotdata\fP and \fIdataflag\fP
-arguments are passed directly to \fBms_readmsr_r\fP. The
-\fItimetol\fP, \fIsampratetol\fP and \fIdataquality\fP arguments are
-passed directly to \fBmst_addmsrtogroup(3)\fP or \fBmstl_addmsr(3)\fP.
-If the pointer to the MSTraceGroup or MSTraceList struct has not been
-initialized it must be set to NULL and it will be initialize
-automatically. The MSTraceGroup or MSTraceList structures may already
-contain entries and will be added to by these routines. These
-routines are thread safe.
-
-The \fBms_readtraces_timewin\fP and \fBms_readtracelist_timewin\fP
-routines perform the same function as \fBms_readtraces\fP and
-\fBms_readtracelist\fP but will limit the data to records containing
-samples between the specified \fIstarttime\fP and \fIendtime\fP.
-
-The \fBms_readtraces_selection\fP and \fBms_readtracelist_selection\fP
-routines perform the same function as \fBms_readtraces\fP and
-\fBms_readtracelist\fP but will limit the data to records that match
-the specified \fIselections\fP. Selections include criteria for
-source name and time window parameters, see \fBms_selection(3)\fP for
-more information.
-
-.SH RETURN VALUES
-On the successful read and parsing of a record \fBms_readmsr\fP and
-\fBms_readmsr_r\fP return MS_NOERROR and populate the MSRecord struct
-at \fI*ppmsr\fP. Upon reaching the end of the input file these
-routines return MS_ENDOFFILE. On error these routines return a
-libmseed error code (defined in libmseed.h)
-
-On the successful read and parsing of a file \fBms_readtraces\fP and
-\fBms_readtracelist\fP return MS_NOERROR and populate the MSTraceGroup
-or MSTraceList struct. On error these routines return a libmseed
-error code (defined in libmseed.h)
-
-.SH PACKED FILES
-\fBms_readmsr\fP, \fBms_readtraces\fP and \fBms_readtracelist\fP will
-read packed Mini-SEED files. Packed Mini-SEED is the indexed archive
-format used internally at the IRIS Data Management Center and probably
-not used anywhere else.
-
-.SH EXAMPLE
-Skeleton code for reading a file with \fBms_readmsr(3)\fP:
-
-.nf
-main() {
- MSRecord *msr = NULL;
- int retcode;
-
- while ( (retcode = ms_readmsr (&msr, filename, 0, NULL, NULL, 1, 0, verbose)) == MS_NOERROR )
- {
- /* Do something with the record here, e.g. print */
- msr_print (msr, verbose);
- }
-
- if ( retcode != MS_ENDOFFILE )
- ms_log (2, "Error reading input file %s: %s\\n", filename, ms_errorstr(retcode));
-
- /* Cleanup memory and close file */
- ms_readmsr (&msr, NULL, 0, NULL, NULL, 0, 0, verbose);
-}
-
-For reading a file with the thread safe \fBms_readmsr_r(3)\fP:
-
-.nf
-main() {
- MSRecord *msr = NULL;
- MSFileParam *msfp = NULL;
- int retcode;
-
- while ( (retcode = ms_readmsr_r (&msfp, &msr, filename, 0, NULL, NULL, 1, 0, verbose)) == MS_NOERROR )
- {
- /* Do something with the record here, e.g. print */
- msr_print (msr, verbose);
- }
-
- if ( retcode != MS_ENDOFFILE )
- ms_log (2, "Error reading input file %s: %s\\n", filename, ms_errorstr(retcode));
-
- /* Cleanup memory and close file */
- ms_readmsr_r (&msfp, &msr, NULL, 0, NULL, NULL, 0, 0, verbose);
-}
-
-.fi
-For reading a file with \fBms_readtraces(3)\fP:
-.nf
-
-main() {
- MSTraceList *mstl = NULL;
- int retcode;
-
- retcode = ms_readtracelist (&mstl, filename, 0, -1.0, -1.0, 0, 1, 0, verbose);
-
- if ( retcode != MS_NOERROR )
- ms_log (2, "Error reading input file %s: %s\\n", filename, ms_errorstr(retcode));
-
- retcode = ms_readtracelist (&mstl, filename2, 0, -1.0, -1.0, 0, 1, 0, verbose);
-
- if ( retcode != MS_NOERROR )
- ms_log (2, "Error reading input file %s: %s\\n", filename2, ms_errorstr(retcode));
-
- if ( ! mstl )
- {
- ms_log (2, "Error reading file\\n");
- return -1;
- }
-
- /* Do something with the traces here, e.g. print */
- mstl_printtracelist (mstl, 0, verbose, 0);
-
- mstl_free (&mstl);
-}
-.fi
-
-.SH SEE ALSO
-\fBms_intro(3)\fP, \fBmsr_unpack(3)\fP, \fBmst_addmsrtogroup(3)\fP,
-\fBmstl_addmsr(3)\fP, \fBms_log(3)\fP and \fBms_errorstr(3)\fP.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_readtracelist.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_readtracelist.3
new file mode 120000
index 000000000..45b3fc314
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_readtracelist.3
@@ -0,0 +1 @@
+ms_readmsr.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_readtracelist_selection.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_readtracelist_selection.3
deleted file mode 100644
index 9ee763bc0..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_readtracelist_selection.3
+++ /dev/null
@@ -1,226 +0,0 @@
-.TH MS_READMSR 3 2011/01/06 "Libmseed API"
-.SH NAME
-ms_readmsr - Read Mini-SEED data from files
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "int \fBms_readmsr\fP ( MSRecord **ppmsr, char *" msfile ", int " reclen ","
-.BI " off_t *" fpos ", int *" last ", flag " skipnotdata ","
-.BI " flag " dataflag ",flag " verbose " );"
-
-.BI "int \fBms_readmsr_r\fP ( MSFileParam **ppmsfp, MSRecord **ppmsr, char *" msfile ","
-.BI " int " reclen ", off_t *" fpos ", int *" last ","
-.BI " flag " skipnotdata ", flag " dataflag ",flag " verbose " );"
-
-.BI "int \fBms_readtraces\fP ( MSTraceGroup **ppmstg, char *" msfile ", int " reclen ", "
-.BI " double " timetol ", double " sampratetol ","
-.BI " flag " dataquality ", flag " skipnotdata ","
-.BI " flag " dataflag ", flag " verbose " );"
-
-.BI "int \fBms_readtraces_timewin\fP ( MSTraceGroup **ppmstg, char *" msfile ","
-.BI " int " reclen ", double " timetol ", double " sampratetol ","
-.BI " hptime_t " starttime ", hptime_t " endtime ","
-.BI " flag " dataquality ", flag " skipnotdata ","
-.BI " flag " dataflag ", flag " verbose " );"
-
-.BI "int \fBms_readtraces_selection\fP ( MSTraceGroup **ppmstg, char *" msfile ","
-.BI " int " reclen ", double " timetol ", double " sampratetol ","
-.BI " Selections *" selections ", flag " dataquality ","
-.BI " flag " skipnotdata ", flag " dataflag ", flag " verbose " );"
-
-.BI "int \fBms_readtracelist\fP ( MSTraceList **ppmstl, char *" msfile ", int " reclen ","
-.BI " double " timetol ", double " sampratetol ","
-.BI " flag " dataquality ", flag " skipnotdata ","
-.BI " flag " dataflag ", flag " verbose " );"
-
-.BI "int \fBms_readtracelist_timewin\fP ( MSTraceList **ppmstl, char *" msfile ","
-.BI " int " reclen ", double " timetol ", double " sampratetol ","
-.BI " hptime_t " starttime ", hptime_t " endtime ","
-.BI " flag " dataquality ", flag " skipnotdata ","
-.BI " flag " dataflag ", flag " verbose " );"
-
-.BI "int \fBms_readtracelist_selection\fP ( MSTraceList **ppmstl, char *" msfile ","
-.BI " int " reclen ", double " timetol ", double " sampratetol ","
-.BI " Selections *" selections ", flag " dataquality ","
-.BI " flag " skipnotdata ", flag " dataflag ", flag " verbose " );"
-.fi
-
-.SH DESCRIPTION
-Both \fBms_readmsr\fP and \fBms_readmsr_r\fP will open and read, with
-subsequent calls, all Mini-SEED records from a specified file.
-Standard input will be opened if \fImsfile\fP is "-" (dash). As each
-record is read it is unpacked using \fBmsr_unpack(3)\fP. If the
-MSRecord struct at \fI*ppmsr\fP has not been initialized it must be
-set to NULL and it will be initialize it automatically.
-
-The \fBms_readmsr\fP version is not thread safe. The reentrant
-\fBms_readmsr_r\fP version is thread safe and can be used to read more
-than one file in parallel. \fBms_readmsr_r\fP stores all static file
-reading parameters in a MSFileParam struct. A pointer to this struct
-must be supplied by the caller (\fIppmsfp\fP), memory will be
-allocated on the initial call if the pointer is NULL.
-
-If \fIreclen\fP is 0 or negative the length of every record is
-automatically detected. For auto length detection records are first
-searched for a Blockette 1000 and if none is found a search is
-conducted for the next valid record header (the existence of the next
-record or end-of-file implying the length of the current record).
-
-If the \fIfpos\fP pointer is not NULL the value will be set to the
-file position (offset from the beginning in bytes) from where the
-returned record was read. As a special case, if \fIfpos\fP is not
-NULL and the value it points to is less than zero it will be
-interpreted as the (positive) offset in the file at which to begin
-reading data; this feature does not work with packed files.
-
-If the \fIlast\fP pointer is not NULL the value will be set to 1 when
-the record at the end of the file is being returned, otherwise it will
-be 0. This indicator will not be set when the last valid record in
-the file is followed by padding.
-
-If the \fIskipnotdata\fP flag is true (not 0) any data chunks read
-that do not have valid data record indicators (i.e. D, R, or Q) will
-be skipped.
-
-The \fIdataflag\fP argument is passed directly to \fBmsr_unpack(3)\fP
-and controls whether data samples are unpacked.
-
-After reading all the input records the controlling program should
-call it one last time with \fImsfile\fP set to NULL. This will close
-the file and cleanup allocated memory.
-
-If \fBms_readmsr\fP or \fBms_readmsr_r\fP are called with a different
-file than the one they currently have open they will close the
-currently open file, open the new file and print an error message.
-Properly coded applications should reset the function when the end of
-file has been reached as described above and not rely on this
-behavior.
-
-The \fBms_readtraces\fP and \fBms_readtracelist\fP routines read all
-Mini-SEED records from a file using \fBms_readmsr_r\fP and adds each
-one to either a MSTraceGroup or MSTraceList using
-\fBmst_addmsrtogroup(3)\fP and \fBmstl_addmsr(3)\fP respectively. The
-\fImsfile\fP, \fIreclen\fP, \fIskipnotdata\fP and \fIdataflag\fP
-arguments are passed directly to \fBms_readmsr_r\fP. The
-\fItimetol\fP, \fIsampratetol\fP and \fIdataquality\fP arguments are
-passed directly to \fBmst_addmsrtogroup(3)\fP or \fBmstl_addmsr(3)\fP.
-If the pointer to the MSTraceGroup or MSTraceList struct has not been
-initialized it must be set to NULL and it will be initialize
-automatically. The MSTraceGroup or MSTraceList structures may already
-contain entries and will be added to by these routines. These
-routines are thread safe.
-
-The \fBms_readtraces_timewin\fP and \fBms_readtracelist_timewin\fP
-routines perform the same function as \fBms_readtraces\fP and
-\fBms_readtracelist\fP but will limit the data to records containing
-samples between the specified \fIstarttime\fP and \fIendtime\fP.
-
-The \fBms_readtraces_selection\fP and \fBms_readtracelist_selection\fP
-routines perform the same function as \fBms_readtraces\fP and
-\fBms_readtracelist\fP but will limit the data to records that match
-the specified \fIselections\fP. Selections include criteria for
-source name and time window parameters, see \fBms_selection(3)\fP for
-more information.
-
-.SH RETURN VALUES
-On the successful read and parsing of a record \fBms_readmsr\fP and
-\fBms_readmsr_r\fP return MS_NOERROR and populate the MSRecord struct
-at \fI*ppmsr\fP. Upon reaching the end of the input file these
-routines return MS_ENDOFFILE. On error these routines return a
-libmseed error code (defined in libmseed.h)
-
-On the successful read and parsing of a file \fBms_readtraces\fP and
-\fBms_readtracelist\fP return MS_NOERROR and populate the MSTraceGroup
-or MSTraceList struct. On error these routines return a libmseed
-error code (defined in libmseed.h)
-
-.SH PACKED FILES
-\fBms_readmsr\fP, \fBms_readtraces\fP and \fBms_readtracelist\fP will
-read packed Mini-SEED files. Packed Mini-SEED is the indexed archive
-format used internally at the IRIS Data Management Center and probably
-not used anywhere else.
-
-.SH EXAMPLE
-Skeleton code for reading a file with \fBms_readmsr(3)\fP:
-
-.nf
-main() {
- MSRecord *msr = NULL;
- int retcode;
-
- while ( (retcode = ms_readmsr (&msr, filename, 0, NULL, NULL, 1, 0, verbose)) == MS_NOERROR )
- {
- /* Do something with the record here, e.g. print */
- msr_print (msr, verbose);
- }
-
- if ( retcode != MS_ENDOFFILE )
- ms_log (2, "Error reading input file %s: %s\\n", filename, ms_errorstr(retcode));
-
- /* Cleanup memory and close file */
- ms_readmsr (&msr, NULL, 0, NULL, NULL, 0, 0, verbose);
-}
-
-For reading a file with the thread safe \fBms_readmsr_r(3)\fP:
-
-.nf
-main() {
- MSRecord *msr = NULL;
- MSFileParam *msfp = NULL;
- int retcode;
-
- while ( (retcode = ms_readmsr_r (&msfp, &msr, filename, 0, NULL, NULL, 1, 0, verbose)) == MS_NOERROR )
- {
- /* Do something with the record here, e.g. print */
- msr_print (msr, verbose);
- }
-
- if ( retcode != MS_ENDOFFILE )
- ms_log (2, "Error reading input file %s: %s\\n", filename, ms_errorstr(retcode));
-
- /* Cleanup memory and close file */
- ms_readmsr_r (&msfp, &msr, NULL, 0, NULL, NULL, 0, 0, verbose);
-}
-
-.fi
-For reading a file with \fBms_readtraces(3)\fP:
-.nf
-
-main() {
- MSTraceList *mstl = NULL;
- int retcode;
-
- retcode = ms_readtracelist (&mstl, filename, 0, -1.0, -1.0, 0, 1, 0, verbose);
-
- if ( retcode != MS_NOERROR )
- ms_log (2, "Error reading input file %s: %s\\n", filename, ms_errorstr(retcode));
-
- retcode = ms_readtracelist (&mstl, filename2, 0, -1.0, -1.0, 0, 1, 0, verbose);
-
- if ( retcode != MS_NOERROR )
- ms_log (2, "Error reading input file %s: %s\\n", filename2, ms_errorstr(retcode));
-
- if ( ! mstl )
- {
- ms_log (2, "Error reading file\\n");
- return -1;
- }
-
- /* Do something with the traces here, e.g. print */
- mstl_printtracelist (mstl, 0, verbose, 0);
-
- mstl_free (&mstl);
-}
-.fi
-
-.SH SEE ALSO
-\fBms_intro(3)\fP, \fBmsr_unpack(3)\fP, \fBmst_addmsrtogroup(3)\fP,
-\fBmstl_addmsr(3)\fP, \fBms_log(3)\fP and \fBms_errorstr(3)\fP.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_readtracelist_selection.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_readtracelist_selection.3
new file mode 120000
index 000000000..45b3fc314
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_readtracelist_selection.3
@@ -0,0 +1 @@
+ms_readmsr.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_readtracelist_timewin.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_readtracelist_timewin.3
deleted file mode 100644
index 9ee763bc0..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_readtracelist_timewin.3
+++ /dev/null
@@ -1,226 +0,0 @@
-.TH MS_READMSR 3 2011/01/06 "Libmseed API"
-.SH NAME
-ms_readmsr - Read Mini-SEED data from files
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "int \fBms_readmsr\fP ( MSRecord **ppmsr, char *" msfile ", int " reclen ","
-.BI " off_t *" fpos ", int *" last ", flag " skipnotdata ","
-.BI " flag " dataflag ",flag " verbose " );"
-
-.BI "int \fBms_readmsr_r\fP ( MSFileParam **ppmsfp, MSRecord **ppmsr, char *" msfile ","
-.BI " int " reclen ", off_t *" fpos ", int *" last ","
-.BI " flag " skipnotdata ", flag " dataflag ",flag " verbose " );"
-
-.BI "int \fBms_readtraces\fP ( MSTraceGroup **ppmstg, char *" msfile ", int " reclen ", "
-.BI " double " timetol ", double " sampratetol ","
-.BI " flag " dataquality ", flag " skipnotdata ","
-.BI " flag " dataflag ", flag " verbose " );"
-
-.BI "int \fBms_readtraces_timewin\fP ( MSTraceGroup **ppmstg, char *" msfile ","
-.BI " int " reclen ", double " timetol ", double " sampratetol ","
-.BI " hptime_t " starttime ", hptime_t " endtime ","
-.BI " flag " dataquality ", flag " skipnotdata ","
-.BI " flag " dataflag ", flag " verbose " );"
-
-.BI "int \fBms_readtraces_selection\fP ( MSTraceGroup **ppmstg, char *" msfile ","
-.BI " int " reclen ", double " timetol ", double " sampratetol ","
-.BI " Selections *" selections ", flag " dataquality ","
-.BI " flag " skipnotdata ", flag " dataflag ", flag " verbose " );"
-
-.BI "int \fBms_readtracelist\fP ( MSTraceList **ppmstl, char *" msfile ", int " reclen ","
-.BI " double " timetol ", double " sampratetol ","
-.BI " flag " dataquality ", flag " skipnotdata ","
-.BI " flag " dataflag ", flag " verbose " );"
-
-.BI "int \fBms_readtracelist_timewin\fP ( MSTraceList **ppmstl, char *" msfile ","
-.BI " int " reclen ", double " timetol ", double " sampratetol ","
-.BI " hptime_t " starttime ", hptime_t " endtime ","
-.BI " flag " dataquality ", flag " skipnotdata ","
-.BI " flag " dataflag ", flag " verbose " );"
-
-.BI "int \fBms_readtracelist_selection\fP ( MSTraceList **ppmstl, char *" msfile ","
-.BI " int " reclen ", double " timetol ", double " sampratetol ","
-.BI " Selections *" selections ", flag " dataquality ","
-.BI " flag " skipnotdata ", flag " dataflag ", flag " verbose " );"
-.fi
-
-.SH DESCRIPTION
-Both \fBms_readmsr\fP and \fBms_readmsr_r\fP will open and read, with
-subsequent calls, all Mini-SEED records from a specified file.
-Standard input will be opened if \fImsfile\fP is "-" (dash). As each
-record is read it is unpacked using \fBmsr_unpack(3)\fP. If the
-MSRecord struct at \fI*ppmsr\fP has not been initialized it must be
-set to NULL and it will be initialize it automatically.
-
-The \fBms_readmsr\fP version is not thread safe. The reentrant
-\fBms_readmsr_r\fP version is thread safe and can be used to read more
-than one file in parallel. \fBms_readmsr_r\fP stores all static file
-reading parameters in a MSFileParam struct. A pointer to this struct
-must be supplied by the caller (\fIppmsfp\fP), memory will be
-allocated on the initial call if the pointer is NULL.
-
-If \fIreclen\fP is 0 or negative the length of every record is
-automatically detected. For auto length detection records are first
-searched for a Blockette 1000 and if none is found a search is
-conducted for the next valid record header (the existence of the next
-record or end-of-file implying the length of the current record).
-
-If the \fIfpos\fP pointer is not NULL the value will be set to the
-file position (offset from the beginning in bytes) from where the
-returned record was read. As a special case, if \fIfpos\fP is not
-NULL and the value it points to is less than zero it will be
-interpreted as the (positive) offset in the file at which to begin
-reading data; this feature does not work with packed files.
-
-If the \fIlast\fP pointer is not NULL the value will be set to 1 when
-the record at the end of the file is being returned, otherwise it will
-be 0. This indicator will not be set when the last valid record in
-the file is followed by padding.
-
-If the \fIskipnotdata\fP flag is true (not 0) any data chunks read
-that do not have valid data record indicators (i.e. D, R, or Q) will
-be skipped.
-
-The \fIdataflag\fP argument is passed directly to \fBmsr_unpack(3)\fP
-and controls whether data samples are unpacked.
-
-After reading all the input records the controlling program should
-call it one last time with \fImsfile\fP set to NULL. This will close
-the file and cleanup allocated memory.
-
-If \fBms_readmsr\fP or \fBms_readmsr_r\fP are called with a different
-file than the one they currently have open they will close the
-currently open file, open the new file and print an error message.
-Properly coded applications should reset the function when the end of
-file has been reached as described above and not rely on this
-behavior.
-
-The \fBms_readtraces\fP and \fBms_readtracelist\fP routines read all
-Mini-SEED records from a file using \fBms_readmsr_r\fP and adds each
-one to either a MSTraceGroup or MSTraceList using
-\fBmst_addmsrtogroup(3)\fP and \fBmstl_addmsr(3)\fP respectively. The
-\fImsfile\fP, \fIreclen\fP, \fIskipnotdata\fP and \fIdataflag\fP
-arguments are passed directly to \fBms_readmsr_r\fP. The
-\fItimetol\fP, \fIsampratetol\fP and \fIdataquality\fP arguments are
-passed directly to \fBmst_addmsrtogroup(3)\fP or \fBmstl_addmsr(3)\fP.
-If the pointer to the MSTraceGroup or MSTraceList struct has not been
-initialized it must be set to NULL and it will be initialize
-automatically. The MSTraceGroup or MSTraceList structures may already
-contain entries and will be added to by these routines. These
-routines are thread safe.
-
-The \fBms_readtraces_timewin\fP and \fBms_readtracelist_timewin\fP
-routines perform the same function as \fBms_readtraces\fP and
-\fBms_readtracelist\fP but will limit the data to records containing
-samples between the specified \fIstarttime\fP and \fIendtime\fP.
-
-The \fBms_readtraces_selection\fP and \fBms_readtracelist_selection\fP
-routines perform the same function as \fBms_readtraces\fP and
-\fBms_readtracelist\fP but will limit the data to records that match
-the specified \fIselections\fP. Selections include criteria for
-source name and time window parameters, see \fBms_selection(3)\fP for
-more information.
-
-.SH RETURN VALUES
-On the successful read and parsing of a record \fBms_readmsr\fP and
-\fBms_readmsr_r\fP return MS_NOERROR and populate the MSRecord struct
-at \fI*ppmsr\fP. Upon reaching the end of the input file these
-routines return MS_ENDOFFILE. On error these routines return a
-libmseed error code (defined in libmseed.h)
-
-On the successful read and parsing of a file \fBms_readtraces\fP and
-\fBms_readtracelist\fP return MS_NOERROR and populate the MSTraceGroup
-or MSTraceList struct. On error these routines return a libmseed
-error code (defined in libmseed.h)
-
-.SH PACKED FILES
-\fBms_readmsr\fP, \fBms_readtraces\fP and \fBms_readtracelist\fP will
-read packed Mini-SEED files. Packed Mini-SEED is the indexed archive
-format used internally at the IRIS Data Management Center and probably
-not used anywhere else.
-
-.SH EXAMPLE
-Skeleton code for reading a file with \fBms_readmsr(3)\fP:
-
-.nf
-main() {
- MSRecord *msr = NULL;
- int retcode;
-
- while ( (retcode = ms_readmsr (&msr, filename, 0, NULL, NULL, 1, 0, verbose)) == MS_NOERROR )
- {
- /* Do something with the record here, e.g. print */
- msr_print (msr, verbose);
- }
-
- if ( retcode != MS_ENDOFFILE )
- ms_log (2, "Error reading input file %s: %s\\n", filename, ms_errorstr(retcode));
-
- /* Cleanup memory and close file */
- ms_readmsr (&msr, NULL, 0, NULL, NULL, 0, 0, verbose);
-}
-
-For reading a file with the thread safe \fBms_readmsr_r(3)\fP:
-
-.nf
-main() {
- MSRecord *msr = NULL;
- MSFileParam *msfp = NULL;
- int retcode;
-
- while ( (retcode = ms_readmsr_r (&msfp, &msr, filename, 0, NULL, NULL, 1, 0, verbose)) == MS_NOERROR )
- {
- /* Do something with the record here, e.g. print */
- msr_print (msr, verbose);
- }
-
- if ( retcode != MS_ENDOFFILE )
- ms_log (2, "Error reading input file %s: %s\\n", filename, ms_errorstr(retcode));
-
- /* Cleanup memory and close file */
- ms_readmsr_r (&msfp, &msr, NULL, 0, NULL, NULL, 0, 0, verbose);
-}
-
-.fi
-For reading a file with \fBms_readtraces(3)\fP:
-.nf
-
-main() {
- MSTraceList *mstl = NULL;
- int retcode;
-
- retcode = ms_readtracelist (&mstl, filename, 0, -1.0, -1.0, 0, 1, 0, verbose);
-
- if ( retcode != MS_NOERROR )
- ms_log (2, "Error reading input file %s: %s\\n", filename, ms_errorstr(retcode));
-
- retcode = ms_readtracelist (&mstl, filename2, 0, -1.0, -1.0, 0, 1, 0, verbose);
-
- if ( retcode != MS_NOERROR )
- ms_log (2, "Error reading input file %s: %s\\n", filename2, ms_errorstr(retcode));
-
- if ( ! mstl )
- {
- ms_log (2, "Error reading file\\n");
- return -1;
- }
-
- /* Do something with the traces here, e.g. print */
- mstl_printtracelist (mstl, 0, verbose, 0);
-
- mstl_free (&mstl);
-}
-.fi
-
-.SH SEE ALSO
-\fBms_intro(3)\fP, \fBmsr_unpack(3)\fP, \fBmst_addmsrtogroup(3)\fP,
-\fBmstl_addmsr(3)\fP, \fBms_log(3)\fP and \fBms_errorstr(3)\fP.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_readtracelist_timewin.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_readtracelist_timewin.3
new file mode 120000
index 000000000..45b3fc314
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_readtracelist_timewin.3
@@ -0,0 +1 @@
+ms_readmsr.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_readtraces.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_readtraces.3
deleted file mode 100644
index 9ee763bc0..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_readtraces.3
+++ /dev/null
@@ -1,226 +0,0 @@
-.TH MS_READMSR 3 2011/01/06 "Libmseed API"
-.SH NAME
-ms_readmsr - Read Mini-SEED data from files
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "int \fBms_readmsr\fP ( MSRecord **ppmsr, char *" msfile ", int " reclen ","
-.BI " off_t *" fpos ", int *" last ", flag " skipnotdata ","
-.BI " flag " dataflag ",flag " verbose " );"
-
-.BI "int \fBms_readmsr_r\fP ( MSFileParam **ppmsfp, MSRecord **ppmsr, char *" msfile ","
-.BI " int " reclen ", off_t *" fpos ", int *" last ","
-.BI " flag " skipnotdata ", flag " dataflag ",flag " verbose " );"
-
-.BI "int \fBms_readtraces\fP ( MSTraceGroup **ppmstg, char *" msfile ", int " reclen ", "
-.BI " double " timetol ", double " sampratetol ","
-.BI " flag " dataquality ", flag " skipnotdata ","
-.BI " flag " dataflag ", flag " verbose " );"
-
-.BI "int \fBms_readtraces_timewin\fP ( MSTraceGroup **ppmstg, char *" msfile ","
-.BI " int " reclen ", double " timetol ", double " sampratetol ","
-.BI " hptime_t " starttime ", hptime_t " endtime ","
-.BI " flag " dataquality ", flag " skipnotdata ","
-.BI " flag " dataflag ", flag " verbose " );"
-
-.BI "int \fBms_readtraces_selection\fP ( MSTraceGroup **ppmstg, char *" msfile ","
-.BI " int " reclen ", double " timetol ", double " sampratetol ","
-.BI " Selections *" selections ", flag " dataquality ","
-.BI " flag " skipnotdata ", flag " dataflag ", flag " verbose " );"
-
-.BI "int \fBms_readtracelist\fP ( MSTraceList **ppmstl, char *" msfile ", int " reclen ","
-.BI " double " timetol ", double " sampratetol ","
-.BI " flag " dataquality ", flag " skipnotdata ","
-.BI " flag " dataflag ", flag " verbose " );"
-
-.BI "int \fBms_readtracelist_timewin\fP ( MSTraceList **ppmstl, char *" msfile ","
-.BI " int " reclen ", double " timetol ", double " sampratetol ","
-.BI " hptime_t " starttime ", hptime_t " endtime ","
-.BI " flag " dataquality ", flag " skipnotdata ","
-.BI " flag " dataflag ", flag " verbose " );"
-
-.BI "int \fBms_readtracelist_selection\fP ( MSTraceList **ppmstl, char *" msfile ","
-.BI " int " reclen ", double " timetol ", double " sampratetol ","
-.BI " Selections *" selections ", flag " dataquality ","
-.BI " flag " skipnotdata ", flag " dataflag ", flag " verbose " );"
-.fi
-
-.SH DESCRIPTION
-Both \fBms_readmsr\fP and \fBms_readmsr_r\fP will open and read, with
-subsequent calls, all Mini-SEED records from a specified file.
-Standard input will be opened if \fImsfile\fP is "-" (dash). As each
-record is read it is unpacked using \fBmsr_unpack(3)\fP. If the
-MSRecord struct at \fI*ppmsr\fP has not been initialized it must be
-set to NULL and it will be initialize it automatically.
-
-The \fBms_readmsr\fP version is not thread safe. The reentrant
-\fBms_readmsr_r\fP version is thread safe and can be used to read more
-than one file in parallel. \fBms_readmsr_r\fP stores all static file
-reading parameters in a MSFileParam struct. A pointer to this struct
-must be supplied by the caller (\fIppmsfp\fP), memory will be
-allocated on the initial call if the pointer is NULL.
-
-If \fIreclen\fP is 0 or negative the length of every record is
-automatically detected. For auto length detection records are first
-searched for a Blockette 1000 and if none is found a search is
-conducted for the next valid record header (the existence of the next
-record or end-of-file implying the length of the current record).
-
-If the \fIfpos\fP pointer is not NULL the value will be set to the
-file position (offset from the beginning in bytes) from where the
-returned record was read. As a special case, if \fIfpos\fP is not
-NULL and the value it points to is less than zero it will be
-interpreted as the (positive) offset in the file at which to begin
-reading data; this feature does not work with packed files.
-
-If the \fIlast\fP pointer is not NULL the value will be set to 1 when
-the record at the end of the file is being returned, otherwise it will
-be 0. This indicator will not be set when the last valid record in
-the file is followed by padding.
-
-If the \fIskipnotdata\fP flag is true (not 0) any data chunks read
-that do not have valid data record indicators (i.e. D, R, or Q) will
-be skipped.
-
-The \fIdataflag\fP argument is passed directly to \fBmsr_unpack(3)\fP
-and controls whether data samples are unpacked.
-
-After reading all the input records the controlling program should
-call it one last time with \fImsfile\fP set to NULL. This will close
-the file and cleanup allocated memory.
-
-If \fBms_readmsr\fP or \fBms_readmsr_r\fP are called with a different
-file than the one they currently have open they will close the
-currently open file, open the new file and print an error message.
-Properly coded applications should reset the function when the end of
-file has been reached as described above and not rely on this
-behavior.
-
-The \fBms_readtraces\fP and \fBms_readtracelist\fP routines read all
-Mini-SEED records from a file using \fBms_readmsr_r\fP and adds each
-one to either a MSTraceGroup or MSTraceList using
-\fBmst_addmsrtogroup(3)\fP and \fBmstl_addmsr(3)\fP respectively. The
-\fImsfile\fP, \fIreclen\fP, \fIskipnotdata\fP and \fIdataflag\fP
-arguments are passed directly to \fBms_readmsr_r\fP. The
-\fItimetol\fP, \fIsampratetol\fP and \fIdataquality\fP arguments are
-passed directly to \fBmst_addmsrtogroup(3)\fP or \fBmstl_addmsr(3)\fP.
-If the pointer to the MSTraceGroup or MSTraceList struct has not been
-initialized it must be set to NULL and it will be initialize
-automatically. The MSTraceGroup or MSTraceList structures may already
-contain entries and will be added to by these routines. These
-routines are thread safe.
-
-The \fBms_readtraces_timewin\fP and \fBms_readtracelist_timewin\fP
-routines perform the same function as \fBms_readtraces\fP and
-\fBms_readtracelist\fP but will limit the data to records containing
-samples between the specified \fIstarttime\fP and \fIendtime\fP.
-
-The \fBms_readtraces_selection\fP and \fBms_readtracelist_selection\fP
-routines perform the same function as \fBms_readtraces\fP and
-\fBms_readtracelist\fP but will limit the data to records that match
-the specified \fIselections\fP. Selections include criteria for
-source name and time window parameters, see \fBms_selection(3)\fP for
-more information.
-
-.SH RETURN VALUES
-On the successful read and parsing of a record \fBms_readmsr\fP and
-\fBms_readmsr_r\fP return MS_NOERROR and populate the MSRecord struct
-at \fI*ppmsr\fP. Upon reaching the end of the input file these
-routines return MS_ENDOFFILE. On error these routines return a
-libmseed error code (defined in libmseed.h)
-
-On the successful read and parsing of a file \fBms_readtraces\fP and
-\fBms_readtracelist\fP return MS_NOERROR and populate the MSTraceGroup
-or MSTraceList struct. On error these routines return a libmseed
-error code (defined in libmseed.h)
-
-.SH PACKED FILES
-\fBms_readmsr\fP, \fBms_readtraces\fP and \fBms_readtracelist\fP will
-read packed Mini-SEED files. Packed Mini-SEED is the indexed archive
-format used internally at the IRIS Data Management Center and probably
-not used anywhere else.
-
-.SH EXAMPLE
-Skeleton code for reading a file with \fBms_readmsr(3)\fP:
-
-.nf
-main() {
- MSRecord *msr = NULL;
- int retcode;
-
- while ( (retcode = ms_readmsr (&msr, filename, 0, NULL, NULL, 1, 0, verbose)) == MS_NOERROR )
- {
- /* Do something with the record here, e.g. print */
- msr_print (msr, verbose);
- }
-
- if ( retcode != MS_ENDOFFILE )
- ms_log (2, "Error reading input file %s: %s\\n", filename, ms_errorstr(retcode));
-
- /* Cleanup memory and close file */
- ms_readmsr (&msr, NULL, 0, NULL, NULL, 0, 0, verbose);
-}
-
-For reading a file with the thread safe \fBms_readmsr_r(3)\fP:
-
-.nf
-main() {
- MSRecord *msr = NULL;
- MSFileParam *msfp = NULL;
- int retcode;
-
- while ( (retcode = ms_readmsr_r (&msfp, &msr, filename, 0, NULL, NULL, 1, 0, verbose)) == MS_NOERROR )
- {
- /* Do something with the record here, e.g. print */
- msr_print (msr, verbose);
- }
-
- if ( retcode != MS_ENDOFFILE )
- ms_log (2, "Error reading input file %s: %s\\n", filename, ms_errorstr(retcode));
-
- /* Cleanup memory and close file */
- ms_readmsr_r (&msfp, &msr, NULL, 0, NULL, NULL, 0, 0, verbose);
-}
-
-.fi
-For reading a file with \fBms_readtraces(3)\fP:
-.nf
-
-main() {
- MSTraceList *mstl = NULL;
- int retcode;
-
- retcode = ms_readtracelist (&mstl, filename, 0, -1.0, -1.0, 0, 1, 0, verbose);
-
- if ( retcode != MS_NOERROR )
- ms_log (2, "Error reading input file %s: %s\\n", filename, ms_errorstr(retcode));
-
- retcode = ms_readtracelist (&mstl, filename2, 0, -1.0, -1.0, 0, 1, 0, verbose);
-
- if ( retcode != MS_NOERROR )
- ms_log (2, "Error reading input file %s: %s\\n", filename2, ms_errorstr(retcode));
-
- if ( ! mstl )
- {
- ms_log (2, "Error reading file\\n");
- return -1;
- }
-
- /* Do something with the traces here, e.g. print */
- mstl_printtracelist (mstl, 0, verbose, 0);
-
- mstl_free (&mstl);
-}
-.fi
-
-.SH SEE ALSO
-\fBms_intro(3)\fP, \fBmsr_unpack(3)\fP, \fBmst_addmsrtogroup(3)\fP,
-\fBmstl_addmsr(3)\fP, \fBms_log(3)\fP and \fBms_errorstr(3)\fP.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_readtraces.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_readtraces.3
new file mode 120000
index 000000000..45b3fc314
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_readtraces.3
@@ -0,0 +1 @@
+ms_readmsr.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_readtraces_selection.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_readtraces_selection.3
deleted file mode 100644
index 9ee763bc0..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_readtraces_selection.3
+++ /dev/null
@@ -1,226 +0,0 @@
-.TH MS_READMSR 3 2011/01/06 "Libmseed API"
-.SH NAME
-ms_readmsr - Read Mini-SEED data from files
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "int \fBms_readmsr\fP ( MSRecord **ppmsr, char *" msfile ", int " reclen ","
-.BI " off_t *" fpos ", int *" last ", flag " skipnotdata ","
-.BI " flag " dataflag ",flag " verbose " );"
-
-.BI "int \fBms_readmsr_r\fP ( MSFileParam **ppmsfp, MSRecord **ppmsr, char *" msfile ","
-.BI " int " reclen ", off_t *" fpos ", int *" last ","
-.BI " flag " skipnotdata ", flag " dataflag ",flag " verbose " );"
-
-.BI "int \fBms_readtraces\fP ( MSTraceGroup **ppmstg, char *" msfile ", int " reclen ", "
-.BI " double " timetol ", double " sampratetol ","
-.BI " flag " dataquality ", flag " skipnotdata ","
-.BI " flag " dataflag ", flag " verbose " );"
-
-.BI "int \fBms_readtraces_timewin\fP ( MSTraceGroup **ppmstg, char *" msfile ","
-.BI " int " reclen ", double " timetol ", double " sampratetol ","
-.BI " hptime_t " starttime ", hptime_t " endtime ","
-.BI " flag " dataquality ", flag " skipnotdata ","
-.BI " flag " dataflag ", flag " verbose " );"
-
-.BI "int \fBms_readtraces_selection\fP ( MSTraceGroup **ppmstg, char *" msfile ","
-.BI " int " reclen ", double " timetol ", double " sampratetol ","
-.BI " Selections *" selections ", flag " dataquality ","
-.BI " flag " skipnotdata ", flag " dataflag ", flag " verbose " );"
-
-.BI "int \fBms_readtracelist\fP ( MSTraceList **ppmstl, char *" msfile ", int " reclen ","
-.BI " double " timetol ", double " sampratetol ","
-.BI " flag " dataquality ", flag " skipnotdata ","
-.BI " flag " dataflag ", flag " verbose " );"
-
-.BI "int \fBms_readtracelist_timewin\fP ( MSTraceList **ppmstl, char *" msfile ","
-.BI " int " reclen ", double " timetol ", double " sampratetol ","
-.BI " hptime_t " starttime ", hptime_t " endtime ","
-.BI " flag " dataquality ", flag " skipnotdata ","
-.BI " flag " dataflag ", flag " verbose " );"
-
-.BI "int \fBms_readtracelist_selection\fP ( MSTraceList **ppmstl, char *" msfile ","
-.BI " int " reclen ", double " timetol ", double " sampratetol ","
-.BI " Selections *" selections ", flag " dataquality ","
-.BI " flag " skipnotdata ", flag " dataflag ", flag " verbose " );"
-.fi
-
-.SH DESCRIPTION
-Both \fBms_readmsr\fP and \fBms_readmsr_r\fP will open and read, with
-subsequent calls, all Mini-SEED records from a specified file.
-Standard input will be opened if \fImsfile\fP is "-" (dash). As each
-record is read it is unpacked using \fBmsr_unpack(3)\fP. If the
-MSRecord struct at \fI*ppmsr\fP has not been initialized it must be
-set to NULL and it will be initialize it automatically.
-
-The \fBms_readmsr\fP version is not thread safe. The reentrant
-\fBms_readmsr_r\fP version is thread safe and can be used to read more
-than one file in parallel. \fBms_readmsr_r\fP stores all static file
-reading parameters in a MSFileParam struct. A pointer to this struct
-must be supplied by the caller (\fIppmsfp\fP), memory will be
-allocated on the initial call if the pointer is NULL.
-
-If \fIreclen\fP is 0 or negative the length of every record is
-automatically detected. For auto length detection records are first
-searched for a Blockette 1000 and if none is found a search is
-conducted for the next valid record header (the existence of the next
-record or end-of-file implying the length of the current record).
-
-If the \fIfpos\fP pointer is not NULL the value will be set to the
-file position (offset from the beginning in bytes) from where the
-returned record was read. As a special case, if \fIfpos\fP is not
-NULL and the value it points to is less than zero it will be
-interpreted as the (positive) offset in the file at which to begin
-reading data; this feature does not work with packed files.
-
-If the \fIlast\fP pointer is not NULL the value will be set to 1 when
-the record at the end of the file is being returned, otherwise it will
-be 0. This indicator will not be set when the last valid record in
-the file is followed by padding.
-
-If the \fIskipnotdata\fP flag is true (not 0) any data chunks read
-that do not have valid data record indicators (i.e. D, R, or Q) will
-be skipped.
-
-The \fIdataflag\fP argument is passed directly to \fBmsr_unpack(3)\fP
-and controls whether data samples are unpacked.
-
-After reading all the input records the controlling program should
-call it one last time with \fImsfile\fP set to NULL. This will close
-the file and cleanup allocated memory.
-
-If \fBms_readmsr\fP or \fBms_readmsr_r\fP are called with a different
-file than the one they currently have open they will close the
-currently open file, open the new file and print an error message.
-Properly coded applications should reset the function when the end of
-file has been reached as described above and not rely on this
-behavior.
-
-The \fBms_readtraces\fP and \fBms_readtracelist\fP routines read all
-Mini-SEED records from a file using \fBms_readmsr_r\fP and adds each
-one to either a MSTraceGroup or MSTraceList using
-\fBmst_addmsrtogroup(3)\fP and \fBmstl_addmsr(3)\fP respectively. The
-\fImsfile\fP, \fIreclen\fP, \fIskipnotdata\fP and \fIdataflag\fP
-arguments are passed directly to \fBms_readmsr_r\fP. The
-\fItimetol\fP, \fIsampratetol\fP and \fIdataquality\fP arguments are
-passed directly to \fBmst_addmsrtogroup(3)\fP or \fBmstl_addmsr(3)\fP.
-If the pointer to the MSTraceGroup or MSTraceList struct has not been
-initialized it must be set to NULL and it will be initialize
-automatically. The MSTraceGroup or MSTraceList structures may already
-contain entries and will be added to by these routines. These
-routines are thread safe.
-
-The \fBms_readtraces_timewin\fP and \fBms_readtracelist_timewin\fP
-routines perform the same function as \fBms_readtraces\fP and
-\fBms_readtracelist\fP but will limit the data to records containing
-samples between the specified \fIstarttime\fP and \fIendtime\fP.
-
-The \fBms_readtraces_selection\fP and \fBms_readtracelist_selection\fP
-routines perform the same function as \fBms_readtraces\fP and
-\fBms_readtracelist\fP but will limit the data to records that match
-the specified \fIselections\fP. Selections include criteria for
-source name and time window parameters, see \fBms_selection(3)\fP for
-more information.
-
-.SH RETURN VALUES
-On the successful read and parsing of a record \fBms_readmsr\fP and
-\fBms_readmsr_r\fP return MS_NOERROR and populate the MSRecord struct
-at \fI*ppmsr\fP. Upon reaching the end of the input file these
-routines return MS_ENDOFFILE. On error these routines return a
-libmseed error code (defined in libmseed.h)
-
-On the successful read and parsing of a file \fBms_readtraces\fP and
-\fBms_readtracelist\fP return MS_NOERROR and populate the MSTraceGroup
-or MSTraceList struct. On error these routines return a libmseed
-error code (defined in libmseed.h)
-
-.SH PACKED FILES
-\fBms_readmsr\fP, \fBms_readtraces\fP and \fBms_readtracelist\fP will
-read packed Mini-SEED files. Packed Mini-SEED is the indexed archive
-format used internally at the IRIS Data Management Center and probably
-not used anywhere else.
-
-.SH EXAMPLE
-Skeleton code for reading a file with \fBms_readmsr(3)\fP:
-
-.nf
-main() {
- MSRecord *msr = NULL;
- int retcode;
-
- while ( (retcode = ms_readmsr (&msr, filename, 0, NULL, NULL, 1, 0, verbose)) == MS_NOERROR )
- {
- /* Do something with the record here, e.g. print */
- msr_print (msr, verbose);
- }
-
- if ( retcode != MS_ENDOFFILE )
- ms_log (2, "Error reading input file %s: %s\\n", filename, ms_errorstr(retcode));
-
- /* Cleanup memory and close file */
- ms_readmsr (&msr, NULL, 0, NULL, NULL, 0, 0, verbose);
-}
-
-For reading a file with the thread safe \fBms_readmsr_r(3)\fP:
-
-.nf
-main() {
- MSRecord *msr = NULL;
- MSFileParam *msfp = NULL;
- int retcode;
-
- while ( (retcode = ms_readmsr_r (&msfp, &msr, filename, 0, NULL, NULL, 1, 0, verbose)) == MS_NOERROR )
- {
- /* Do something with the record here, e.g. print */
- msr_print (msr, verbose);
- }
-
- if ( retcode != MS_ENDOFFILE )
- ms_log (2, "Error reading input file %s: %s\\n", filename, ms_errorstr(retcode));
-
- /* Cleanup memory and close file */
- ms_readmsr_r (&msfp, &msr, NULL, 0, NULL, NULL, 0, 0, verbose);
-}
-
-.fi
-For reading a file with \fBms_readtraces(3)\fP:
-.nf
-
-main() {
- MSTraceList *mstl = NULL;
- int retcode;
-
- retcode = ms_readtracelist (&mstl, filename, 0, -1.0, -1.0, 0, 1, 0, verbose);
-
- if ( retcode != MS_NOERROR )
- ms_log (2, "Error reading input file %s: %s\\n", filename, ms_errorstr(retcode));
-
- retcode = ms_readtracelist (&mstl, filename2, 0, -1.0, -1.0, 0, 1, 0, verbose);
-
- if ( retcode != MS_NOERROR )
- ms_log (2, "Error reading input file %s: %s\\n", filename2, ms_errorstr(retcode));
-
- if ( ! mstl )
- {
- ms_log (2, "Error reading file\\n");
- return -1;
- }
-
- /* Do something with the traces here, e.g. print */
- mstl_printtracelist (mstl, 0, verbose, 0);
-
- mstl_free (&mstl);
-}
-.fi
-
-.SH SEE ALSO
-\fBms_intro(3)\fP, \fBmsr_unpack(3)\fP, \fBmst_addmsrtogroup(3)\fP,
-\fBmstl_addmsr(3)\fP, \fBms_log(3)\fP and \fBms_errorstr(3)\fP.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_readtraces_selection.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_readtraces_selection.3
new file mode 120000
index 000000000..45b3fc314
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_readtraces_selection.3
@@ -0,0 +1 @@
+ms_readmsr.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_readtraces_timewin.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_readtraces_timewin.3
deleted file mode 100644
index 9ee763bc0..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_readtraces_timewin.3
+++ /dev/null
@@ -1,226 +0,0 @@
-.TH MS_READMSR 3 2011/01/06 "Libmseed API"
-.SH NAME
-ms_readmsr - Read Mini-SEED data from files
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "int \fBms_readmsr\fP ( MSRecord **ppmsr, char *" msfile ", int " reclen ","
-.BI " off_t *" fpos ", int *" last ", flag " skipnotdata ","
-.BI " flag " dataflag ",flag " verbose " );"
-
-.BI "int \fBms_readmsr_r\fP ( MSFileParam **ppmsfp, MSRecord **ppmsr, char *" msfile ","
-.BI " int " reclen ", off_t *" fpos ", int *" last ","
-.BI " flag " skipnotdata ", flag " dataflag ",flag " verbose " );"
-
-.BI "int \fBms_readtraces\fP ( MSTraceGroup **ppmstg, char *" msfile ", int " reclen ", "
-.BI " double " timetol ", double " sampratetol ","
-.BI " flag " dataquality ", flag " skipnotdata ","
-.BI " flag " dataflag ", flag " verbose " );"
-
-.BI "int \fBms_readtraces_timewin\fP ( MSTraceGroup **ppmstg, char *" msfile ","
-.BI " int " reclen ", double " timetol ", double " sampratetol ","
-.BI " hptime_t " starttime ", hptime_t " endtime ","
-.BI " flag " dataquality ", flag " skipnotdata ","
-.BI " flag " dataflag ", flag " verbose " );"
-
-.BI "int \fBms_readtraces_selection\fP ( MSTraceGroup **ppmstg, char *" msfile ","
-.BI " int " reclen ", double " timetol ", double " sampratetol ","
-.BI " Selections *" selections ", flag " dataquality ","
-.BI " flag " skipnotdata ", flag " dataflag ", flag " verbose " );"
-
-.BI "int \fBms_readtracelist\fP ( MSTraceList **ppmstl, char *" msfile ", int " reclen ","
-.BI " double " timetol ", double " sampratetol ","
-.BI " flag " dataquality ", flag " skipnotdata ","
-.BI " flag " dataflag ", flag " verbose " );"
-
-.BI "int \fBms_readtracelist_timewin\fP ( MSTraceList **ppmstl, char *" msfile ","
-.BI " int " reclen ", double " timetol ", double " sampratetol ","
-.BI " hptime_t " starttime ", hptime_t " endtime ","
-.BI " flag " dataquality ", flag " skipnotdata ","
-.BI " flag " dataflag ", flag " verbose " );"
-
-.BI "int \fBms_readtracelist_selection\fP ( MSTraceList **ppmstl, char *" msfile ","
-.BI " int " reclen ", double " timetol ", double " sampratetol ","
-.BI " Selections *" selections ", flag " dataquality ","
-.BI " flag " skipnotdata ", flag " dataflag ", flag " verbose " );"
-.fi
-
-.SH DESCRIPTION
-Both \fBms_readmsr\fP and \fBms_readmsr_r\fP will open and read, with
-subsequent calls, all Mini-SEED records from a specified file.
-Standard input will be opened if \fImsfile\fP is "-" (dash). As each
-record is read it is unpacked using \fBmsr_unpack(3)\fP. If the
-MSRecord struct at \fI*ppmsr\fP has not been initialized it must be
-set to NULL and it will be initialize it automatically.
-
-The \fBms_readmsr\fP version is not thread safe. The reentrant
-\fBms_readmsr_r\fP version is thread safe and can be used to read more
-than one file in parallel. \fBms_readmsr_r\fP stores all static file
-reading parameters in a MSFileParam struct. A pointer to this struct
-must be supplied by the caller (\fIppmsfp\fP), memory will be
-allocated on the initial call if the pointer is NULL.
-
-If \fIreclen\fP is 0 or negative the length of every record is
-automatically detected. For auto length detection records are first
-searched for a Blockette 1000 and if none is found a search is
-conducted for the next valid record header (the existence of the next
-record or end-of-file implying the length of the current record).
-
-If the \fIfpos\fP pointer is not NULL the value will be set to the
-file position (offset from the beginning in bytes) from where the
-returned record was read. As a special case, if \fIfpos\fP is not
-NULL and the value it points to is less than zero it will be
-interpreted as the (positive) offset in the file at which to begin
-reading data; this feature does not work with packed files.
-
-If the \fIlast\fP pointer is not NULL the value will be set to 1 when
-the record at the end of the file is being returned, otherwise it will
-be 0. This indicator will not be set when the last valid record in
-the file is followed by padding.
-
-If the \fIskipnotdata\fP flag is true (not 0) any data chunks read
-that do not have valid data record indicators (i.e. D, R, or Q) will
-be skipped.
-
-The \fIdataflag\fP argument is passed directly to \fBmsr_unpack(3)\fP
-and controls whether data samples are unpacked.
-
-After reading all the input records the controlling program should
-call it one last time with \fImsfile\fP set to NULL. This will close
-the file and cleanup allocated memory.
-
-If \fBms_readmsr\fP or \fBms_readmsr_r\fP are called with a different
-file than the one they currently have open they will close the
-currently open file, open the new file and print an error message.
-Properly coded applications should reset the function when the end of
-file has been reached as described above and not rely on this
-behavior.
-
-The \fBms_readtraces\fP and \fBms_readtracelist\fP routines read all
-Mini-SEED records from a file using \fBms_readmsr_r\fP and adds each
-one to either a MSTraceGroup or MSTraceList using
-\fBmst_addmsrtogroup(3)\fP and \fBmstl_addmsr(3)\fP respectively. The
-\fImsfile\fP, \fIreclen\fP, \fIskipnotdata\fP and \fIdataflag\fP
-arguments are passed directly to \fBms_readmsr_r\fP. The
-\fItimetol\fP, \fIsampratetol\fP and \fIdataquality\fP arguments are
-passed directly to \fBmst_addmsrtogroup(3)\fP or \fBmstl_addmsr(3)\fP.
-If the pointer to the MSTraceGroup or MSTraceList struct has not been
-initialized it must be set to NULL and it will be initialize
-automatically. The MSTraceGroup or MSTraceList structures may already
-contain entries and will be added to by these routines. These
-routines are thread safe.
-
-The \fBms_readtraces_timewin\fP and \fBms_readtracelist_timewin\fP
-routines perform the same function as \fBms_readtraces\fP and
-\fBms_readtracelist\fP but will limit the data to records containing
-samples between the specified \fIstarttime\fP and \fIendtime\fP.
-
-The \fBms_readtraces_selection\fP and \fBms_readtracelist_selection\fP
-routines perform the same function as \fBms_readtraces\fP and
-\fBms_readtracelist\fP but will limit the data to records that match
-the specified \fIselections\fP. Selections include criteria for
-source name and time window parameters, see \fBms_selection(3)\fP for
-more information.
-
-.SH RETURN VALUES
-On the successful read and parsing of a record \fBms_readmsr\fP and
-\fBms_readmsr_r\fP return MS_NOERROR and populate the MSRecord struct
-at \fI*ppmsr\fP. Upon reaching the end of the input file these
-routines return MS_ENDOFFILE. On error these routines return a
-libmseed error code (defined in libmseed.h)
-
-On the successful read and parsing of a file \fBms_readtraces\fP and
-\fBms_readtracelist\fP return MS_NOERROR and populate the MSTraceGroup
-or MSTraceList struct. On error these routines return a libmseed
-error code (defined in libmseed.h)
-
-.SH PACKED FILES
-\fBms_readmsr\fP, \fBms_readtraces\fP and \fBms_readtracelist\fP will
-read packed Mini-SEED files. Packed Mini-SEED is the indexed archive
-format used internally at the IRIS Data Management Center and probably
-not used anywhere else.
-
-.SH EXAMPLE
-Skeleton code for reading a file with \fBms_readmsr(3)\fP:
-
-.nf
-main() {
- MSRecord *msr = NULL;
- int retcode;
-
- while ( (retcode = ms_readmsr (&msr, filename, 0, NULL, NULL, 1, 0, verbose)) == MS_NOERROR )
- {
- /* Do something with the record here, e.g. print */
- msr_print (msr, verbose);
- }
-
- if ( retcode != MS_ENDOFFILE )
- ms_log (2, "Error reading input file %s: %s\\n", filename, ms_errorstr(retcode));
-
- /* Cleanup memory and close file */
- ms_readmsr (&msr, NULL, 0, NULL, NULL, 0, 0, verbose);
-}
-
-For reading a file with the thread safe \fBms_readmsr_r(3)\fP:
-
-.nf
-main() {
- MSRecord *msr = NULL;
- MSFileParam *msfp = NULL;
- int retcode;
-
- while ( (retcode = ms_readmsr_r (&msfp, &msr, filename, 0, NULL, NULL, 1, 0, verbose)) == MS_NOERROR )
- {
- /* Do something with the record here, e.g. print */
- msr_print (msr, verbose);
- }
-
- if ( retcode != MS_ENDOFFILE )
- ms_log (2, "Error reading input file %s: %s\\n", filename, ms_errorstr(retcode));
-
- /* Cleanup memory and close file */
- ms_readmsr_r (&msfp, &msr, NULL, 0, NULL, NULL, 0, 0, verbose);
-}
-
-.fi
-For reading a file with \fBms_readtraces(3)\fP:
-.nf
-
-main() {
- MSTraceList *mstl = NULL;
- int retcode;
-
- retcode = ms_readtracelist (&mstl, filename, 0, -1.0, -1.0, 0, 1, 0, verbose);
-
- if ( retcode != MS_NOERROR )
- ms_log (2, "Error reading input file %s: %s\\n", filename, ms_errorstr(retcode));
-
- retcode = ms_readtracelist (&mstl, filename2, 0, -1.0, -1.0, 0, 1, 0, verbose);
-
- if ( retcode != MS_NOERROR )
- ms_log (2, "Error reading input file %s: %s\\n", filename2, ms_errorstr(retcode));
-
- if ( ! mstl )
- {
- ms_log (2, "Error reading file\\n");
- return -1;
- }
-
- /* Do something with the traces here, e.g. print */
- mstl_printtracelist (mstl, 0, verbose, 0);
-
- mstl_free (&mstl);
-}
-.fi
-
-.SH SEE ALSO
-\fBms_intro(3)\fP, \fBmsr_unpack(3)\fP, \fBmst_addmsrtogroup(3)\fP,
-\fBmstl_addmsr(3)\fP, \fBms_log(3)\fP and \fBms_errorstr(3)\fP.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_readtraces_timewin.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_readtraces_timewin.3
new file mode 120000
index 000000000..45b3fc314
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_readtraces_timewin.3
@@ -0,0 +1 @@
+ms_readmsr.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_recsrcname.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_recsrcname.3
deleted file mode 100644
index 551ce6f1d..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_recsrcname.3
+++ /dev/null
@@ -1,56 +0,0 @@
-.TH MS_SRCNAME 3 2006/11/27 "Libmseed API"
-.SH NAME
-ms_srcname - Determine source names using the SEED naming nomenclature.
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "char *\fBms_recsrcname\fP ( char *" record ", char *" srcname ", flag " quality " );"
-
-.BI "char *\fBmsr_srcname\fP ( MSRecord *" msr ", char *" srcname ", flag " quality " );"
-
-.BI "char *\fBmst_srcname\fP ( MSTrace *" mst ", char *" srcname ", flag " quality " );"
-.fi
-
-.SH DESCRIPTION
-These routines generate a source name using the SEED naming
-nomenclature in the format: 'NET_STA_LOC_CHAN' and stores it in the
-buffer provided at \fIsrcname\fP. If the \fIquality\fP flag is true
-the data quality character will be appended to the source name
-resulting in a format of: 'NET_STA_LOC_CHAN_QUAL'.
-
-The memory pointed to by \fIsrcname\fP must have enough room for the
-resulting string. As of SEED 2.4 this is a maximum of 18 characters
-including the terminating NULL. The MSRecord and MSTrace structs are
-capable of producing a source name of 42 characters (including the
-terminating NULL) and libmseed commonly allocates 50 characters for
-the \fIsrcname\fP buffer.
-
-\fBms_recsrcname\fP generates a source name string for the SEED data
-record at \fIrecord\fP. If the \fIquality\fP flag is true the quality
-character will be appended.
-
-\fBmsr_srcname\fP generates a source name string for the specified
-MSRecord struct. If the \fIquality\fP flag is true the quality
-character will be appended.
-
-\fBmst_srcname\fP generates a source name string in for the specified
-MSTrace struct. If the \fIquality\fP flag is true *and*
-mst->dataquality is not zero the quality character will be appended.
-
-.SH LOCATION IDS AND SPACES
-The source name produced by these routines never include spaces. The
-fixed format nature of SEED data records leads to blank or unused
-location IDs represented by spaces. Such blank location IDs will be
-collapsed to nothing in the resulting sources names.
-
-.SH RETURN VALUES
-The routines return a pointer to the resulting string or NULL on
-error.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_recsrcname.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_recsrcname.3
new file mode 120000
index 000000000..7abd571d7
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_recsrcname.3
@@ -0,0 +1 @@
+ms_srcname.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_samplesize.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_samplesize.3
deleted file mode 100644
index ec6b163fc..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_samplesize.3
+++ /dev/null
@@ -1,82 +0,0 @@
-.TH MS_LOOKUP 3 2006/12/12 "Libmseed API"
-.SH NAME
-ms_lookup - Look up libmseed and Mini-SEED related information
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "char *\fBms_errorstr\fP ( int " errorcode " );"
-
-.BI "uint8_t \fBms_samplesize\fP ( const char " sampletype " );"
-
-.BI "char *\fBms_encodingstr\fP ( const char " encoding " );"
-
-.BI "char *\fBms_blktdesc\fP ( uint16_t " blkttype " );"
-
-.BI "uint16_t \fBms_blktlen\fP ( uint16_t " blkttype ", const char *" blktdata ",
-.BI " flag " swapflag " );
-.fi
-
-.SH DESCRIPTION
-\fBms_errorstr\fP returns a pointer to a string describing the
-specified libmseed error code. The error codes are defined in
-libmseed.h and returned by various functions.
-
-\fBms_samplesize\fP returns the sample size based on the specified
-\fIsampletype\fP. In general libmseed uses the following character
-sample types:
-.sp
-.nf
-"a" = 1 byte (ASCII)
-"i" = 4 bytes (integer)
-"f" = 4 bytes (float)
-"d" = 8 bytes (double)
-.fi
-
-\fBms_encoding\fP returns a pointer to a string describing the
-specified data \fIencoding\fP format. If the encoding format is
-unknown an appropriate string is return stating just that.
-
-\fBms_blktdesc\fP returns a pointer to a string describing the
-specified blockette type (\fIblkttype\fP). If the blockette type is
-unknown NULL is returned.
-
-\fBms_blktlen\fP returns the total length of the specified blockette
-type (\fIblkttype\fP) in bytes. A pointer to the blockette itself
-(\fIblkt\fP) should also be provided along with a \fIswapflag\fP that
-should be set to 1 when the blockette is known to have a different
-byte order than the host computer. The length returned includes both
-the blockette "header" (type and next fields) and "body".
-
-Technically a pointer to blockette and the swapflag only need to be
-supplied when the blockette type is a variable length blockette and
-the length is contained within the blockette itself (e.g. blockette
-type 2000). For blockettes of known fixed length (most of them) the
-\fIblkt\fP pointer and \fIswapflag\fP are not used.
-
-In the case of blockette type 405 that is variable length and not self
-describing 0 will be returned. In the case of blockette type 2000
-that is variable length and self describing the length will be read
-from a known offset into the blockette data.
-
-
-.SH RETURN VALUES
-\fBms_errorstr\fP returns a pointer to a static string.
-
-\fBms_samplesize\fP returns the sample size in bytes or 0 for unknown
-sample type.
-
-\fBms_encoding\fP returns a pointer to a static string.
-
-\fBms_blktdesc\fP returns a pointer to a static string or NULL if the
-blockette type is unknown.
-
-\fBms_blktlen\fP returns the total length of the specified blockette
-type or 0 for unknown type.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_samplesize.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_samplesize.3
new file mode 120000
index 000000000..4ba371489
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_samplesize.3
@@ -0,0 +1 @@
+ms_lookup.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_seedtimestr2hptime.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_seedtimestr2hptime.3
deleted file mode 100644
index d9d1c6371..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_seedtimestr2hptime.3
+++ /dev/null
@@ -1,202 +0,0 @@
-.TH MS_TIME 3 2013/02/22 "Libmseed API"
-.SH NAME
-ms_time - Time conversion and string generation
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "MS_EPOCH2HPTIME(X) X * (hptime_t) HPTMODULUS"
-.BI "MS_HPTIME2EPOCH(X) X / HPTMODULUS"
-
-.BI "hptime_t \fBms_btime2hptime\fP ( BTime *" btime " );"
-
-.BI "char *\fBms_btime2isotimestr\fP ( BTime *" btime ", char *" isotimestr " );"
-
-.BI "char *\fBms_btime2mdtimestr\fP ( BTime *" btime ", char *" mdtimestr " );"
-
-.BI "char *\fBms_btime2seedtimestr\fP ( BTime *" btime ", char *" seedtimestr " );"
-
-.BI "int \fBms_hptime2btime\fP ( hptime_t " hptime ", BTime *" btime " );"
-
-.BI "char *\fBms_hptime2isotimestr\fP ( hptime_t " hptime ", char *" isotimestr ","
-.BI " flag " subseconds " );"
-
-.BI "char *\fBms_hptime2mdtimestr\fP ( hptime_t " hptime ", char *" mdtimestr ","
-.BI " flag " subseconds " );"
-
-.BI "char *\fBms_hptime2seedtimestr\fP ( hptime_t " hptime ", char *" seedtimestr ","
-.BI " flag " subseconds " );"
-
-.BI "hptime_t \fBms_time2hptime\fP ( int " year ", int " day ", int " hour ", int " min ","
-.BI " int " sec ", int " usec " );"
-
-.BI "hptime_t \fBms_seedtimestr2hptime\fP ( char *" seedtimestr " );"
-
-.BI "hptime_t \fBms_timestr2hptime\fP ( char *" timestr " );"
-.fi
-
-.SH DESCRIPTION
-These routines convert between various time formats. Internally,
-libmseed represents time values as high precision epoch times
-(hptime), the number of ticks from the epoch: 00:00:00.00 1 January
-1970. By default a tick is defined as a microsecond (0.000001
-seconds). See \fBINTERNAL HPTIME\fP below for more details. Also
-used is the SEED binary time represented by the following data
-structure (defined in libmseed.h):
-.sp
-.nf
-typedef struct btime_s
-{
- uint16_t year; /* year with century */
- uint16_t day; /* day, 1 - 366 */
- uint8_t hour; /* hour, 0 - 23 */
- uint8_t min; /* minute, 0 - 59 */
- uint8_t sec; /* second, 0 - 60 (60 = leap second) */
- uint8_t unused; /* unused alignment byte */
- uint16_t fract; /* fractional seconds, 0 - 9999 */
-} BTime;
-.fi
-
-\fBMS_EPOCH2HPTIME\fP is a macro which converts a Unix/POSIX epoch
-time (elapsed seconds since 1 January 1970) to a hptime which are
-related by a simple scaling factor.
-
-\fBMS_HPTIME2EPOCH\fP is a macro which converts an hptime to a
-Unix/POSIX epoch time (elapsed seconds since 1 January 1970) which are
-related by a simple scaling factor. The result can be cast to an
-integer, in which cast no rounding is performed and sub-second
-precision is truncated, or can be cast into a double to get a double
-precision epoch time.
-
-\fBms_btime2hptime\fP converts a \fIbtime\fP to a hptime.
-
-\fBms_btime2isotimestr\fP generates an ISO recommended format time
-string from a \fIbtime\fP. Example: '2001-07-29T12:38:00.0000'. The
-\fIisotimestr\fP must have enough room for 25 characters. The
-resulting string will be NULL terminated.
-
-\fBms_btime2mdtimestr\fP generates a month-day formatted time string
-from a \fIbtime\fP. Example: '2001-07-29 12:38:00.0000'. The
-\fImdtimestr\fP must have enough room for 25 characters. The
-resulting string will be NULL terminated.
-
-\fBms_btime2seedtimestr\fP generates a SEED format time string from a
-\fIbtime\fP. Example: '2001,195,12:38:00.0000'. The
-\fIseedtimestr\fP must have enough room for 23 characters. The
-resulting string will be NULL terminated.
-
-\fBms_hptime2btime\fP converts a \fIhptime\fP to a \fIbtime\fP. By
-default, hptime has microsecond precision whereas a BTime structure
-can only represent time to 0.0001 seconds. The precision will be lost
-during this conversion, it will not be accounted for by rounding but
-will be truncated. This behavior is by design.
-
-\fBms_hptime2isotimestr\fP generates an ISO recommended format time
-string from a \fIhptime\fP. Example: '2001-07-29T12:38:00.000000'
-or '2001-07-29T12:38:00'. The \fIisotimestr\fP must have enough room
-for 27 characters. The \fIsubseconds\fP flag controls whether the
-sub-second precision is included or not. The resulting string will be
-NULL terminated.
-
-\fBms_hptime2mdtimestr\fP generates a month-day formatted time string
-from a \fIhptime\fP. Example: '2001-07-29 12:38:00.000000'
-or '2001-07-29 12:38:00'. The \fIisotimestr\fP must have enough room
-for 27 characters. The \fIsubseconds\fP flag controls whether the
-sub-second precision is included or not. The resulting string will be
-NULL terminated.
-
-\fBms_hptime2seedtimestr\fP generates a SEED format time string from a
-\fIhptime\fP. Example: '2001,195,12:38:00.000000'
-or '2001,195,12:38:00'. The \fIseedtimestr\fP must have enough room
-for 25 characters. The \fIsubseconds\fP flag controls whether the
-sub-second precision is included or not. The resulting string will be
-NULL terminated.
-
-\fBms_time2hptime\fP converts the time represented by the specified
-\fIyear\fP, \fIday\fP, \fIhour\fP, \fImin\fP, \fIsec\fP and \fIusec\fP
-(microseconds) to an hptime. The range expected for each value is as
-follows:
-.sp
-.nf
-year : 1800 - 5000
-day : 1 - 366 (366 = last day of leap year)
-hour : 0 - 23
-min : 0 - 59
-sec : 0 - 60 (60 = leap second)
-usec : 0 - 999999
-.fi
-
-\fBNOTE:\fP miniSEED data records are only supported by limbseed with
-a year range between 1900 and 2100. These routines allow a wider
-range to support times for metadata, etc.
-
-\fBms_seedtimestr2hptime\fP converts a SEED time string (day-of-year
-style) to a high precision epoch time. The time format expected is
-"YYYY[,DDD,HH,MM,SS.FFFFFF]", the delimiter can be a comma [,], dash
-[-], colon [:] or period [.]. Additionally a 'T' or space may be used
-to seprate the day and hour fields. The fractional seconds ("FFFFFF")
-must begin with a period [.] if present.
-
-\fBms_timestr2hptime\fP converts a generic time string to a high
-precision epoch time. SEED time format is
-"YYYY[/MM/DD HH:MM:SS.FFFF]", the delimiter can be a dash [-],
-comma[,], slash [/], colon [:], or period [.]. Additionally a 'T' or
-space may be used between the date and time fields. The fractional
-seconds ("FFFFFF") must begin with a period [.] if present.
-
-For both \fBms_seedtimestr2hptime\fP and \fBms_timestr2hptime\fP the
-input time string may be "short", in which case the vales omitted on
-the right hand side are assumed to be 0 (with the exception of month
-and day which are assumed to be 1). The year is always required.
-This characteristic means that these time string parsers are very
-lenient and should not be used for validation or considered to be
-applying any strict validation.
-
-.SH RETURN VALUES
-\fBms_btime2hptime\fP, \fBms_time2hptime\fP,
-\fBms_seedtimestr2hptime\fP and \fBms_timestr2hptime\fP return a
-hptime on success and HPTERROR on error.
-
-\fBms_btime2isotimestr\fP, \fBms_btime2mdtimestr\fP,
-\fBms_btime2seedtimestr\fP, \fBms_hptime2isotimestr\fP,
-\fBms_hptime2mdtimestr\fP and \fBms_hptime2seedtimestr\fP return a
-pointer to the resulting string or NULL on error.
-
-\fBms_hptime2btime\fP returns 0 on success and -1 on error.
-
-.SH INTERNAL HPTIME
-The time values internal to libmseed are defined as the number of
-ticks from the epoch: 00:00:00.00 1 January 1970 and often referred to
-as hptime. By default a tick is defined as a microsecond (0.000001
-seconds). The tick interval, and thus hptime precision, is controlled
-by the definition of HPTMODULUS in libmseed.h. It is not recommended
-to change HPTMODULUS from the default value of 1000000.
-
-This epoch time system is similar to the Unix/POSIX epoch times except
-that the ticks are higher precision than the 1-second ticks used in
-POSIX. An hptime can always be converted to a Unix/POSIX epoch time
-by dividing hptime by HPTMODULUS (reducing the hptime to second
-precision) and vise-versa, see the documentation for the
-MS_HPTIME2EPOCH and MS_EPOCH2HPTIME macros above.
-
-As long as the system's \fPgmtime\fP function supports negative epoch
-times the internal time routines will be able to represent times
-earlier than the epoch, i.e. times earlier than 1 January 1970.
-
-The hptime values are stored as 64-bit integers to allow high
-precision and avoid accumulation errors associated with floating point
-values.
-
-A special value defined as HPTERROR in libmseed.h is used to represent
-errors for routines returning hptime.
-
-.SH ACKNOWLEDGEMENTS
-
-With software provided by http://2038bug.com/ (site offline, checked Oct. 2017)
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_seedtimestr2hptime.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_seedtimestr2hptime.3
new file mode 120000
index 000000000..e8efb393e
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_seedtimestr2hptime.3
@@ -0,0 +1 @@
+ms_time.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_selection.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_selection.3
index 625b2cd3b..7fdc4fe77 100644
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_selection.3
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_selection.3
@@ -62,7 +62,7 @@ a selection entry to the \fIselections\fP list. The \fInet\fP,
are used to create a \fIsrcname\fP. The name components may contain
globbing characters for matching including wildcards and character
sets, see \fBSRCNAME MATCHING\fP below. If a name component is not
-specified a wildard matching all entries will be subsituted,
+specified a wildard matching all entries will be substituted,
i.e. \fInet\fP==NULL will be interpreted to match all network codes.
As a special case a \fIloc\fP value of "--" will be translated to and
empty string to match the srcname representation of a blank
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_strncpopen.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_strncpopen.3
deleted file mode 100644
index d2ca3cfab..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_strncpopen.3
+++ /dev/null
@@ -1,40 +0,0 @@
-.TH MS_STRNCPCLEAN 3 2004/11/22 "Libmseed API"
-.SH NAME
-ms_strncpclean - Non-standard string copying
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "int \fBms_strncpclean\fP ( char *" dest ", const char *" source ", int " length " );"
-
-.BI "int \fBms_strncpopen\fP ( char *" dest ", const char *" source ", int " length " );"
-.fi
-
-.SH DESCRIPTION
-\fBms_strncpclean\fP copies up to \fIlength\fP characters from
-\fIsource\fP to \fIdest\fP while removing all spaces. The result is
-left justified and always NULL terminated. The destination string
-must have enough room for the non-space characters within \fIlength\fP
-and the NULL terminator, a maximum of \fPlength\fP + 1.
-
-\fBms_strncpopen\fP copies \fIlength\fP characters from \fIsource\fP
-to \fIdest\fP padding the right side with spaces if needed and leaves
-the string open-ended (unterminated). The result will always be
-\fIlength\fP characters and will never be NULL terminated.
-
-These routines are useful for converting to and from known length SEED
-string fields.
-
-.SH RETURN VALUES
-\fBms_strncpclean\fP returns the number of characters (not including
-the terminating NULL) in the destination string.
-
-\fBms_strncpopen\fP returns the number of characters copied from the
-source string.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_strncpopen.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_strncpopen.3
new file mode 120000
index 000000000..a62085d32
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_strncpopen.3
@@ -0,0 +1 @@
+ms_strncpclean.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_time2hptime.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_time2hptime.3
deleted file mode 100644
index d9d1c6371..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_time2hptime.3
+++ /dev/null
@@ -1,202 +0,0 @@
-.TH MS_TIME 3 2013/02/22 "Libmseed API"
-.SH NAME
-ms_time - Time conversion and string generation
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "MS_EPOCH2HPTIME(X) X * (hptime_t) HPTMODULUS"
-.BI "MS_HPTIME2EPOCH(X) X / HPTMODULUS"
-
-.BI "hptime_t \fBms_btime2hptime\fP ( BTime *" btime " );"
-
-.BI "char *\fBms_btime2isotimestr\fP ( BTime *" btime ", char *" isotimestr " );"
-
-.BI "char *\fBms_btime2mdtimestr\fP ( BTime *" btime ", char *" mdtimestr " );"
-
-.BI "char *\fBms_btime2seedtimestr\fP ( BTime *" btime ", char *" seedtimestr " );"
-
-.BI "int \fBms_hptime2btime\fP ( hptime_t " hptime ", BTime *" btime " );"
-
-.BI "char *\fBms_hptime2isotimestr\fP ( hptime_t " hptime ", char *" isotimestr ","
-.BI " flag " subseconds " );"
-
-.BI "char *\fBms_hptime2mdtimestr\fP ( hptime_t " hptime ", char *" mdtimestr ","
-.BI " flag " subseconds " );"
-
-.BI "char *\fBms_hptime2seedtimestr\fP ( hptime_t " hptime ", char *" seedtimestr ","
-.BI " flag " subseconds " );"
-
-.BI "hptime_t \fBms_time2hptime\fP ( int " year ", int " day ", int " hour ", int " min ","
-.BI " int " sec ", int " usec " );"
-
-.BI "hptime_t \fBms_seedtimestr2hptime\fP ( char *" seedtimestr " );"
-
-.BI "hptime_t \fBms_timestr2hptime\fP ( char *" timestr " );"
-.fi
-
-.SH DESCRIPTION
-These routines convert between various time formats. Internally,
-libmseed represents time values as high precision epoch times
-(hptime), the number of ticks from the epoch: 00:00:00.00 1 January
-1970. By default a tick is defined as a microsecond (0.000001
-seconds). See \fBINTERNAL HPTIME\fP below for more details. Also
-used is the SEED binary time represented by the following data
-structure (defined in libmseed.h):
-.sp
-.nf
-typedef struct btime_s
-{
- uint16_t year; /* year with century */
- uint16_t day; /* day, 1 - 366 */
- uint8_t hour; /* hour, 0 - 23 */
- uint8_t min; /* minute, 0 - 59 */
- uint8_t sec; /* second, 0 - 60 (60 = leap second) */
- uint8_t unused; /* unused alignment byte */
- uint16_t fract; /* fractional seconds, 0 - 9999 */
-} BTime;
-.fi
-
-\fBMS_EPOCH2HPTIME\fP is a macro which converts a Unix/POSIX epoch
-time (elapsed seconds since 1 January 1970) to a hptime which are
-related by a simple scaling factor.
-
-\fBMS_HPTIME2EPOCH\fP is a macro which converts an hptime to a
-Unix/POSIX epoch time (elapsed seconds since 1 January 1970) which are
-related by a simple scaling factor. The result can be cast to an
-integer, in which cast no rounding is performed and sub-second
-precision is truncated, or can be cast into a double to get a double
-precision epoch time.
-
-\fBms_btime2hptime\fP converts a \fIbtime\fP to a hptime.
-
-\fBms_btime2isotimestr\fP generates an ISO recommended format time
-string from a \fIbtime\fP. Example: '2001-07-29T12:38:00.0000'. The
-\fIisotimestr\fP must have enough room for 25 characters. The
-resulting string will be NULL terminated.
-
-\fBms_btime2mdtimestr\fP generates a month-day formatted time string
-from a \fIbtime\fP. Example: '2001-07-29 12:38:00.0000'. The
-\fImdtimestr\fP must have enough room for 25 characters. The
-resulting string will be NULL terminated.
-
-\fBms_btime2seedtimestr\fP generates a SEED format time string from a
-\fIbtime\fP. Example: '2001,195,12:38:00.0000'. The
-\fIseedtimestr\fP must have enough room for 23 characters. The
-resulting string will be NULL terminated.
-
-\fBms_hptime2btime\fP converts a \fIhptime\fP to a \fIbtime\fP. By
-default, hptime has microsecond precision whereas a BTime structure
-can only represent time to 0.0001 seconds. The precision will be lost
-during this conversion, it will not be accounted for by rounding but
-will be truncated. This behavior is by design.
-
-\fBms_hptime2isotimestr\fP generates an ISO recommended format time
-string from a \fIhptime\fP. Example: '2001-07-29T12:38:00.000000'
-or '2001-07-29T12:38:00'. The \fIisotimestr\fP must have enough room
-for 27 characters. The \fIsubseconds\fP flag controls whether the
-sub-second precision is included or not. The resulting string will be
-NULL terminated.
-
-\fBms_hptime2mdtimestr\fP generates a month-day formatted time string
-from a \fIhptime\fP. Example: '2001-07-29 12:38:00.000000'
-or '2001-07-29 12:38:00'. The \fIisotimestr\fP must have enough room
-for 27 characters. The \fIsubseconds\fP flag controls whether the
-sub-second precision is included or not. The resulting string will be
-NULL terminated.
-
-\fBms_hptime2seedtimestr\fP generates a SEED format time string from a
-\fIhptime\fP. Example: '2001,195,12:38:00.000000'
-or '2001,195,12:38:00'. The \fIseedtimestr\fP must have enough room
-for 25 characters. The \fIsubseconds\fP flag controls whether the
-sub-second precision is included or not. The resulting string will be
-NULL terminated.
-
-\fBms_time2hptime\fP converts the time represented by the specified
-\fIyear\fP, \fIday\fP, \fIhour\fP, \fImin\fP, \fIsec\fP and \fIusec\fP
-(microseconds) to an hptime. The range expected for each value is as
-follows:
-.sp
-.nf
-year : 1800 - 5000
-day : 1 - 366 (366 = last day of leap year)
-hour : 0 - 23
-min : 0 - 59
-sec : 0 - 60 (60 = leap second)
-usec : 0 - 999999
-.fi
-
-\fBNOTE:\fP miniSEED data records are only supported by limbseed with
-a year range between 1900 and 2100. These routines allow a wider
-range to support times for metadata, etc.
-
-\fBms_seedtimestr2hptime\fP converts a SEED time string (day-of-year
-style) to a high precision epoch time. The time format expected is
-"YYYY[,DDD,HH,MM,SS.FFFFFF]", the delimiter can be a comma [,], dash
-[-], colon [:] or period [.]. Additionally a 'T' or space may be used
-to seprate the day and hour fields. The fractional seconds ("FFFFFF")
-must begin with a period [.] if present.
-
-\fBms_timestr2hptime\fP converts a generic time string to a high
-precision epoch time. SEED time format is
-"YYYY[/MM/DD HH:MM:SS.FFFF]", the delimiter can be a dash [-],
-comma[,], slash [/], colon [:], or period [.]. Additionally a 'T' or
-space may be used between the date and time fields. The fractional
-seconds ("FFFFFF") must begin with a period [.] if present.
-
-For both \fBms_seedtimestr2hptime\fP and \fBms_timestr2hptime\fP the
-input time string may be "short", in which case the vales omitted on
-the right hand side are assumed to be 0 (with the exception of month
-and day which are assumed to be 1). The year is always required.
-This characteristic means that these time string parsers are very
-lenient and should not be used for validation or considered to be
-applying any strict validation.
-
-.SH RETURN VALUES
-\fBms_btime2hptime\fP, \fBms_time2hptime\fP,
-\fBms_seedtimestr2hptime\fP and \fBms_timestr2hptime\fP return a
-hptime on success and HPTERROR on error.
-
-\fBms_btime2isotimestr\fP, \fBms_btime2mdtimestr\fP,
-\fBms_btime2seedtimestr\fP, \fBms_hptime2isotimestr\fP,
-\fBms_hptime2mdtimestr\fP and \fBms_hptime2seedtimestr\fP return a
-pointer to the resulting string or NULL on error.
-
-\fBms_hptime2btime\fP returns 0 on success and -1 on error.
-
-.SH INTERNAL HPTIME
-The time values internal to libmseed are defined as the number of
-ticks from the epoch: 00:00:00.00 1 January 1970 and often referred to
-as hptime. By default a tick is defined as a microsecond (0.000001
-seconds). The tick interval, and thus hptime precision, is controlled
-by the definition of HPTMODULUS in libmseed.h. It is not recommended
-to change HPTMODULUS from the default value of 1000000.
-
-This epoch time system is similar to the Unix/POSIX epoch times except
-that the ticks are higher precision than the 1-second ticks used in
-POSIX. An hptime can always be converted to a Unix/POSIX epoch time
-by dividing hptime by HPTMODULUS (reducing the hptime to second
-precision) and vise-versa, see the documentation for the
-MS_HPTIME2EPOCH and MS_EPOCH2HPTIME macros above.
-
-As long as the system's \fPgmtime\fP function supports negative epoch
-times the internal time routines will be able to represent times
-earlier than the epoch, i.e. times earlier than 1 January 1970.
-
-The hptime values are stored as 64-bit integers to allow high
-precision and avoid accumulation errors associated with floating point
-values.
-
-A special value defined as HPTERROR in libmseed.h is used to represent
-errors for routines returning hptime.
-
-.SH ACKNOWLEDGEMENTS
-
-With software provided by http://2038bug.com/ (site offline, checked Oct. 2017)
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_time2hptime.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_time2hptime.3
new file mode 120000
index 000000000..e8efb393e
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_time2hptime.3
@@ -0,0 +1 @@
+ms_time.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_timestr2hptime.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_timestr2hptime.3
deleted file mode 100644
index d9d1c6371..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/ms_timestr2hptime.3
+++ /dev/null
@@ -1,202 +0,0 @@
-.TH MS_TIME 3 2013/02/22 "Libmseed API"
-.SH NAME
-ms_time - Time conversion and string generation
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "MS_EPOCH2HPTIME(X) X * (hptime_t) HPTMODULUS"
-.BI "MS_HPTIME2EPOCH(X) X / HPTMODULUS"
-
-.BI "hptime_t \fBms_btime2hptime\fP ( BTime *" btime " );"
-
-.BI "char *\fBms_btime2isotimestr\fP ( BTime *" btime ", char *" isotimestr " );"
-
-.BI "char *\fBms_btime2mdtimestr\fP ( BTime *" btime ", char *" mdtimestr " );"
-
-.BI "char *\fBms_btime2seedtimestr\fP ( BTime *" btime ", char *" seedtimestr " );"
-
-.BI "int \fBms_hptime2btime\fP ( hptime_t " hptime ", BTime *" btime " );"
-
-.BI "char *\fBms_hptime2isotimestr\fP ( hptime_t " hptime ", char *" isotimestr ","
-.BI " flag " subseconds " );"
-
-.BI "char *\fBms_hptime2mdtimestr\fP ( hptime_t " hptime ", char *" mdtimestr ","
-.BI " flag " subseconds " );"
-
-.BI "char *\fBms_hptime2seedtimestr\fP ( hptime_t " hptime ", char *" seedtimestr ","
-.BI " flag " subseconds " );"
-
-.BI "hptime_t \fBms_time2hptime\fP ( int " year ", int " day ", int " hour ", int " min ","
-.BI " int " sec ", int " usec " );"
-
-.BI "hptime_t \fBms_seedtimestr2hptime\fP ( char *" seedtimestr " );"
-
-.BI "hptime_t \fBms_timestr2hptime\fP ( char *" timestr " );"
-.fi
-
-.SH DESCRIPTION
-These routines convert between various time formats. Internally,
-libmseed represents time values as high precision epoch times
-(hptime), the number of ticks from the epoch: 00:00:00.00 1 January
-1970. By default a tick is defined as a microsecond (0.000001
-seconds). See \fBINTERNAL HPTIME\fP below for more details. Also
-used is the SEED binary time represented by the following data
-structure (defined in libmseed.h):
-.sp
-.nf
-typedef struct btime_s
-{
- uint16_t year; /* year with century */
- uint16_t day; /* day, 1 - 366 */
- uint8_t hour; /* hour, 0 - 23 */
- uint8_t min; /* minute, 0 - 59 */
- uint8_t sec; /* second, 0 - 60 (60 = leap second) */
- uint8_t unused; /* unused alignment byte */
- uint16_t fract; /* fractional seconds, 0 - 9999 */
-} BTime;
-.fi
-
-\fBMS_EPOCH2HPTIME\fP is a macro which converts a Unix/POSIX epoch
-time (elapsed seconds since 1 January 1970) to a hptime which are
-related by a simple scaling factor.
-
-\fBMS_HPTIME2EPOCH\fP is a macro which converts an hptime to a
-Unix/POSIX epoch time (elapsed seconds since 1 January 1970) which are
-related by a simple scaling factor. The result can be cast to an
-integer, in which cast no rounding is performed and sub-second
-precision is truncated, or can be cast into a double to get a double
-precision epoch time.
-
-\fBms_btime2hptime\fP converts a \fIbtime\fP to a hptime.
-
-\fBms_btime2isotimestr\fP generates an ISO recommended format time
-string from a \fIbtime\fP. Example: '2001-07-29T12:38:00.0000'. The
-\fIisotimestr\fP must have enough room for 25 characters. The
-resulting string will be NULL terminated.
-
-\fBms_btime2mdtimestr\fP generates a month-day formatted time string
-from a \fIbtime\fP. Example: '2001-07-29 12:38:00.0000'. The
-\fImdtimestr\fP must have enough room for 25 characters. The
-resulting string will be NULL terminated.
-
-\fBms_btime2seedtimestr\fP generates a SEED format time string from a
-\fIbtime\fP. Example: '2001,195,12:38:00.0000'. The
-\fIseedtimestr\fP must have enough room for 23 characters. The
-resulting string will be NULL terminated.
-
-\fBms_hptime2btime\fP converts a \fIhptime\fP to a \fIbtime\fP. By
-default, hptime has microsecond precision whereas a BTime structure
-can only represent time to 0.0001 seconds. The precision will be lost
-during this conversion, it will not be accounted for by rounding but
-will be truncated. This behavior is by design.
-
-\fBms_hptime2isotimestr\fP generates an ISO recommended format time
-string from a \fIhptime\fP. Example: '2001-07-29T12:38:00.000000'
-or '2001-07-29T12:38:00'. The \fIisotimestr\fP must have enough room
-for 27 characters. The \fIsubseconds\fP flag controls whether the
-sub-second precision is included or not. The resulting string will be
-NULL terminated.
-
-\fBms_hptime2mdtimestr\fP generates a month-day formatted time string
-from a \fIhptime\fP. Example: '2001-07-29 12:38:00.000000'
-or '2001-07-29 12:38:00'. The \fIisotimestr\fP must have enough room
-for 27 characters. The \fIsubseconds\fP flag controls whether the
-sub-second precision is included or not. The resulting string will be
-NULL terminated.
-
-\fBms_hptime2seedtimestr\fP generates a SEED format time string from a
-\fIhptime\fP. Example: '2001,195,12:38:00.000000'
-or '2001,195,12:38:00'. The \fIseedtimestr\fP must have enough room
-for 25 characters. The \fIsubseconds\fP flag controls whether the
-sub-second precision is included or not. The resulting string will be
-NULL terminated.
-
-\fBms_time2hptime\fP converts the time represented by the specified
-\fIyear\fP, \fIday\fP, \fIhour\fP, \fImin\fP, \fIsec\fP and \fIusec\fP
-(microseconds) to an hptime. The range expected for each value is as
-follows:
-.sp
-.nf
-year : 1800 - 5000
-day : 1 - 366 (366 = last day of leap year)
-hour : 0 - 23
-min : 0 - 59
-sec : 0 - 60 (60 = leap second)
-usec : 0 - 999999
-.fi
-
-\fBNOTE:\fP miniSEED data records are only supported by limbseed with
-a year range between 1900 and 2100. These routines allow a wider
-range to support times for metadata, etc.
-
-\fBms_seedtimestr2hptime\fP converts a SEED time string (day-of-year
-style) to a high precision epoch time. The time format expected is
-"YYYY[,DDD,HH,MM,SS.FFFFFF]", the delimiter can be a comma [,], dash
-[-], colon [:] or period [.]. Additionally a 'T' or space may be used
-to seprate the day and hour fields. The fractional seconds ("FFFFFF")
-must begin with a period [.] if present.
-
-\fBms_timestr2hptime\fP converts a generic time string to a high
-precision epoch time. SEED time format is
-"YYYY[/MM/DD HH:MM:SS.FFFF]", the delimiter can be a dash [-],
-comma[,], slash [/], colon [:], or period [.]. Additionally a 'T' or
-space may be used between the date and time fields. The fractional
-seconds ("FFFFFF") must begin with a period [.] if present.
-
-For both \fBms_seedtimestr2hptime\fP and \fBms_timestr2hptime\fP the
-input time string may be "short", in which case the vales omitted on
-the right hand side are assumed to be 0 (with the exception of month
-and day which are assumed to be 1). The year is always required.
-This characteristic means that these time string parsers are very
-lenient and should not be used for validation or considered to be
-applying any strict validation.
-
-.SH RETURN VALUES
-\fBms_btime2hptime\fP, \fBms_time2hptime\fP,
-\fBms_seedtimestr2hptime\fP and \fBms_timestr2hptime\fP return a
-hptime on success and HPTERROR on error.
-
-\fBms_btime2isotimestr\fP, \fBms_btime2mdtimestr\fP,
-\fBms_btime2seedtimestr\fP, \fBms_hptime2isotimestr\fP,
-\fBms_hptime2mdtimestr\fP and \fBms_hptime2seedtimestr\fP return a
-pointer to the resulting string or NULL on error.
-
-\fBms_hptime2btime\fP returns 0 on success and -1 on error.
-
-.SH INTERNAL HPTIME
-The time values internal to libmseed are defined as the number of
-ticks from the epoch: 00:00:00.00 1 January 1970 and often referred to
-as hptime. By default a tick is defined as a microsecond (0.000001
-seconds). The tick interval, and thus hptime precision, is controlled
-by the definition of HPTMODULUS in libmseed.h. It is not recommended
-to change HPTMODULUS from the default value of 1000000.
-
-This epoch time system is similar to the Unix/POSIX epoch times except
-that the ticks are higher precision than the 1-second ticks used in
-POSIX. An hptime can always be converted to a Unix/POSIX epoch time
-by dividing hptime by HPTMODULUS (reducing the hptime to second
-precision) and vise-versa, see the documentation for the
-MS_HPTIME2EPOCH and MS_EPOCH2HPTIME macros above.
-
-As long as the system's \fPgmtime\fP function supports negative epoch
-times the internal time routines will be able to represent times
-earlier than the epoch, i.e. times earlier than 1 January 1970.
-
-The hptime values are stored as 64-bit integers to allow high
-precision and avoid accumulation errors associated with floating point
-values.
-
-A special value defined as HPTERROR in libmseed.h is used to represent
-errors for routines returning hptime.
-
-.SH ACKNOWLEDGEMENTS
-
-With software provided by http://2038bug.com/ (site offline, checked Oct. 2017)
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/ms_timestr2hptime.3 b/bin/rt/orb2ringserver/libmseed/doc/ms_timestr2hptime.3
new file mode 120000
index 000000000..e8efb393e
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/ms_timestr2hptime.3
@@ -0,0 +1 @@
+ms_time.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/msr_endtime.3 b/bin/rt/orb2ringserver/libmseed/doc/msr_endtime.3
deleted file mode 100644
index 5a233f330..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/msr_endtime.3
+++ /dev/null
@@ -1,59 +0,0 @@
-.TH MSR_STARTTIME 3 2015/03/02 "Libmseed API"
-.SH NAME
-msr_starttime - Start and end time determination for MSRecord structures
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "hptime_t \fBmsr_starttime\fP ( MSRecord *" msr " );"
-
-.BI "hptime_t \fBmsr_starttime_uc\fP ( MSRecord *" msr " );"
-
-.BI "hptime_t \fBmsr_endtime\fP ( MSRecord *" msr " );"
-.fi
-
-.SH DESCRIPTION
-\fBmsr_starttime\fP returns the start time of the record as a high
-precision epoch time (see \fBms_time(3)\fP). Any time correction
-given in the fixed section data header is applied if it has not
-already been applied. If Blockette 1001 is included and parsed the
-microseconds indicated (field 4) are also applied.
-
-NOTE: The record start time for a MSRecord structure is available
-directly at MSRecord.starttime. Libmseed based programs should use
-that start time whenever possible (\fBmsr_unpack\fP uses
-\fBmsr_starttime\fP to set MSRecord.starttime).
-
-\fBmsr_starttime_uc\fP is a version of \fBmsr_starttime\fP that
-applies no time corrections, just a basic conversion of the start time
-values in the fixed section data header.
-
-\fBmsr_endtime\fP returns the time of the last sample in the record as
-a high precision epoch time (seed \fBms_time(3)\fP). This is *not*
-the time "covered" by the last sample, but the actual sample time.
-This function calculates the record start time with
-\fBmsr_starttime\fP and then adds the time covered by the samples in
-the record which is calculated from the number of samples and sample
-rate.
-
-\fBmsr_endtime\fP will adjust the end time appropriately if the record
-is known to contain a positive leap second. If the
-\fBms_readleapseconds\fP or \fBms_readleapsecondfile\fP routines have
-been called to read a leap second file into an internal list, it will
-be checked to know when leap seconds occur. If a leap second list is
-not available the fixed section data header is checked for a positive
-leap second indicator.
-
-.SH RETURN VALUES
-\fBmsr_starttime\fP, \fBmsr_starttime_uc\fP and \fBmsr_endtime\fP
-return a high precision epoch time on success and HPTERROR on error.
-
-.SH SEE ALSO
-\fBms_intro(3)\fP, \fBms_time(3)\fP and \fBmsr_unpack(3)\fP
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/msr_endtime.3 b/bin/rt/orb2ringserver/libmseed/doc/msr_endtime.3
new file mode 120000
index 000000000..6f0600aaf
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/msr_endtime.3
@@ -0,0 +1 @@
+msr_starttime.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/msr_free.3 b/bin/rt/orb2ringserver/libmseed/doc/msr_free.3
deleted file mode 100644
index c619399e0..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/msr_free.3
+++ /dev/null
@@ -1,43 +0,0 @@
-.TH MSR_INIT 3 2006/02/27 "Libmseed API"
-.SH NAME
-msr_init - Initializing and freeing MSRecord and related structures
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "MSRecord *\fBmsr_init\fP ( MSRecord *" msr " );
-
-.BI "void \fBmsr_free\fP ( MSRecord **" ppmsr " );
-
-.BI "void \fBmsr_free_blktchain\fP ( MSRecord *" msr " );
-.fi
-
-.SH DESCRIPTION
-\fBmsr_init\fP will initialize a MSRecord structure. If the \fImsr\fP
-parameter is NULL a new structure will be allocated. If the \fImsr\fP
-parameter is not NULL the blockette chain (MSRecord.blkts) will be
-freed but any memory allocated for MSRecord.fsdh and
-MSRecord.datasamples will be preserved as it will cleanly be re-used
-by routines such as \fBmsr_unpack(3)\fP.
-
-\fBmsr_free\fP will free all memory associated with a MSRecord
-structure including the blockette chain and set the structure pointer
-(*ppmsr) to 0.
-
-\fBmsr_free_blktchain\fP will free all memory associated with the
-blockette chain of an MSRecord structure. The shortcut blockette
-pointers will also be reset.
-
-.SH RETURN VALUES
-\fBmsr_init\fP returns a pointer to the MSRecord structure initialized
-on success or NULL on error.
-
-.SH SEE ALSO
-\fBms_intro(3)\fP, \fBmsr_pack(3)\fP and \fBmsr_unpack(3)\fP.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/msr_free.3 b/bin/rt/orb2ringserver/libmseed/doc/msr_free.3
new file mode 120000
index 000000000..a6b5ecb49
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/msr_free.3
@@ -0,0 +1 @@
+msr_init.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/msr_free_blktchain.3 b/bin/rt/orb2ringserver/libmseed/doc/msr_free_blktchain.3
deleted file mode 100644
index c619399e0..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/msr_free_blktchain.3
+++ /dev/null
@@ -1,43 +0,0 @@
-.TH MSR_INIT 3 2006/02/27 "Libmseed API"
-.SH NAME
-msr_init - Initializing and freeing MSRecord and related structures
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "MSRecord *\fBmsr_init\fP ( MSRecord *" msr " );
-
-.BI "void \fBmsr_free\fP ( MSRecord **" ppmsr " );
-
-.BI "void \fBmsr_free_blktchain\fP ( MSRecord *" msr " );
-.fi
-
-.SH DESCRIPTION
-\fBmsr_init\fP will initialize a MSRecord structure. If the \fImsr\fP
-parameter is NULL a new structure will be allocated. If the \fImsr\fP
-parameter is not NULL the blockette chain (MSRecord.blkts) will be
-freed but any memory allocated for MSRecord.fsdh and
-MSRecord.datasamples will be preserved as it will cleanly be re-used
-by routines such as \fBmsr_unpack(3)\fP.
-
-\fBmsr_free\fP will free all memory associated with a MSRecord
-structure including the blockette chain and set the structure pointer
-(*ppmsr) to 0.
-
-\fBmsr_free_blktchain\fP will free all memory associated with the
-blockette chain of an MSRecord structure. The shortcut blockette
-pointers will also be reset.
-
-.SH RETURN VALUES
-\fBmsr_init\fP returns a pointer to the MSRecord structure initialized
-on success or NULL on error.
-
-.SH SEE ALSO
-\fBms_intro(3)\fP, \fBmsr_pack(3)\fP and \fBmsr_unpack(3)\fP.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/msr_free_blktchain.3 b/bin/rt/orb2ringserver/libmseed/doc/msr_free_blktchain.3
new file mode 120000
index 000000000..a6b5ecb49
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/msr_free_blktchain.3
@@ -0,0 +1 @@
+msr_init.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/msr_nomsamprate.3 b/bin/rt/orb2ringserver/libmseed/doc/msr_nomsamprate.3
deleted file mode 100644
index e1399fe79..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/msr_nomsamprate.3
+++ /dev/null
@@ -1,45 +0,0 @@
-.TH MSR_SAMPRATE 3 2006/02/27 "Libmseed API"
-.SH NAME
-msr_samprate - Determine sample rate from an MSRecord structure
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "double \fBmsr_samprate\fP ( MSRecord *" msr " );
-
-.BI "double \fBmsr_nomsamprate\fP ( MSRecord *" msr " );
-.fi
-
-.SH DESCRIPTION
-\fBmsr_samprate\fP will calculate a double precision sample rate in
-samples per second using the header values in the specified MSRecord.
-If a Blockette 100 is included, the "Actual sample rate" (field 3)
-will be returned, otherwise a nominal sample rate will be calculated
-from the sample rate factor and multiplier in the fixed section data
-header.
-
-NOTE: The sample rate for a MSRecord structure is available directly
-at MSRecord.samplerate. libmseed based programs should use that
-sample rate whenever possible (\fBmsr_unpack\fP uses
-\fBmsr_samprate\fP to set MSRecord.samplerate).
-
-\fBmsr_nomsamprate\fP will calculate a double precision sample rate in
-samples per second using the sample rate factor and multiplier in the
-fixed section data header.
-
-.SH RETURN VALUES
-\fBmsr_samprate\fP returns a double precision sample rate on success
-and -1.0 on error.
-
-\fBmsr_nomsamprate\fP returns a double precision sample rate on
-success and -1.0 on error.
-
-.SH SEE ALSO
-\fBms_intro(3)\fP and \fBmsr_unpack(3)\fP.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/msr_nomsamprate.3 b/bin/rt/orb2ringserver/libmseed/doc/msr_nomsamprate.3
new file mode 120000
index 000000000..48ebcb1d8
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/msr_nomsamprate.3
@@ -0,0 +1 @@
+msr_samprate.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/msr_pack_header.3 b/bin/rt/orb2ringserver/libmseed/doc/msr_pack_header.3
deleted file mode 100644
index 90d53a4f7..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/msr_pack_header.3
+++ /dev/null
@@ -1,195 +0,0 @@
-.TH MSR_PACK 3 2013/05/17 "Libmseed API"
-.SH NAME
-msr_pack - Packing of Mini-SEED records.
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "int \fBmsr_pack\fP ( MSRecord *" msr ","
-.BI " void (*" record_handler ") (char *, int, void *),"
-.BI " void *" handlerdata ", int64_t *" packedsamples ","
-.BI " flag " flush ", flag " verbose " );"
-
-.BI "int \fBmsr_pack_header\fP ( MSRecord *" msr ", flag " normalize ","
-.BI " flag " verbose " );"
-.fi
-
-.SH DESCRIPTION
-\fBmsr_pack\fP creates (packs) Mini-SEED data records. Using the
-record header values in a MSRecord data structure, \fImsr\fP, as a
-template, the common header fields and blockettes are packed into a
-record header. A Blockette 1000 will be added if one is not present
-in the template. The data samples at MSRecord.datasamples are packed
-in the encoding format indicated by the MSRecord.encoding field. The
-MSRecord.datasamples array and MSRecord.numsamples value will not be
-changed by this routine. It is the responsibility of the calling
-routine to adjust the data buffer if desired. This routine will
-modify the start time and sequence number of the MSRecord template as
-it packs records.
-
-The key characteristics of data record & quality indicator, record
-length, encoding format and byte order of packed records are taken
-from \fBMSRecord.dataquality\fP, \fBMSRecord.reclen\fP,
-\fBMSRecord.encoding\fP and \fBMSRecord.byteorder\fP respectively.
-Default values for these quantities will be used when the indicator is
-0 or the reclen, encoding or byteorder are -1 respectively. The
-default values are: dataquality = 'D', reclen = 4096 bytes, encoding =
-11 (Steim2) and byteorder = 1 (MSBF or big-endian).
-
-\fBMSRecord.dataquality\fP should be either 'D', 'R', 'Q' or 'M'.
-
-\fBMSRecord.reclen\fP should be set to the desired data record length in
-bytes which must be expressible as 2 raised to the power of X where X
-is between (and including) 8 to 20.
-
-\fBMSRecord.encoding\fP should be set to one of the following
-supported Mini-SEED data encoding formats: DE_ASCII (0), DE_INT16 (1),
-DE_INT32 (3), DE_FLOAT32 (4), DE_FLOAT64 (5), DE_STEIM1 (10) and
-DE_STEIM2 (11). The encoding aliases are defined in libmseed.h.
-
-\fBMSRecord.sampletype\fP should indicated the sample type as
-either 'a' (ASCII), 'i' (32-bit integers), 'f' (32-bit floats) or 'd'
-(64-bit doubles).
-
-The encoding format must be appropriate for the sample type. For
-example, Steim compression and integer encoding formats require
-integer samples and float encoding formats require the appropriate
-size floats as input. As a counter example, float samples cannot be
-packed using Steim compression or integer encoding formats.
-
-\fBMSRecord.byteorder\fP must be either 0 (LSBF or little-endian) or 1
-(MBF or big-endian).
-
-Each time a complete record is packed it will be passed to the
-\fIrecord_handler()\fP function which expects three arguments: 1) a
-char * to the record buffer, 2) the length of the record in bytes and
-3) a void pointer supplied by the caller. It is the responsibility of
-\fIrecord_handler()\fP to process the record, the memory will be
-re-used or freed when \fIrecord_handler()\fP returns. This function
-pointer is required, there is no other way to access the packed
-records.
-
-The \fIhandlerdata\fP pointer will be passed as the 3rd argument to
-\fIrecord_handler()\fP. This allows the caller to optionally pass
-data directly to the \fIrecord_handler()\fP.
-
-The integer pointed to by \fIpackedsamples\fP will be set to the total
-number of samples packed if not NULL.
-
-If the \fIflush\fP flag is not zero all of the data will be packed
-into records, otherwise records will only be packed while there are
-enough data samples to completely fill a record.
-
-The \fIverbose\fP flag controls verbosity, a value of zero will result
-in no diagnostic output.
-
-\fBmsr_pack_header\fP packs header information, fixed section and
-blockettes, in a MSRecord structure into the Mini-SEED record at
-MSRecord.record. This is useful for re-packing record headers after
-modification. The \fInormalize\fP flag controls whether
-msr_normalize_header() is called before the header is packed.
-Normalizing updates the SEED structures associated with the MSRecord
-with values using the MSRecord base members (e.g. MSRecord.network,
-MSRecord.samplerate, etc.). Normally this should be set to true (1)
-unless the associated SEED structures have been directly modified.
-The \fIverbose\fP flag controls verbosity, a value of zero will result
-in no diagnostic output.
-
-.SH PACKING OVERRIDES
-The following macros and environment variables effect the packing of
-Mini-SEED:
-
-.nf
-Macros:
-MS_PACKHEADERBYTEORDER(X)
-MS_PACKDATABYTEORDER(X)
-
-Environment variables:
-PACK_HEADER_BYTEORDER
-PACK_DATA_BYTEORDER
-.fi
-
-These macros and environment variables force the byte order of the
-header and data respectively. They could be set to either 0 (little
-endian) or 1 (big endian). Normally the byte order of the header and
-data is determined by the byteorder flag of the MSRecord, this
-capability is included to support any combination of byte orders in a
-generalized way.
-
-.SH COMPRESSION HISTORY
-When the encoding format is Steim 1 or 2 compression contiguous
-records will be created including compression history. Put simply,
-this means that the first difference in the compression series will be
-the difference between the first sample of the current record and the
-last sample of the previous record. For the first record in a series
-(no previous record), a so-called cold start, the first difference
-will be zero.
-
-The compression history can be seeded by allocating the StreamState
-struct for the MSRecord and setting the \fBlastintsample\fP member to
-the integer sample value that preceded the first sample in the current
-series and setting the \fBcomphistory\fP flag to true (1).
-
-.SH RETURN VALUES
-\fBmsr_pack\fP returns the number records created on success and -1 on
-error.
-
-\fBmsr_pack_header\fP returns the header length in bytes on success
-and -1 on error.
-
-.SH EXAMPLE
-Skeleton code for creating (packing) Mini-SEED records with
-msr_pack(3):
-
-.nf
-static void record_handler (char *record, int reclen, void *srcname) {
- if ( fwrite(record, reclen, 1, outfile) != 1 )
- {
- ms_log (2, "Error writing %s to output file\n", (char *)srcname);
- }
-}
-
-main() {
- int64_t psamples;
- int precords;
- MSRecord *msr;
- char srcname[50];
-
- msr = msr_init (NULL);
-
- /* Populate MSRecord values */
- strcpy (msr->network, "XX");
- strcpy (msr->station, "TEST");
- strcpy (msr->channel, "BHE");
- msr->starttime = ms_seedtimestr2hptime ("2004,350,00:00:00.00");
- msr->samprate = 40.0;
- msr->reclen = 4096; /* 4096 byte record length */
- msr->encoding = DE_STEIM2; /* Steim 2 compression */
- msr->byteorder = 1; /* big endian byte order */
-
- msr->datasamples = dataptr; /* pointer to 32-bit integer data samples */
- msr->numsamples = 1234;
- msr->sampletype = 'i'; /* declare type to be 32-bit integers */
-
- msr_srcname (msr, srcname, 0);
-
- /* Pack the record(s) */
- precords = msr_pack (msr, &record_handler, srcname, &psamples, 1, verbose);
-
- ms_log (0, "Packed %"PRId64" samples into %d records\n",
- psamples, precords);
-
- msr_free (&msr);
-}
-.fi
-
-.SH SEE ALSO
-\fBms_intro(3)\fP, \fBmst_pack(3)\fP, \fBmst_packgroup(3)\fP,
-\fBmsr_normalize_header(3)\fP and \fBmsr_unpack(3)\fP.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/msr_pack_header.3 b/bin/rt/orb2ringserver/libmseed/doc/msr_pack_header.3
new file mode 120000
index 000000000..e6d58f78f
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/msr_pack_header.3
@@ -0,0 +1 @@
+msr_pack.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/msr_parse_selection.3 b/bin/rt/orb2ringserver/libmseed/doc/msr_parse_selection.3
deleted file mode 100644
index 7de7376b3..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/msr_parse_selection.3
+++ /dev/null
@@ -1,128 +0,0 @@
-.TH MSR_PARSE 3 2013/01/07 "Libmseed API"
-.SH NAME
-msr_parse - Detect and parse a SEED data record from a memory buffer
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "int \fBmsr_parse\fP ( char *" record ", int " recbuflen ", MSRecord " **ppmsr ","
-.BI " int " reclen ", flag " dataflag ", flag " verbose " );"
-
-.BI "int \fBmsr_parse_selection\fP ( char *" recbuf ", int " recbuflen ","
-.BI " int64_t *" offset ", MSRecord " **ppmsr ","
-.BI " int " reclen ", Selections *" selections ","
-.BI " flag " dataflag ", flag " verbose " );"
-
-.BI "int \fBms_detect\fP ( const char *" record ", int " recbuflen " );"
-
-.SH DESCRIPTION
-\fBmsr_parse\fP will parse a SEED data record from the \fIrecord\fP
-buffer and populate the MSRecord structure at \fIppmsr\fP, allocating
-one if needed. The \fIrecbuflen\fP argument is the length of the
-\fIrecord\fP buffer. Records must begin at the start of the buffer.
-
-If \fIreclen\fP is 0 or negative the length of record is automatically
-determined, otherwise \fIreclen\fP should be the correct record
-length. For auto detection of record length the record should include
-a 1000 blockette or be followed by another record header in the
-buffer.
-
-If \fIdataflag\fP is true (non-zero) the data samples will be unpacked
-when parsing the record. This argument is passed directly to
-\fBmsr_unpack(3)\fP.
-
-\fBmsr_parse_selection\fP will parse the first SEED data record from
-the \fIrecbuf\fP buffer that matches the optional \fIselections\fP.
-The \fIoffset\fP value indicates where to start searching the buffer.
-On success, the MSRecord structure at \fIppmsr\fP is populated and the
-\fIoffset\fP to the record in the buffer is set. See the example
-below for the intended usage pattern.
-
-\fBms_detect\fP determines whether the supplied \fIrecord\fP buffer
-contains a SEED data record by verifying known signatures, if a record
-is found the record length is determined by:
-
-1) Searching the buffer up to \fIrecbuflen\fP for a Blockette 1000.
-
-2) If no Blockette 1000 is found search at MINRECLEN-byte offsets
-for the fixed section of the next header in the buffer, thereby
-implying the record length.
-
-.SH RETURN VALUES
-\fBmsr_parse\fP returns values:
-.nf
- 0 : On success and populates the supplied MSRecord.
- >0 : Data record was detected but not enough data is present in buffer,
- the value returned is a hint of how much more data is needed.
- <0 : On error a negative libmseed error value is returned.
-
-\fBms_detect\fP returns values:
-.nf
- -1 : Data record not detected or error
- 0 : Data record detected but could not determine length
- >0 : Length of the data record in bytes
-.fi
-
-.SH EXAMPLE USAGE OF MS_PARSE_SELECTION()
-The \fBms_parse_selection()\fP routine uses the initial setting of
-\fIoffset\fP as the starting point to search the buffer. On
-successful parsing of a miniSEED record the value of \fIoffset\fP will
-be the offset in the buffer to the record parsed.
-
-To properly parse all records matching specificed selection criteria,
-a caller must check and manage the value of \fIoffset\fP. In
-particular, when the end of the buffer is reached a value of
-MS_GENERROR will be returned and the caller should check if the offset
-is still within the buffer length to determine if this is a parsing
-error or simply the end of the buffer.
-
-The following example illustrates the intended usage:
-
-.nf
- char *recbuf = ;
- int64_t recbuflen = ;
- int64_t offset = 0;
- MSRecord *msr = NULL;
- int reclen = -1;
- Selections *selections = NULL;
- flag dataflag = 1;
- flag verbose = 0;
-
- // You probaby want to set Selections
- // For example with a call to ms_readselectionsfile (&selections, selectfile)
-
- /* Loop over all selected records in recbuf */
- while ( offset < recbuflen )
- {
- if ( msr_parse_selection (recbuf, recbuflen, &offset, &msr, reclen, selections, dataflag, verbose) )
- {
- /* Only print error if offset is still within buffer length */
- if ( verbose && offset < recbuflen )
- ms_log (2, "Error parsing record at offset %"PRId64"\n", offset);
- }
- else /* Successfully found and parsed record */
- {
- /* Do something with the record, for example print the details */
- msr_print (msr, verbose);
-
- /* Increment offset in buffer for subsequent call to msr_parse_selection() */
- offset += msr->reclen;
- }
- }
-
- /* Clean up */
- msr_free (&msr);
-
- if ( selections )
- ms_freeselections (selections);
-.fi
-
-.SH SEE ALSO
-\fBmsr_unpack(3)\fP, \fBms_parse_raw(3)\fP and \fBms_errorstr(3)\fP
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/msr_parse_selection.3 b/bin/rt/orb2ringserver/libmseed/doc/msr_parse_selection.3
new file mode 120000
index 000000000..c995cdfc8
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/msr_parse_selection.3
@@ -0,0 +1 @@
+msr_parse.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/msr_srcname.3 b/bin/rt/orb2ringserver/libmseed/doc/msr_srcname.3
deleted file mode 100644
index 551ce6f1d..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/msr_srcname.3
+++ /dev/null
@@ -1,56 +0,0 @@
-.TH MS_SRCNAME 3 2006/11/27 "Libmseed API"
-.SH NAME
-ms_srcname - Determine source names using the SEED naming nomenclature.
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "char *\fBms_recsrcname\fP ( char *" record ", char *" srcname ", flag " quality " );"
-
-.BI "char *\fBmsr_srcname\fP ( MSRecord *" msr ", char *" srcname ", flag " quality " );"
-
-.BI "char *\fBmst_srcname\fP ( MSTrace *" mst ", char *" srcname ", flag " quality " );"
-.fi
-
-.SH DESCRIPTION
-These routines generate a source name using the SEED naming
-nomenclature in the format: 'NET_STA_LOC_CHAN' and stores it in the
-buffer provided at \fIsrcname\fP. If the \fIquality\fP flag is true
-the data quality character will be appended to the source name
-resulting in a format of: 'NET_STA_LOC_CHAN_QUAL'.
-
-The memory pointed to by \fIsrcname\fP must have enough room for the
-resulting string. As of SEED 2.4 this is a maximum of 18 characters
-including the terminating NULL. The MSRecord and MSTrace structs are
-capable of producing a source name of 42 characters (including the
-terminating NULL) and libmseed commonly allocates 50 characters for
-the \fIsrcname\fP buffer.
-
-\fBms_recsrcname\fP generates a source name string for the SEED data
-record at \fIrecord\fP. If the \fIquality\fP flag is true the quality
-character will be appended.
-
-\fBmsr_srcname\fP generates a source name string for the specified
-MSRecord struct. If the \fIquality\fP flag is true the quality
-character will be appended.
-
-\fBmst_srcname\fP generates a source name string in for the specified
-MSTrace struct. If the \fIquality\fP flag is true *and*
-mst->dataquality is not zero the quality character will be appended.
-
-.SH LOCATION IDS AND SPACES
-The source name produced by these routines never include spaces. The
-fixed format nature of SEED data records leads to blank or unused
-location IDs represented by spaces. Such blank location IDs will be
-collapsed to nothing in the resulting sources names.
-
-.SH RETURN VALUES
-The routines return a pointer to the resulting string or NULL on
-error.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/msr_srcname.3 b/bin/rt/orb2ringserver/libmseed/doc/msr_srcname.3
new file mode 120000
index 000000000..7abd571d7
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/msr_srcname.3
@@ -0,0 +1 @@
+ms_srcname.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/msr_starttime_uc.3 b/bin/rt/orb2ringserver/libmseed/doc/msr_starttime_uc.3
deleted file mode 100644
index 5a233f330..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/msr_starttime_uc.3
+++ /dev/null
@@ -1,59 +0,0 @@
-.TH MSR_STARTTIME 3 2015/03/02 "Libmseed API"
-.SH NAME
-msr_starttime - Start and end time determination for MSRecord structures
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "hptime_t \fBmsr_starttime\fP ( MSRecord *" msr " );"
-
-.BI "hptime_t \fBmsr_starttime_uc\fP ( MSRecord *" msr " );"
-
-.BI "hptime_t \fBmsr_endtime\fP ( MSRecord *" msr " );"
-.fi
-
-.SH DESCRIPTION
-\fBmsr_starttime\fP returns the start time of the record as a high
-precision epoch time (see \fBms_time(3)\fP). Any time correction
-given in the fixed section data header is applied if it has not
-already been applied. If Blockette 1001 is included and parsed the
-microseconds indicated (field 4) are also applied.
-
-NOTE: The record start time for a MSRecord structure is available
-directly at MSRecord.starttime. Libmseed based programs should use
-that start time whenever possible (\fBmsr_unpack\fP uses
-\fBmsr_starttime\fP to set MSRecord.starttime).
-
-\fBmsr_starttime_uc\fP is a version of \fBmsr_starttime\fP that
-applies no time corrections, just a basic conversion of the start time
-values in the fixed section data header.
-
-\fBmsr_endtime\fP returns the time of the last sample in the record as
-a high precision epoch time (seed \fBms_time(3)\fP). This is *not*
-the time "covered" by the last sample, but the actual sample time.
-This function calculates the record start time with
-\fBmsr_starttime\fP and then adds the time covered by the samples in
-the record which is calculated from the number of samples and sample
-rate.
-
-\fBmsr_endtime\fP will adjust the end time appropriately if the record
-is known to contain a positive leap second. If the
-\fBms_readleapseconds\fP or \fBms_readleapsecondfile\fP routines have
-been called to read a leap second file into an internal list, it will
-be checked to know when leap seconds occur. If a leap second list is
-not available the fixed section data header is checked for a positive
-leap second indicator.
-
-.SH RETURN VALUES
-\fBmsr_starttime\fP, \fBmsr_starttime_uc\fP and \fBmsr_endtime\fP
-return a high precision epoch time on success and HPTERROR on error.
-
-.SH SEE ALSO
-\fBms_intro(3)\fP, \fBms_time(3)\fP and \fBmsr_unpack(3)\fP
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/msr_starttime_uc.3 b/bin/rt/orb2ringserver/libmseed/doc/msr_starttime_uc.3
new file mode 120000
index 000000000..6f0600aaf
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/msr_starttime_uc.3
@@ -0,0 +1 @@
+msr_starttime.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/msr_writemseed.3 b/bin/rt/orb2ringserver/libmseed/doc/msr_writemseed.3
deleted file mode 100644
index ca91d15ad..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/msr_writemseed.3
+++ /dev/null
@@ -1,99 +0,0 @@
-.TH MS_WRITEMSEED 3 2011/01/06 "Libmseed API"
-.SH NAME
-ms_writemseed - Write Mini-SEED records to files.
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "int \fBmsr_writemseed\fP ( MSRecord *" msr ", char *" msfile ", flag " overwrite ","
-.BI " int " reclen ", flag " encoding ", flag " byteorder ","
-.BI " flag " verbose " );"
-
-.BI "int \fBmst_writemseed\fP ( MSTrace *" mst ", char *" msfile ", flag " overwrite ","
-.BI " int " reclen ", flag " encoding ", flag " byteorder ","
-.BI " flag " verbose " );"
-
-.BI "int \fBmst_writemseedgroup\fP ( MSTraceGroup *" msr ", char *" msfile ","
-.BI " flag " overwrite ", int " reclen ", flag " encoding ","
-.BI " flag " byteorder ", flag " verbose " );"
-.fi
-
-.SH DESCRIPTION
-These routines will packed the data contained in the \fBMSRecord\fP,
-\fBMSTrace\fP or \fBMSTraceGroup\fP into Mini-SEED records and write
-them to the specified file. The \fIoverwrite\fP flag controls whether
-the output file is overwritten or appended to.
-
-Mini-SEED records are created using the specified record length
-(\fIreclen\fP), Mini-SEED \fIencoding\fP and \fIbyteorder\fP. Default
-values will be used for any of the key characteristics of record
-length, encoding format and byte order that are specified as -1. The
-default values are: reclen = 4096 bytes, encoding = 11 (Steim2) and
-byteorder = 1 (MSBF or big-endian).
-
-\fIreclen\fP should be set to the desired data record length in bytes
-which must be expressible as 2 raised to the power of X where X is
-between (and including) 8 to 20.
-
-\fIencoding\fP should be set to one of the following supported
-Mini-SEED data encoding formats: DE_ASCII (0), DE_INT16 (1), DE_INT32
-(3), DE_FLOAT32 (4), DE_FLOAT64 (5), DE_STEIM1 (10) and DE_STEIM2
-(11). The encoding aliases are defined in libmseed.h.
-MSTrace.sampletype should indicated the sample type as either 'a'
-(ASCII), 'i' (32-bit integers), 'f' (32-bit floats) or 'd' (64-bit
-doubles).
-
-The encoding format must be appropriate for the sample type of the
-MSTrace samples. For example, Steim compression and integer encoding
-formats require integer samples and float encoding formats require the
-appropriate size floats as input. As a counter example, float samples
-cannot be packed using Steim compression or integer encoding formats.
-
-\fIbyteorder\fP must be either 0 (LSBF or little-endian) or 1 (MBF or
-big-endian).
-
-The \fIverbose\fP flag controls verbosity, a value of zero will result
-in no diagnostic output.
-
-.SH RETURN VALUES
-All of these routines return the number of records written on success
-and -1 on error.
-
-.SH EXAMPLE
-Skeleton code for writing Mini-SEED records with \fBmsr_writemseed(3)\fP:
-
-.nf
-main() {
- MSRecord *msr;
- int precords;
-
- msr = msr_init (NULL);
-
- /* Populate MSRecord values */
- strcpy (msr->network, "XX");
- strcpy (msr->station, "TEST");
- strcpy (msr->channel, "BHE");
- msr->starttime = ms_seedtimestr2hptime ("2004,350,00:00:00.00");
- msr->samprate = 40.0;
- msr->datasamples = dataptr; /* pointer to 32-bit integer data samples */
- msr->numsamples = 1234;
- msr->sampletype = 'i'; /* declare type to be 32-bit integers */
-
- /* Write record(s) with 4096-byte length, Steim-2 compression, big-endian */
- precords = msr_writemseed (msr, "output.mseed", 1, 4096, DE_STEIM2, 1, 0);
-
- ms_log (0, "Wrote %d records\n", precords);
-
- msr_free (&msr);
-}
-.fi
-
-.SH SEE ALSO
-\fBms_intro(3)\fP, \fBmsr_pack(3)\fP and \fBmst_pack(3)\fP.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/msr_writemseed.3 b/bin/rt/orb2ringserver/libmseed/doc/msr_writemseed.3
new file mode 120000
index 000000000..26cb16b23
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/msr_writemseed.3
@@ -0,0 +1 @@
+ms_writemseed.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/mst_addmsrtogroup.3 b/bin/rt/orb2ringserver/libmseed/doc/mst_addmsrtogroup.3
deleted file mode 100644
index b085f98ae..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/mst_addmsrtogroup.3
+++ /dev/null
@@ -1,73 +0,0 @@
-.TH MST_ADDMSR 3 2013/05/17 "Libmseed API"
-.SH NAME
-mst_addmsr - Add time coverage and data samples to MSTrace structures
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "int *\fBmst_addmsr\fP ( MSTrace *" mst ", MSRecord *" msr ", flag " whence " );
-
-.BI "int \fBmst_addspan\fP ( MSTrace *" mst ", hptime_t " starttime ", hptime_t " endtime ",
-.BI " void *" datasamples ", int64_t " numsamples ",
-.BI " char " sampletype ", flag " whence " );
-
-.BI "MSTrace *\fBmst_addmsrtogroup\fP ( MSTraceGroup *" mstg ", MSRecord *" msr ",
-.BI " flag " dataquality ", double " timetol ",
-.BI " double " sampratetol " );
-
-.BI "MSTrace *\fBmst_addtracetogroup\fP ( MSTraceGroup *" mstg ", MSTrace *" mst " );"
-.fi
-
-.SH DESCRIPTION
-These routines provides different ways of adding time coverage to
-MSTrace objects. A common way to organize MSTrace objects is with a
-MSTraceGroup. The \fBmst_addmsrtogroup\fP provides a convenient way to add
-MSRecord data to a MSTraceGroup, hiding many of the details of MSTrace
-matching and bookkeeping.
-
-\fBmst_addmsr\fP will add the time coverage from a MSRecord to a
-MSTrace. The start or end time will be updated and data samples copied
-if they exist. No checking is done to verify that the record matches
-the trace in any way. If \fIwhence\fP is 1 the MSRecord coverage will
-be added at the end of the MSTrace. If \fIwhence\fP is 2 the MSRecord
-coverage will be added at the beginning of the MSTrace.
-
-\fBmst_addspan\fP does the same thing as \fBmsr_addmsr\fP except that
-time coverage and data samples are explicitly provided. See
-\fBms_time(3)\fP for a description of the high precision epoch time
-format needed for \fIstarttime\fP and \fIendtime\fP. See the
-\fBWaveform Data\fP section of \fBms_intro(3)\fP for a description of
-data sample representation.
-
-\fBmst_addmsrtogroup\fP adds time coverage from the specified MSRecord
-to the first adjacent MSTrace found in the specified MSTraceGroup. If
-the \fIdataquality\fP flag is true traces will be grouped by quality
-in addition to the source name identifiers. \fBmst_findadjacent(3)\fP
-is used with the specified sample rate and time tolerances to find an
-adjacent trace, see \fBmst_findadjacent(3)\fP for further details. If
-no adjacent MSTrace is found a new MSTrace will be added to the
-MSTraceGroup.
-
-\fBmst_addtracetogroup\fP adds a MSTrace structure to a MSTraceGroup
-structure. The MSTrace is added at the end of the MSTrace chain.
-
-.SH RETURN VALUES
-\fBmst_addmsr\fP and \fBmst_addspan\fP return 0 on success and -1 on
-error.
-
-\fBmst_addmsrtogroup\fP returns a pointer to the MSTrace updated or 0 on
-error.
-
-\fBmst_addtracetogroup\fP returns a pointer to the MSTrace added or 0 on
-error.
-
-.SH SEE ALSO
-\fBms_intro(3)\fP, \fBmst_init(3)\fP, \fBmst_findadjacent(3)\fP and
-\fBms_time(3)\fP.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/mst_addmsrtogroup.3 b/bin/rt/orb2ringserver/libmseed/doc/mst_addmsrtogroup.3
new file mode 120000
index 000000000..ce0772f6d
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/mst_addmsrtogroup.3
@@ -0,0 +1 @@
+mst_addmsr.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/mst_addspan.3 b/bin/rt/orb2ringserver/libmseed/doc/mst_addspan.3
deleted file mode 100644
index b085f98ae..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/mst_addspan.3
+++ /dev/null
@@ -1,73 +0,0 @@
-.TH MST_ADDMSR 3 2013/05/17 "Libmseed API"
-.SH NAME
-mst_addmsr - Add time coverage and data samples to MSTrace structures
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "int *\fBmst_addmsr\fP ( MSTrace *" mst ", MSRecord *" msr ", flag " whence " );
-
-.BI "int \fBmst_addspan\fP ( MSTrace *" mst ", hptime_t " starttime ", hptime_t " endtime ",
-.BI " void *" datasamples ", int64_t " numsamples ",
-.BI " char " sampletype ", flag " whence " );
-
-.BI "MSTrace *\fBmst_addmsrtogroup\fP ( MSTraceGroup *" mstg ", MSRecord *" msr ",
-.BI " flag " dataquality ", double " timetol ",
-.BI " double " sampratetol " );
-
-.BI "MSTrace *\fBmst_addtracetogroup\fP ( MSTraceGroup *" mstg ", MSTrace *" mst " );"
-.fi
-
-.SH DESCRIPTION
-These routines provides different ways of adding time coverage to
-MSTrace objects. A common way to organize MSTrace objects is with a
-MSTraceGroup. The \fBmst_addmsrtogroup\fP provides a convenient way to add
-MSRecord data to a MSTraceGroup, hiding many of the details of MSTrace
-matching and bookkeeping.
-
-\fBmst_addmsr\fP will add the time coverage from a MSRecord to a
-MSTrace. The start or end time will be updated and data samples copied
-if they exist. No checking is done to verify that the record matches
-the trace in any way. If \fIwhence\fP is 1 the MSRecord coverage will
-be added at the end of the MSTrace. If \fIwhence\fP is 2 the MSRecord
-coverage will be added at the beginning of the MSTrace.
-
-\fBmst_addspan\fP does the same thing as \fBmsr_addmsr\fP except that
-time coverage and data samples are explicitly provided. See
-\fBms_time(3)\fP for a description of the high precision epoch time
-format needed for \fIstarttime\fP and \fIendtime\fP. See the
-\fBWaveform Data\fP section of \fBms_intro(3)\fP for a description of
-data sample representation.
-
-\fBmst_addmsrtogroup\fP adds time coverage from the specified MSRecord
-to the first adjacent MSTrace found in the specified MSTraceGroup. If
-the \fIdataquality\fP flag is true traces will be grouped by quality
-in addition to the source name identifiers. \fBmst_findadjacent(3)\fP
-is used with the specified sample rate and time tolerances to find an
-adjacent trace, see \fBmst_findadjacent(3)\fP for further details. If
-no adjacent MSTrace is found a new MSTrace will be added to the
-MSTraceGroup.
-
-\fBmst_addtracetogroup\fP adds a MSTrace structure to a MSTraceGroup
-structure. The MSTrace is added at the end of the MSTrace chain.
-
-.SH RETURN VALUES
-\fBmst_addmsr\fP and \fBmst_addspan\fP return 0 on success and -1 on
-error.
-
-\fBmst_addmsrtogroup\fP returns a pointer to the MSTrace updated or 0 on
-error.
-
-\fBmst_addtracetogroup\fP returns a pointer to the MSTrace added or 0 on
-error.
-
-.SH SEE ALSO
-\fBms_intro(3)\fP, \fBmst_init(3)\fP, \fBmst_findadjacent(3)\fP and
-\fBms_time(3)\fP.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/mst_addspan.3 b/bin/rt/orb2ringserver/libmseed/doc/mst_addspan.3
new file mode 120000
index 000000000..ce0772f6d
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/mst_addspan.3
@@ -0,0 +1 @@
+mst_addmsr.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/mst_addtracetogroup.3 b/bin/rt/orb2ringserver/libmseed/doc/mst_addtracetogroup.3
deleted file mode 100644
index b085f98ae..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/mst_addtracetogroup.3
+++ /dev/null
@@ -1,73 +0,0 @@
-.TH MST_ADDMSR 3 2013/05/17 "Libmseed API"
-.SH NAME
-mst_addmsr - Add time coverage and data samples to MSTrace structures
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "int *\fBmst_addmsr\fP ( MSTrace *" mst ", MSRecord *" msr ", flag " whence " );
-
-.BI "int \fBmst_addspan\fP ( MSTrace *" mst ", hptime_t " starttime ", hptime_t " endtime ",
-.BI " void *" datasamples ", int64_t " numsamples ",
-.BI " char " sampletype ", flag " whence " );
-
-.BI "MSTrace *\fBmst_addmsrtogroup\fP ( MSTraceGroup *" mstg ", MSRecord *" msr ",
-.BI " flag " dataquality ", double " timetol ",
-.BI " double " sampratetol " );
-
-.BI "MSTrace *\fBmst_addtracetogroup\fP ( MSTraceGroup *" mstg ", MSTrace *" mst " );"
-.fi
-
-.SH DESCRIPTION
-These routines provides different ways of adding time coverage to
-MSTrace objects. A common way to organize MSTrace objects is with a
-MSTraceGroup. The \fBmst_addmsrtogroup\fP provides a convenient way to add
-MSRecord data to a MSTraceGroup, hiding many of the details of MSTrace
-matching and bookkeeping.
-
-\fBmst_addmsr\fP will add the time coverage from a MSRecord to a
-MSTrace. The start or end time will be updated and data samples copied
-if they exist. No checking is done to verify that the record matches
-the trace in any way. If \fIwhence\fP is 1 the MSRecord coverage will
-be added at the end of the MSTrace. If \fIwhence\fP is 2 the MSRecord
-coverage will be added at the beginning of the MSTrace.
-
-\fBmst_addspan\fP does the same thing as \fBmsr_addmsr\fP except that
-time coverage and data samples are explicitly provided. See
-\fBms_time(3)\fP for a description of the high precision epoch time
-format needed for \fIstarttime\fP and \fIendtime\fP. See the
-\fBWaveform Data\fP section of \fBms_intro(3)\fP for a description of
-data sample representation.
-
-\fBmst_addmsrtogroup\fP adds time coverage from the specified MSRecord
-to the first adjacent MSTrace found in the specified MSTraceGroup. If
-the \fIdataquality\fP flag is true traces will be grouped by quality
-in addition to the source name identifiers. \fBmst_findadjacent(3)\fP
-is used with the specified sample rate and time tolerances to find an
-adjacent trace, see \fBmst_findadjacent(3)\fP for further details. If
-no adjacent MSTrace is found a new MSTrace will be added to the
-MSTraceGroup.
-
-\fBmst_addtracetogroup\fP adds a MSTrace structure to a MSTraceGroup
-structure. The MSTrace is added at the end of the MSTrace chain.
-
-.SH RETURN VALUES
-\fBmst_addmsr\fP and \fBmst_addspan\fP return 0 on success and -1 on
-error.
-
-\fBmst_addmsrtogroup\fP returns a pointer to the MSTrace updated or 0 on
-error.
-
-\fBmst_addtracetogroup\fP returns a pointer to the MSTrace added or 0 on
-error.
-
-.SH SEE ALSO
-\fBms_intro(3)\fP, \fBmst_init(3)\fP, \fBmst_findadjacent(3)\fP and
-\fBms_time(3)\fP.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/mst_addtracetogroup.3 b/bin/rt/orb2ringserver/libmseed/doc/mst_addtracetogroup.3
new file mode 120000
index 000000000..ce0772f6d
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/mst_addtracetogroup.3
@@ -0,0 +1 @@
+mst_addmsr.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/mst_findadjacent.3 b/bin/rt/orb2ringserver/libmseed/doc/mst_findadjacent.3
deleted file mode 100644
index 428d4577a..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/mst_findadjacent.3
+++ /dev/null
@@ -1,69 +0,0 @@
-.TH MST_FINDMATCH 3 2006/02/27 "Libmseed API"
-.SH NAME
-mst_findmatch - Searching a MSTraceGroup for specific MSTrace structures.
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "MSTrace *\fBmst_findmatch\fP ( MSTrace *" startmst ", char " dataquality ",
-.BI " char *" network ", char *" station ",
-.BI " char *" location ", char *" channel " );
-
-.BI "MSTrace *\fBmst_findadjacent\fP ( MSTraceGroup *" mstg ",
-.BI " flag *" whence ", char " dataquality ",
-.BI " char *" network ", char *" station ",
-.BI " char *" location ", char *" channel ",
-.BI " double " samprate ", double " sampleratetol ",
-.BI " hptime_t " starttime ", hptime_t " endtime ",
-.BI " double " timetol ");"
-
-.SH DESCRIPTION
-\fBmst_findmatch\fP traverses a MSTrace chain starting at
-\fIstartmst\fP and returns the first entry that matches the source
-name identifiers. If \fIdataquality\fP is not zero it must also match
-the found entry. A calling program commonly calls this routine in a
-loop in order to find all matching MSTraces in a MSTraceGroup.
-
-\fBmst_findadjacent\fP finds the first entry in the MSTraceGroup
-pointed to by \fImstg\fP that matches the given source name
-identifiers and is time adjacent to the time coverage described by the
-\fIsamprate\fP, \fIstarttime\fP and \fIendtime\fP. If
-\fIdataquality\fP is not zero it must also match the found entry. See
-\fBms_time(3)\fP for a description of the high precision epoch time
-format needed for \fIstarttime\fP and \fIendtime\fP.
-
-The tolerance for sample rate and time matching can also be specified.
-If \fIsampratetol\fP is -1.0 the default tolerance of abs(1-sr1/sr2) <
-0.0001 is used. If \fItimetol\fP is -1.0 the default time tolerance
-of 1/2 the sample period will be used. If \fIsampratetol\fP or
-\fItimetol\fP is -2.0 the respective tolerance check will not be
-performed. If time tolerance is not checked \fIwhence\fP will be set
-to whichever end fits best. The time tolerance is specified in
-seconds.
-
-When an adjacent MSTrace is found the \fIwhence\fP flag will be set to
-indicate where the indicated time span is adjacent in the following
-way:
-.sp
-.nf
-1: time span fits at the end of the MSTrace
-2: time span fits at the beginning of the MSTrace
-.fi
-
-.SH RETURN VALUES
-\fBmst_findmatch\fP returns a pointer to the matching MSTrace structure
-or 0 if no match found or error.
-
-\fBmst_findadjacent\fP returns a pointer to the adjacent MSTrace
-structure and the \fIwhence\fP flag is set when an adjacent MSTrace is
-found or 0 when no adjacent MSTrace is found.
-
-.SH SEE ALSO
-\fBms_intro(3)\fP, \fBmst_init(3)\fP and \fBms_time(3)\fP.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/mst_findadjacent.3 b/bin/rt/orb2ringserver/libmseed/doc/mst_findadjacent.3
new file mode 120000
index 000000000..ab0b8d643
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/mst_findadjacent.3
@@ -0,0 +1 @@
+mst_findmatch.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/mst_free.3 b/bin/rt/orb2ringserver/libmseed/doc/mst_free.3
deleted file mode 100644
index 29a6c0472..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/mst_free.3
+++ /dev/null
@@ -1,51 +0,0 @@
-.TH MST_INIT 3 2006/10/10 "Libmseed API"
-.SH NAME
-mst_init - Initializing and freeing MSTrace and MSTraceGroup structures
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "MSTrace *\fBmst_init\fP ( MSTrace *" mst " );
-
-.BI "void \fBmst_free\fP ( MSTrace **" ppmst " );
-
-.BI "MSTraceGroup *\fBmst_initgroup\fP ( MSTraceGroup *" mstg " );
-
-.BI "void \fBmst_freegroup\fP ( MSTraceGroup **" ppmstg " );
-.fi
-
-.SH DESCRIPTION
-\fBmst_init\fP will initialize a MSTrace structure. If the \fImst\fP
-parameter is NULL a new structure will be allocated. If the \fImst\fP
-parameter is not NULL the structure will be cleared and any memory
-allocated for the MSTrace.datasamples and MSTrace.prvtptr members will
-be freed.
-
-\fBmst_free\fP will free all memory associated with a MSTrace structure
-and set the structure pointer (*\fIppmst\fP) to 0. This includes any
-memory pointed to by the \fIprvtptr\fP member of the MSTrace structure.
-
-\fBmst_initgroup\fP will initialize a MSTraceGroup structure. If the
-\fImstg\fP parameter is NULL a new structure will be allocated. If
-the \fImstg\fP parameter is not NULL the structure will be cleared and
-any all associated MSTrace structures will be freed.
-
-\fBmst_freegroup\fP will free all memory associated with a MSTraceGroup
-structure and set the structure pointer (*\fIppmstg\fP) to 0.
-
-.SH RETURN VALUES
-\fBmst_init\fP returns a pointer to the MSTrace structure initialized on
-success or NULL on error.
-
-\fBmst_initgroup\fP returns a pointer to the MSTraceGroup structure
-initialized on success or NULL on error.
-
-.SH SEE ALSO
-\fBms_intro(3)\fP.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/mst_free.3 b/bin/rt/orb2ringserver/libmseed/doc/mst_free.3
new file mode 120000
index 000000000..2979e5260
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/mst_free.3
@@ -0,0 +1 @@
+mst_init.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/mst_freegroup.3 b/bin/rt/orb2ringserver/libmseed/doc/mst_freegroup.3
deleted file mode 100644
index 29a6c0472..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/mst_freegroup.3
+++ /dev/null
@@ -1,51 +0,0 @@
-.TH MST_INIT 3 2006/10/10 "Libmseed API"
-.SH NAME
-mst_init - Initializing and freeing MSTrace and MSTraceGroup structures
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "MSTrace *\fBmst_init\fP ( MSTrace *" mst " );
-
-.BI "void \fBmst_free\fP ( MSTrace **" ppmst " );
-
-.BI "MSTraceGroup *\fBmst_initgroup\fP ( MSTraceGroup *" mstg " );
-
-.BI "void \fBmst_freegroup\fP ( MSTraceGroup **" ppmstg " );
-.fi
-
-.SH DESCRIPTION
-\fBmst_init\fP will initialize a MSTrace structure. If the \fImst\fP
-parameter is NULL a new structure will be allocated. If the \fImst\fP
-parameter is not NULL the structure will be cleared and any memory
-allocated for the MSTrace.datasamples and MSTrace.prvtptr members will
-be freed.
-
-\fBmst_free\fP will free all memory associated with a MSTrace structure
-and set the structure pointer (*\fIppmst\fP) to 0. This includes any
-memory pointed to by the \fIprvtptr\fP member of the MSTrace structure.
-
-\fBmst_initgroup\fP will initialize a MSTraceGroup structure. If the
-\fImstg\fP parameter is NULL a new structure will be allocated. If
-the \fImstg\fP parameter is not NULL the structure will be cleared and
-any all associated MSTrace structures will be freed.
-
-\fBmst_freegroup\fP will free all memory associated with a MSTraceGroup
-structure and set the structure pointer (*\fIppmstg\fP) to 0.
-
-.SH RETURN VALUES
-\fBmst_init\fP returns a pointer to the MSTrace structure initialized on
-success or NULL on error.
-
-\fBmst_initgroup\fP returns a pointer to the MSTraceGroup structure
-initialized on success or NULL on error.
-
-.SH SEE ALSO
-\fBms_intro(3)\fP.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/mst_freegroup.3 b/bin/rt/orb2ringserver/libmseed/doc/mst_freegroup.3
new file mode 120000
index 000000000..2979e5260
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/mst_freegroup.3
@@ -0,0 +1 @@
+mst_init.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/mst_groupheal.3 b/bin/rt/orb2ringserver/libmseed/doc/mst_groupheal.3
deleted file mode 100644
index 10f8facae..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/mst_groupheal.3
+++ /dev/null
@@ -1,50 +0,0 @@
-.TH MST_GROUPSORT 3 2007/04/12 "Libmseed API"
-.SH NAME
-mst_groupsort - Manipulate MSTrace segments in a MSTraceGroup
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "MSTrace *\fBmst_groupsort\fP ( MSTraceGroup *" mstg ", flag " quality " );
-
-.BI "MSTrace *\fBmst_groupheal\fP ( MSTraceGroup *" mstg ", double " timetol ",
-.BI " double " sampratetol " );"
-.fi
-
-.SH DESCRIPTION
-\fBmst_groupsort\fP will sort the MSTrace segments in a MSTraceGroup
-first on the source name (as returned by \fBmst_srcname\fP), then on
-start time, then on descending end time, and finally on sample rate.
-The \fIquality\fP flag, passed directly to \fBmst_srcname\fP, controls
-the addition of the quality indicator to the source name and thus the
-addition of sorting on the quality indicator (but only if the MSTrace
-has an associated quality, see \fBmst_srcname(3)\fP for more details).
-
-\fBmst_groupheal\fP will attempt to heal MSTrace segments in a
-MSTraceGroup if they fit within the specified time and sample rate
-tolerance (\fItimetol\fP and \fIsampratetol\fP respectively). This is
-useful when, for whatever reason, the MSTraceGroup has separate
-MSTrace segments which belong together. This usually only happens
-when data is added to a MSTraceGroup in random data time order.
-Before attempting to heal the MSTraces the MSTraceGroup will be sorted
-using \fBmst_groupsort\fP.
-
-If \fIsampratetol\fP is -1.0 the default tolerance of abs(1-sr1/sr2)
-is used. If \fItimetol\fP is -1.0 the default time tolerance of 1/2
-the sample period will be used.
-
-.SH RETURN VALUES
-\fBmst_groupsort\fP returns 0 on success and -1 on error.
-
-\fBmst_groupheal\fP returns the number of MSTrace segments merged on
-success and -1 on error.
-
-.SH SEE ALSO
-\fBms_intro(3)\fP and \fBmst_srcname(3)\fP.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/mst_groupheal.3 b/bin/rt/orb2ringserver/libmseed/doc/mst_groupheal.3
new file mode 120000
index 000000000..b57376738
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/mst_groupheal.3
@@ -0,0 +1 @@
+mst_groupsort.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/mst_initgroup.3 b/bin/rt/orb2ringserver/libmseed/doc/mst_initgroup.3
deleted file mode 100644
index 29a6c0472..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/mst_initgroup.3
+++ /dev/null
@@ -1,51 +0,0 @@
-.TH MST_INIT 3 2006/10/10 "Libmseed API"
-.SH NAME
-mst_init - Initializing and freeing MSTrace and MSTraceGroup structures
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "MSTrace *\fBmst_init\fP ( MSTrace *" mst " );
-
-.BI "void \fBmst_free\fP ( MSTrace **" ppmst " );
-
-.BI "MSTraceGroup *\fBmst_initgroup\fP ( MSTraceGroup *" mstg " );
-
-.BI "void \fBmst_freegroup\fP ( MSTraceGroup **" ppmstg " );
-.fi
-
-.SH DESCRIPTION
-\fBmst_init\fP will initialize a MSTrace structure. If the \fImst\fP
-parameter is NULL a new structure will be allocated. If the \fImst\fP
-parameter is not NULL the structure will be cleared and any memory
-allocated for the MSTrace.datasamples and MSTrace.prvtptr members will
-be freed.
-
-\fBmst_free\fP will free all memory associated with a MSTrace structure
-and set the structure pointer (*\fIppmst\fP) to 0. This includes any
-memory pointed to by the \fIprvtptr\fP member of the MSTrace structure.
-
-\fBmst_initgroup\fP will initialize a MSTraceGroup structure. If the
-\fImstg\fP parameter is NULL a new structure will be allocated. If
-the \fImstg\fP parameter is not NULL the structure will be cleared and
-any all associated MSTrace structures will be freed.
-
-\fBmst_freegroup\fP will free all memory associated with a MSTraceGroup
-structure and set the structure pointer (*\fIppmstg\fP) to 0.
-
-.SH RETURN VALUES
-\fBmst_init\fP returns a pointer to the MSTrace structure initialized on
-success or NULL on error.
-
-\fBmst_initgroup\fP returns a pointer to the MSTraceGroup structure
-initialized on success or NULL on error.
-
-.SH SEE ALSO
-\fBms_intro(3)\fP.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/mst_initgroup.3 b/bin/rt/orb2ringserver/libmseed/doc/mst_initgroup.3
new file mode 120000
index 000000000..2979e5260
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/mst_initgroup.3
@@ -0,0 +1 @@
+mst_init.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/mst_packgroup.3 b/bin/rt/orb2ringserver/libmseed/doc/mst_packgroup.3
deleted file mode 100644
index d21a54efa..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/mst_packgroup.3
+++ /dev/null
@@ -1,171 +0,0 @@
-.TH MST_PACK 3 2013/05/17 "Libmseed API"
-.SH NAME
-mst_pack - Packing of Mini-SEED records from MSTrace segments.
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "int \fBmst_pack\fP ( MSTrace *" mst ","
-.BI " void (*" record_handler ") (char *, int, void *),"
-.BI " void *" handlerdata ", int " reclen ", flag " encoding ","
-.BI " flag " byteorder ", int64_t *" packedsamples ", flag " flush ","
-.BI " flag " verbose ", MSRecord *" mstemplate " );"
-
-.BI "int \fBmsr_packgroup\fP ( MSTraceGroup *" mstg ","
-.BI " void (*" record_handler ") (char *, int, void *),"
-.BI " void *" handlerdata ", int " reclen ", flag " encoding ","
-.BI " flag " byteorder ", int64_t *" packedsamples ", flag " flush ","
-.BI " flag " verbose ", MSRecord *" mstemplate " );"
-.fi
-
-.SH DESCRIPTION
-\fBmst_pack\fP creates (packs) Mini-SEED data records from a MSTrace
-segment using the specified record length (\fIreclen\fP), Mini-SEED
-\fIencoding\fP and \fIbyteorder\fP. Using \fImstemplate\fP as a
-template, the common header fields and blockettes are packed into a
-record header. If no template will be used \fImstemplate\fP should be
-set to NULL. A Blockette 1000 will be added if one is not present in
-the template. The MSTrace.datasamples array and MSTrace.numsamples value
-will be adjusted (reduced) as samples are packed into data records.
-This routine will modify the record length, encoding format, byte
-order and sequence number of the MSRecord template. The start time,
-sample rate, data array, number of samples and sample type of the
-MSRecord template are preserved.
-
-Default values will be used for any of the key characteristics of
-record length, encoding format and byte order that are -1. The
-default values are: reclen = 4096 bytes, encoding = 11 (Steim2) and
-byteorder = 1 (MSBF or big-endian).
-
-\fIreclen\fP should be set to the desired data record length in bytes
-which must be expressible as 2 raised to the power of X where X is
-between (and including) 8 to 20.
-
-\fIencoding\fP should be set to one of the following supported
-Mini-SEED data encoding formats: DE_ASCII (0), DE_INT16 (1), DE_INT32
-(3), DE_FLOAT32 (4), DE_FLOAT64 (5), DE_STEIM1 (10) and DE_STEIM2
-(11). The encoding aliases are defined in libmseed.h.
-MSTrace.sampletype should indicated the sample type as either 'a'
-(ASCII), 'i' (32-bit integers), 'f' (32-bit floats) or 'd' (64-bit
-doubles).
-
-The encoding format must be appropriate for the sample type of the
-MSTrace samples. For example, Steim compression and integer encoding
-formats require integer samples and float encoding formats require the
-appropriate size floats as input. As a counter example, float samples
-cannot be packed using Steim compression or integer encoding formats.
-
-\fIbyteorder\fP must be either 0 (LSBF or little-endian) or 1 (MBF or
-big-endian).
-
-Each time a complete record is packed it will be passed to the
-\fIrecord_handler()\fP function which expects three arguments: 1) a
-char * to the record buffer, 2) the length of the record in bytes and
-3) a void pointer supplied by the caller. It is the responsibility of
-\fIrecord_handler()\fP to process the record, the memory will be
-re-used or freed when \fIrecord_handler()\fP returns. This function
-pointer is required, there is no other way to access the packed
-records.
-
-The \fIhandlerdata\fP pointer will be passed as the 3rd argument to
-\fIrecord_handler()\fP. This allows the caller to optionally pass
-data directly to the \fIrecord_handler()\fP.
-
-The integer pointed to by \fIpackedsamples\fP will be set to the total
-number of samples packed.
-
-If the \fIflush\fP flag is not zero all of the data will be packed
-into records, otherwise records will only be packed while there are
-enough data samples to completely fill a record.
-
-The \fIverbose\fP flag controls verbosity, a value of zero will result
-in no diagnostic output.
-
-\fBmst_packgroup\fP simply calls \fBmst_pack\fP for each MSTrace in the
-specified MSTraceGroup. The integer pointed to by \fIpackedsamples\fP
-will be set to the total number of samples packed.
-
-.SH COMPRESSION HISTORY
-When the encoding format is Steim 1 or 2 compression contiguous
-records will be created including compression history. Put simply,
-this means that the first difference in the compression series will be
-the difference between the first sample of the current record and the
-last sample of the previous record. For the first record in a series
-(no previous record), a so-called cold start, the first difference
-will be zero.
-
-The compression history can be seeded by allocating the StreamState
-struct for the MSTrace and setting the \fBlastintsample\fP member to
-the integer sample value that preceded the first sample in the current
-series and setting the \fBcomphistory\fP flag to true (1).
-
-.SH RETURN VALUES
-\fBmst_pack\fP returns the number records created on success and -1 on
-error.
-
-\fBmst_packgroup\fP returns the total (for all MSTraces) number of
-record created on success and -1 on error.
-
-.SH CAVEATS
-When using a MSRecord template (\fImstemplate\fP) the dataquality
-member must be set to a valid value. It is also advisable to set the
-network, station, location and channel indicators to appropriate
-values. Unless these source indicators need to change they can simply
-be copied from the matching MSTrace members.
-
-.SH EXAMPLE
-Skeleton code for creating (packing) Mini-SEED records with
-mst_pack(3):
-
-.nf
-static void record_handler (char *record, int reclen, void *srcname) {
- if ( fwrite(record, reclen, 1, outfile) != 1 )
- {
- ms_log (2, "Error writing %s to output file\n", (char *)srcname);
- }
-}
-
-main() {
- int64_t psamples;
- int precords;
- MSTrace *mst;
- char srcname[50];
-
- mst = mst_init (NULL);
-
- /* Populate MSTrace values */
- strcpy (mst->network, "XX");
- strcpy (mst->station, "TEST");
- strcpy (mst->channel, "BHE");
- mst->starttime = ms_seedtimestr2hptime ("2004,350,00:00:00.000000");
- mst->samprate = 40.0;
-
- /* The datasamples pointer and numsamples counter will be adjusted by
- the packing routine, the datasamples array must be dynamic memory
- allocated by the malloc() family of routines. */
- mst->datasamples = dataptr; /* pointer to 32-bit integer data samples */
- mst->numsamples = 1234;
- mst->sampletype = 'i'; /* declare type to be 32-bit integers */
-
- mst_srcname (mst, srcname, 0);
-
- /* Pack 4096 byte, big-endian records, using Steim-2 compression */
- precords = mst_pack (mst, &record_handler, srcname, 4096, DE_STEIM2,
- 1, &psamples, 1, verbose, NULL);
-
- ms_log (0, "Packed %"PRId64" samples into %d records\n",
- psamples, precords);
-
- mst_free (&mst);
-}
-.fi
-
-.SH SEE ALSO
-\fBms_intro(3)\fP and \fBmsr_pack(3)\fP.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/mst_packgroup.3 b/bin/rt/orb2ringserver/libmseed/doc/mst_packgroup.3
new file mode 120000
index 000000000..04ca646d9
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/mst_packgroup.3
@@ -0,0 +1 @@
+mst_pack.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/mst_printgaplist.3 b/bin/rt/orb2ringserver/libmseed/doc/mst_printgaplist.3
deleted file mode 100644
index ecb8f3f7d..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/mst_printgaplist.3
+++ /dev/null
@@ -1,79 +0,0 @@
-.TH MST_PRINT 3 2008/11/21 "Libmseed API"
-.SH NAME
-mst_print - Printing of MSTrace information.
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "void \fBmst_printtracelist\fP ( MSTraceGroup *" mstg ", flag " timeformat ","
-.BI " flag " details ", flag " gaps " );"
-
-.BI "void \fBmst_printsynclist\fP ( MSTraceGroup *" mstg ", char *" dccid ","
-.BI " flag " subsecond " );"
-
-.BI "void \fBmst_printgaplist\fP ( MSTraceGroup *" mstg ", flag " timeformat ","
-.BI " double *" mingap ", double *" maxgap " );"
-.fi
-
-.SH DESCRIPTION
-\fBmst_printtracelist\fP prints a formatted list of the MSTrace
-segments in the given MSTraceGroup. If the \fIdetails\fP flag is
-greater than 0 the sample rate and sample count are printed for each
-trace. If the \fIgaps\fP flag is greater than zero the time gap from
-the previous MSTrace (if the source name matches) is printed. All
-output is printed using \fBms_log(3)\fP at level 0.
-
-\fBmst_printsynclist\fP prints a formatted list of the MSTrace
-segments in the given MSTraceGroup similar to \fBmst_printtracelist\fP
-but the format is a SYNC listing. If a \fIdccid\fP string is supplied
-it will be used along with the current system date to create the SYNC
-header line. If the \fIsubsecond\fP flag is true (non-zero) the time
-values in the SYNC lines will include full libmseed precision,
-otherwise they will be truncted to integer second values.
-
-\fBmst_printgaplist\fP prints a formatted list of the gaps between
-MSTrace segments in the given MSTraceGroup. If \fImingap\fP or
-\fImaxgap\fP is not NULL their values will be enforced and only
-gaps/overlaps matching their implied criteria will be printed.
-
-The \fItimeformat\fP argument for both \fBmst_printtracelist\fP and
-\fBmst_printgaplist\fP controls the format of the resulting time
-strings. Possible formats are:
-
-.nf
-0 : SEED time format (2005,146,00:00:00.000000)
-1 : ISO time format (2005-05-26T00:00:00.000000)
-2 : Epoch time, seconds since the epoch (1117065600.00000000)
-.fi
-
-Both \fBmst_printtracelist\fP and \fBmst_printgaplist\fP represent
-time overlaps as negative gaps. For a single sample overlap the value
-of the gap is calculated as zero, this will be printed as "-0" or
-negative zero to indicate an overlap.
-
-.SH GAP/OVERLAP RULES
-The existence of gaps and overlaps is implicit in the structure of the
-MSTraceGroup, no special processing is done to detect gaps and overlaps
-in these routines.
-
-The value of a gap is calculated as the difference between the time of
-the last sample before the gap and the time of the first sample after
-the gap. No sample 'coverage' time is included.
-
-The value of an overlap is calculated as the time between two samples
-which represent the maximum amount of timeseries overlap.
-
-When the MSTraces in the MSTraceGroup include a small segment that is
-completely overlapped by another larger segment the gap/overlap value
-will not be correct for either the smaller segment or the segment
-following it.
-
-.SH SEE ALSO
-\fBms_intro(3)\fP
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/mst_printgaplist.3 b/bin/rt/orb2ringserver/libmseed/doc/mst_printgaplist.3
new file mode 120000
index 000000000..22f8850af
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/mst_printgaplist.3
@@ -0,0 +1 @@
+mst_printtracelist.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/mst_printsynclist.3 b/bin/rt/orb2ringserver/libmseed/doc/mst_printsynclist.3
deleted file mode 100644
index ecb8f3f7d..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/mst_printsynclist.3
+++ /dev/null
@@ -1,79 +0,0 @@
-.TH MST_PRINT 3 2008/11/21 "Libmseed API"
-.SH NAME
-mst_print - Printing of MSTrace information.
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "void \fBmst_printtracelist\fP ( MSTraceGroup *" mstg ", flag " timeformat ","
-.BI " flag " details ", flag " gaps " );"
-
-.BI "void \fBmst_printsynclist\fP ( MSTraceGroup *" mstg ", char *" dccid ","
-.BI " flag " subsecond " );"
-
-.BI "void \fBmst_printgaplist\fP ( MSTraceGroup *" mstg ", flag " timeformat ","
-.BI " double *" mingap ", double *" maxgap " );"
-.fi
-
-.SH DESCRIPTION
-\fBmst_printtracelist\fP prints a formatted list of the MSTrace
-segments in the given MSTraceGroup. If the \fIdetails\fP flag is
-greater than 0 the sample rate and sample count are printed for each
-trace. If the \fIgaps\fP flag is greater than zero the time gap from
-the previous MSTrace (if the source name matches) is printed. All
-output is printed using \fBms_log(3)\fP at level 0.
-
-\fBmst_printsynclist\fP prints a formatted list of the MSTrace
-segments in the given MSTraceGroup similar to \fBmst_printtracelist\fP
-but the format is a SYNC listing. If a \fIdccid\fP string is supplied
-it will be used along with the current system date to create the SYNC
-header line. If the \fIsubsecond\fP flag is true (non-zero) the time
-values in the SYNC lines will include full libmseed precision,
-otherwise they will be truncted to integer second values.
-
-\fBmst_printgaplist\fP prints a formatted list of the gaps between
-MSTrace segments in the given MSTraceGroup. If \fImingap\fP or
-\fImaxgap\fP is not NULL their values will be enforced and only
-gaps/overlaps matching their implied criteria will be printed.
-
-The \fItimeformat\fP argument for both \fBmst_printtracelist\fP and
-\fBmst_printgaplist\fP controls the format of the resulting time
-strings. Possible formats are:
-
-.nf
-0 : SEED time format (2005,146,00:00:00.000000)
-1 : ISO time format (2005-05-26T00:00:00.000000)
-2 : Epoch time, seconds since the epoch (1117065600.00000000)
-.fi
-
-Both \fBmst_printtracelist\fP and \fBmst_printgaplist\fP represent
-time overlaps as negative gaps. For a single sample overlap the value
-of the gap is calculated as zero, this will be printed as "-0" or
-negative zero to indicate an overlap.
-
-.SH GAP/OVERLAP RULES
-The existence of gaps and overlaps is implicit in the structure of the
-MSTraceGroup, no special processing is done to detect gaps and overlaps
-in these routines.
-
-The value of a gap is calculated as the difference between the time of
-the last sample before the gap and the time of the first sample after
-the gap. No sample 'coverage' time is included.
-
-The value of an overlap is calculated as the time between two samples
-which represent the maximum amount of timeseries overlap.
-
-When the MSTraces in the MSTraceGroup include a small segment that is
-completely overlapped by another larger segment the gap/overlap value
-will not be correct for either the smaller segment or the segment
-following it.
-
-.SH SEE ALSO
-\fBms_intro(3)\fP
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/mst_printsynclist.3 b/bin/rt/orb2ringserver/libmseed/doc/mst_printsynclist.3
new file mode 120000
index 000000000..22f8850af
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/mst_printsynclist.3
@@ -0,0 +1 @@
+mst_printtracelist.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/mst_srcname.3 b/bin/rt/orb2ringserver/libmseed/doc/mst_srcname.3
deleted file mode 100644
index 551ce6f1d..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/mst_srcname.3
+++ /dev/null
@@ -1,56 +0,0 @@
-.TH MS_SRCNAME 3 2006/11/27 "Libmseed API"
-.SH NAME
-ms_srcname - Determine source names using the SEED naming nomenclature.
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "char *\fBms_recsrcname\fP ( char *" record ", char *" srcname ", flag " quality " );"
-
-.BI "char *\fBmsr_srcname\fP ( MSRecord *" msr ", char *" srcname ", flag " quality " );"
-
-.BI "char *\fBmst_srcname\fP ( MSTrace *" mst ", char *" srcname ", flag " quality " );"
-.fi
-
-.SH DESCRIPTION
-These routines generate a source name using the SEED naming
-nomenclature in the format: 'NET_STA_LOC_CHAN' and stores it in the
-buffer provided at \fIsrcname\fP. If the \fIquality\fP flag is true
-the data quality character will be appended to the source name
-resulting in a format of: 'NET_STA_LOC_CHAN_QUAL'.
-
-The memory pointed to by \fIsrcname\fP must have enough room for the
-resulting string. As of SEED 2.4 this is a maximum of 18 characters
-including the terminating NULL. The MSRecord and MSTrace structs are
-capable of producing a source name of 42 characters (including the
-terminating NULL) and libmseed commonly allocates 50 characters for
-the \fIsrcname\fP buffer.
-
-\fBms_recsrcname\fP generates a source name string for the SEED data
-record at \fIrecord\fP. If the \fIquality\fP flag is true the quality
-character will be appended.
-
-\fBmsr_srcname\fP generates a source name string for the specified
-MSRecord struct. If the \fIquality\fP flag is true the quality
-character will be appended.
-
-\fBmst_srcname\fP generates a source name string in for the specified
-MSTrace struct. If the \fIquality\fP flag is true *and*
-mst->dataquality is not zero the quality character will be appended.
-
-.SH LOCATION IDS AND SPACES
-The source name produced by these routines never include spaces. The
-fixed format nature of SEED data records leads to blank or unused
-location IDs represented by spaces. Such blank location IDs will be
-collapsed to nothing in the resulting sources names.
-
-.SH RETURN VALUES
-The routines return a pointer to the resulting string or NULL on
-error.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/mst_srcname.3 b/bin/rt/orb2ringserver/libmseed/doc/mst_srcname.3
new file mode 120000
index 000000000..7abd571d7
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/mst_srcname.3
@@ -0,0 +1 @@
+ms_srcname.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/mst_writemseed.3 b/bin/rt/orb2ringserver/libmseed/doc/mst_writemseed.3
deleted file mode 100644
index ca91d15ad..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/mst_writemseed.3
+++ /dev/null
@@ -1,99 +0,0 @@
-.TH MS_WRITEMSEED 3 2011/01/06 "Libmseed API"
-.SH NAME
-ms_writemseed - Write Mini-SEED records to files.
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "int \fBmsr_writemseed\fP ( MSRecord *" msr ", char *" msfile ", flag " overwrite ","
-.BI " int " reclen ", flag " encoding ", flag " byteorder ","
-.BI " flag " verbose " );"
-
-.BI "int \fBmst_writemseed\fP ( MSTrace *" mst ", char *" msfile ", flag " overwrite ","
-.BI " int " reclen ", flag " encoding ", flag " byteorder ","
-.BI " flag " verbose " );"
-
-.BI "int \fBmst_writemseedgroup\fP ( MSTraceGroup *" msr ", char *" msfile ","
-.BI " flag " overwrite ", int " reclen ", flag " encoding ","
-.BI " flag " byteorder ", flag " verbose " );"
-.fi
-
-.SH DESCRIPTION
-These routines will packed the data contained in the \fBMSRecord\fP,
-\fBMSTrace\fP or \fBMSTraceGroup\fP into Mini-SEED records and write
-them to the specified file. The \fIoverwrite\fP flag controls whether
-the output file is overwritten or appended to.
-
-Mini-SEED records are created using the specified record length
-(\fIreclen\fP), Mini-SEED \fIencoding\fP and \fIbyteorder\fP. Default
-values will be used for any of the key characteristics of record
-length, encoding format and byte order that are specified as -1. The
-default values are: reclen = 4096 bytes, encoding = 11 (Steim2) and
-byteorder = 1 (MSBF or big-endian).
-
-\fIreclen\fP should be set to the desired data record length in bytes
-which must be expressible as 2 raised to the power of X where X is
-between (and including) 8 to 20.
-
-\fIencoding\fP should be set to one of the following supported
-Mini-SEED data encoding formats: DE_ASCII (0), DE_INT16 (1), DE_INT32
-(3), DE_FLOAT32 (4), DE_FLOAT64 (5), DE_STEIM1 (10) and DE_STEIM2
-(11). The encoding aliases are defined in libmseed.h.
-MSTrace.sampletype should indicated the sample type as either 'a'
-(ASCII), 'i' (32-bit integers), 'f' (32-bit floats) or 'd' (64-bit
-doubles).
-
-The encoding format must be appropriate for the sample type of the
-MSTrace samples. For example, Steim compression and integer encoding
-formats require integer samples and float encoding formats require the
-appropriate size floats as input. As a counter example, float samples
-cannot be packed using Steim compression or integer encoding formats.
-
-\fIbyteorder\fP must be either 0 (LSBF or little-endian) or 1 (MBF or
-big-endian).
-
-The \fIverbose\fP flag controls verbosity, a value of zero will result
-in no diagnostic output.
-
-.SH RETURN VALUES
-All of these routines return the number of records written on success
-and -1 on error.
-
-.SH EXAMPLE
-Skeleton code for writing Mini-SEED records with \fBmsr_writemseed(3)\fP:
-
-.nf
-main() {
- MSRecord *msr;
- int precords;
-
- msr = msr_init (NULL);
-
- /* Populate MSRecord values */
- strcpy (msr->network, "XX");
- strcpy (msr->station, "TEST");
- strcpy (msr->channel, "BHE");
- msr->starttime = ms_seedtimestr2hptime ("2004,350,00:00:00.00");
- msr->samprate = 40.0;
- msr->datasamples = dataptr; /* pointer to 32-bit integer data samples */
- msr->numsamples = 1234;
- msr->sampletype = 'i'; /* declare type to be 32-bit integers */
-
- /* Write record(s) with 4096-byte length, Steim-2 compression, big-endian */
- precords = msr_writemseed (msr, "output.mseed", 1, 4096, DE_STEIM2, 1, 0);
-
- ms_log (0, "Wrote %d records\n", precords);
-
- msr_free (&msr);
-}
-.fi
-
-.SH SEE ALSO
-\fBms_intro(3)\fP, \fBmsr_pack(3)\fP and \fBmst_pack(3)\fP.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/mst_writemseed.3 b/bin/rt/orb2ringserver/libmseed/doc/mst_writemseed.3
new file mode 120000
index 000000000..26cb16b23
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/mst_writemseed.3
@@ -0,0 +1 @@
+ms_writemseed.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/mst_writemseedgroup.3 b/bin/rt/orb2ringserver/libmseed/doc/mst_writemseedgroup.3
deleted file mode 100644
index ca91d15ad..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/mst_writemseedgroup.3
+++ /dev/null
@@ -1,99 +0,0 @@
-.TH MS_WRITEMSEED 3 2011/01/06 "Libmseed API"
-.SH NAME
-ms_writemseed - Write Mini-SEED records to files.
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "int \fBmsr_writemseed\fP ( MSRecord *" msr ", char *" msfile ", flag " overwrite ","
-.BI " int " reclen ", flag " encoding ", flag " byteorder ","
-.BI " flag " verbose " );"
-
-.BI "int \fBmst_writemseed\fP ( MSTrace *" mst ", char *" msfile ", flag " overwrite ","
-.BI " int " reclen ", flag " encoding ", flag " byteorder ","
-.BI " flag " verbose " );"
-
-.BI "int \fBmst_writemseedgroup\fP ( MSTraceGroup *" msr ", char *" msfile ","
-.BI " flag " overwrite ", int " reclen ", flag " encoding ","
-.BI " flag " byteorder ", flag " verbose " );"
-.fi
-
-.SH DESCRIPTION
-These routines will packed the data contained in the \fBMSRecord\fP,
-\fBMSTrace\fP or \fBMSTraceGroup\fP into Mini-SEED records and write
-them to the specified file. The \fIoverwrite\fP flag controls whether
-the output file is overwritten or appended to.
-
-Mini-SEED records are created using the specified record length
-(\fIreclen\fP), Mini-SEED \fIencoding\fP and \fIbyteorder\fP. Default
-values will be used for any of the key characteristics of record
-length, encoding format and byte order that are specified as -1. The
-default values are: reclen = 4096 bytes, encoding = 11 (Steim2) and
-byteorder = 1 (MSBF or big-endian).
-
-\fIreclen\fP should be set to the desired data record length in bytes
-which must be expressible as 2 raised to the power of X where X is
-between (and including) 8 to 20.
-
-\fIencoding\fP should be set to one of the following supported
-Mini-SEED data encoding formats: DE_ASCII (0), DE_INT16 (1), DE_INT32
-(3), DE_FLOAT32 (4), DE_FLOAT64 (5), DE_STEIM1 (10) and DE_STEIM2
-(11). The encoding aliases are defined in libmseed.h.
-MSTrace.sampletype should indicated the sample type as either 'a'
-(ASCII), 'i' (32-bit integers), 'f' (32-bit floats) or 'd' (64-bit
-doubles).
-
-The encoding format must be appropriate for the sample type of the
-MSTrace samples. For example, Steim compression and integer encoding
-formats require integer samples and float encoding formats require the
-appropriate size floats as input. As a counter example, float samples
-cannot be packed using Steim compression or integer encoding formats.
-
-\fIbyteorder\fP must be either 0 (LSBF or little-endian) or 1 (MBF or
-big-endian).
-
-The \fIverbose\fP flag controls verbosity, a value of zero will result
-in no diagnostic output.
-
-.SH RETURN VALUES
-All of these routines return the number of records written on success
-and -1 on error.
-
-.SH EXAMPLE
-Skeleton code for writing Mini-SEED records with \fBmsr_writemseed(3)\fP:
-
-.nf
-main() {
- MSRecord *msr;
- int precords;
-
- msr = msr_init (NULL);
-
- /* Populate MSRecord values */
- strcpy (msr->network, "XX");
- strcpy (msr->station, "TEST");
- strcpy (msr->channel, "BHE");
- msr->starttime = ms_seedtimestr2hptime ("2004,350,00:00:00.00");
- msr->samprate = 40.0;
- msr->datasamples = dataptr; /* pointer to 32-bit integer data samples */
- msr->numsamples = 1234;
- msr->sampletype = 'i'; /* declare type to be 32-bit integers */
-
- /* Write record(s) with 4096-byte length, Steim-2 compression, big-endian */
- precords = msr_writemseed (msr, "output.mseed", 1, 4096, DE_STEIM2, 1, 0);
-
- ms_log (0, "Wrote %d records\n", precords);
-
- msr_free (&msr);
-}
-.fi
-
-.SH SEE ALSO
-\fBms_intro(3)\fP, \fBmsr_pack(3)\fP and \fBmst_pack(3)\fP.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/mst_writemseedgroup.3 b/bin/rt/orb2ringserver/libmseed/doc/mst_writemseedgroup.3
new file mode 120000
index 000000000..26cb16b23
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/mst_writemseedgroup.3
@@ -0,0 +1 @@
+ms_writemseed.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/mstl_convertsamples.3 b/bin/rt/orb2ringserver/libmseed/doc/mstl_convertsamples.3
deleted file mode 100644
index 1c7758a19..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/mstl_convertsamples.3
+++ /dev/null
@@ -1,48 +0,0 @@
-.TH MST_CONVERTSAMPLES 3 2013/10/01 "Libmseed API"
-.SH NAME
-mst_convertsamples - Convert data samples between numeric types
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "int \fBmst_convertsamples\fP ( MSTrace *" mst ", char " type ", flag " truncate ");"
-
-.BI "int \fBmstl_convertsamples\fP ( MSTraceSeg *" seg ", char " type ", flag " truncate ");"
-
-.SH DESCRIPTION
-\fBmst_convertsamples\fP and \fBmst_convertsamples\fP convert any data
-samples associated with an \fIMSTrace\fP or \fIMSTraceSeg\fP to a
-specified \fitype\fP.
-
-The routines can convert between 32-bit integers (type \fIi\fP),
-32-bit floats (type \fIf\fP) and 64-bit doubles (type \fId\fP).
-
-When converting float and double sample types to integer type a simple
-rounding is applied by adding 0.5 to the sample value before converting
-(truncating) to integer. This compensates for common machine
-representations of floating point values (e.g. "40.0" represented by
-"39.99999999").
-
-If the \fItruncate\fP flag is true data samples will be truncated to
-integers even if loss of sample precision is detected. If the
-\fItruncate\fP flag is false (0) and loss of precision is detected an
-error is returned. Loss of precision is determined by testing that
-the difference between the floating point value and the (truncated)
-integer value is greater than 0.000001.
-
-ASCII data samples (type \fIa\fP) cannot be converted, if supplied or
-requested an error will be returned.
-
-.SH RETURN VALUES
-\fBmst_convertsamples\fP and \fBmstl_convertsamples\fP return 0 on
-success and -1 on error.
-
-.SH SEE ALSO
-\fBms_intro(3)\fP.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/mstl_convertsamples.3 b/bin/rt/orb2ringserver/libmseed/doc/mstl_convertsamples.3
new file mode 120000
index 000000000..9650bf863
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/mstl_convertsamples.3
@@ -0,0 +1 @@
+mst_convertsamples.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/mstl_free.3 b/bin/rt/orb2ringserver/libmseed/doc/mstl_free.3
deleted file mode 100644
index edd7f6107..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/mstl_free.3
+++ /dev/null
@@ -1,36 +0,0 @@
-.TH MSTL_INIT 3 2008/11/21 "Libmseed API"
-.SH NAME
-mstl_init - Initializing and freeing MSTraceList structures
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "MSTrace *\fBmstl_init\fP ( MSTrace *" mstl " );"
-
-.BI "void \fBmstl_free\fP ( MSTrace **" ppmstl ", flag " freeprvtptr " );"
-.fi
-
-.SH DESCRIPTION
-\fBmstl_init\fP will initialize a MSTraceList structure. If the
-\fImstl\fP parameter is not NULL the structure will be cleared before
-being reallocated any memory allocated for associated MSTraceID and
-relate sub-structures will be freed.
-
-\fBmstl_free\fP will free all memory associated with a MSTraceList
-structure and set the structure pointer (*\fIppmstl\fP) to 0. If the
-\fIfreeprvtptr\fP flag is true any memory pointed to by the
-\fIprvtptr\fP members of the MSTraceID or MSTraceSeg structures.
-
-.SH RETURN VALUES
-\fBmstl_init\fP returns a pointer to the MSTraceList structure
-initialized on success or NULL on error.
-
-.SH SEE ALSO
-\fBmstl_addmsr(3)\fP.
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/mstl_free.3 b/bin/rt/orb2ringserver/libmseed/doc/mstl_free.3
new file mode 120000
index 000000000..bb5e62cf9
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/mstl_free.3
@@ -0,0 +1 @@
+mstl_init.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/mstl_printgaplist.3 b/bin/rt/orb2ringserver/libmseed/doc/mstl_printgaplist.3
deleted file mode 100644
index 17033f4c9..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/mstl_printgaplist.3
+++ /dev/null
@@ -1,79 +0,0 @@
-.TH MSTL_PRINT 3 2008/11/21 "Libmseed API"
-.SH NAME
-mstl_print - Printing of MSTrace information.
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "void \fBmstl_printtracelist\fP ( MSTraceList *" mstl ", flag " timeformat ","
-.BI " flag " details ", flag " gaps " );"
-
-.BI "void \fBmstl_printsynclist\fP ( MSTraceList *" mstl ", char *" dccid ","
-.BI " flag " subsecond " );"
-
-.BI "void \fBmstl_printgaplist\fP ( MSTraceList *" mstl ", flag " timeformat ","
-.BI " double *" mingap ", double *" maxgap " );"
-.fi
-
-.SH DESCRIPTION
-\fBmstl_printtracelist\fP prints a formatted list of the trace
-segments in the given MSTraceList. If the \fIdetails\fP flag is
-greater than 0 the sample rate and sample count are printed for each
-trace. If the \fIgaps\fP flag is greater than zero the time gap from
-the previous segment is printed. All output is printed using
-\fBms_log(3)\fP at level 0.
-
-\fBmstl_printsynclist\fP prints a formatted list of the trace segments
-in the given MSTraceList similar to \fBmstl_printtracelist\fP but the
-format is a SYNC listing. If a \fIdccid\fP string is supplied it will
-be used along with the current system date to create the SYNC header
-line. If the \fIsubsecond\fP flag is true (non-zero) the time values
-in the SYNC lines will include full libmseed precision, otherwise they
-will be truncted to integer second values.
-
-\fBmstl_printgaplist\fP prints a formatted list of the gaps between
-trace segments in the given MSTraceList. If \fImingap\fP or
-\fImaxgap\fP is not NULL their values will be enforced and only
-gaps/overlaps matching their implied criteria will be printed.
-
-The \fItimeformat\fP argument for both \fBmstl_printtracelist\fP and
-\fBmstl_printgaplist\fP controls the format of the resulting time
-strings. Possible formats are:
-
-.nf
-0 : SEED time format (2005,146,00:00:00.000000)
-1 : ISO time format (2005-05-26T00:00:00.000000)
-2 : Epoch time, seconds since the epoch (1117065600.00000000)
-.fi
-
-Both \fBmstl_printtracelist\fP and \fBmstl_printgaplist\fP represent
-time overlaps as negative gaps. For a single sample overlap the value
-of the gap is calculated as zero, this will be printed as "-0" or
-negative zero to indicate an overlap.
-
-.SH GAP/OVERLAP RULES
-The existence of gaps and overlaps is implicit in the structure of the
-MSTraceList, no special processing is done to detect gaps and overlaps
-in these routines.
-
-The value of a gap is calculated as the difference between the time of
-the last sample before the gap and the time of the first sample after
-the gap. No sample 'coverage' time is included.
-
-The value of an overlap is calculated as the time between two samples
-which represent the maximum amount of timeseries overlap.
-
-When the traces in the MSTraceList include a small segment that is
-completely overlapped by another larger segment the gap/overlap value
-will not be correct for either the smaller segment or the segment
-following it.
-
-.SH SEE ALSO
-\fBms_intro(3)\fP
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/mstl_printgaplist.3 b/bin/rt/orb2ringserver/libmseed/doc/mstl_printgaplist.3
new file mode 120000
index 000000000..6740cb934
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/mstl_printgaplist.3
@@ -0,0 +1 @@
+mstl_printtracelist.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/doc/mstl_printsynclist.3 b/bin/rt/orb2ringserver/libmseed/doc/mstl_printsynclist.3
deleted file mode 100644
index 17033f4c9..000000000
--- a/bin/rt/orb2ringserver/libmseed/doc/mstl_printsynclist.3
+++ /dev/null
@@ -1,79 +0,0 @@
-.TH MSTL_PRINT 3 2008/11/21 "Libmseed API"
-.SH NAME
-mstl_print - Printing of MSTrace information.
-
-.SH SYNOPSIS
-.nf
-.B #include
-
-.BI "void \fBmstl_printtracelist\fP ( MSTraceList *" mstl ", flag " timeformat ","
-.BI " flag " details ", flag " gaps " );"
-
-.BI "void \fBmstl_printsynclist\fP ( MSTraceList *" mstl ", char *" dccid ","
-.BI " flag " subsecond " );"
-
-.BI "void \fBmstl_printgaplist\fP ( MSTraceList *" mstl ", flag " timeformat ","
-.BI " double *" mingap ", double *" maxgap " );"
-.fi
-
-.SH DESCRIPTION
-\fBmstl_printtracelist\fP prints a formatted list of the trace
-segments in the given MSTraceList. If the \fIdetails\fP flag is
-greater than 0 the sample rate and sample count are printed for each
-trace. If the \fIgaps\fP flag is greater than zero the time gap from
-the previous segment is printed. All output is printed using
-\fBms_log(3)\fP at level 0.
-
-\fBmstl_printsynclist\fP prints a formatted list of the trace segments
-in the given MSTraceList similar to \fBmstl_printtracelist\fP but the
-format is a SYNC listing. If a \fIdccid\fP string is supplied it will
-be used along with the current system date to create the SYNC header
-line. If the \fIsubsecond\fP flag is true (non-zero) the time values
-in the SYNC lines will include full libmseed precision, otherwise they
-will be truncted to integer second values.
-
-\fBmstl_printgaplist\fP prints a formatted list of the gaps between
-trace segments in the given MSTraceList. If \fImingap\fP or
-\fImaxgap\fP is not NULL their values will be enforced and only
-gaps/overlaps matching their implied criteria will be printed.
-
-The \fItimeformat\fP argument for both \fBmstl_printtracelist\fP and
-\fBmstl_printgaplist\fP controls the format of the resulting time
-strings. Possible formats are:
-
-.nf
-0 : SEED time format (2005,146,00:00:00.000000)
-1 : ISO time format (2005-05-26T00:00:00.000000)
-2 : Epoch time, seconds since the epoch (1117065600.00000000)
-.fi
-
-Both \fBmstl_printtracelist\fP and \fBmstl_printgaplist\fP represent
-time overlaps as negative gaps. For a single sample overlap the value
-of the gap is calculated as zero, this will be printed as "-0" or
-negative zero to indicate an overlap.
-
-.SH GAP/OVERLAP RULES
-The existence of gaps and overlaps is implicit in the structure of the
-MSTraceList, no special processing is done to detect gaps and overlaps
-in these routines.
-
-The value of a gap is calculated as the difference between the time of
-the last sample before the gap and the time of the first sample after
-the gap. No sample 'coverage' time is included.
-
-The value of an overlap is calculated as the time between two samples
-which represent the maximum amount of timeseries overlap.
-
-When the traces in the MSTraceList include a small segment that is
-completely overlapped by another larger segment the gap/overlap value
-will not be correct for either the smaller segment or the segment
-following it.
-
-.SH SEE ALSO
-\fBms_intro(3)\fP
-
-.SH AUTHOR
-.nf
-Chad Trabant
-IRIS Data Management Center
-.fi
diff --git a/bin/rt/orb2ringserver/libmseed/doc/mstl_printsynclist.3 b/bin/rt/orb2ringserver/libmseed/doc/mstl_printsynclist.3
new file mode 120000
index 000000000..6740cb934
--- /dev/null
+++ b/bin/rt/orb2ringserver/libmseed/doc/mstl_printsynclist.3
@@ -0,0 +1 @@
+mstl_printtracelist.3
\ No newline at end of file
diff --git a/bin/rt/orb2ringserver/libmseed/example/msrepack.c b/bin/rt/orb2ringserver/libmseed/example/msrepack.c
index 67624a636..d6d21a29f 100644
--- a/bin/rt/orb2ringserver/libmseed/example/msrepack.c
+++ b/bin/rt/orb2ringserver/libmseed/example/msrepack.c
@@ -8,8 +8,6 @@
* output file.
*
* Written by Chad Trabant, IRIS Data Management Center
- *
- * modified 2012.105
***************************************************************************/
#include
@@ -18,11 +16,6 @@
#include
#include
-#ifndef WIN32
- #include
- static void term_handler (int sig);
-#endif
-
#include
#define VERSION "[libmseed " LIBMSEED_VERSION " example]"
@@ -44,7 +37,10 @@ static int convertsamples (MSRecord *msr, int packencoding);
static int parameter_proc (int argcount, char **argvec);
static void record_handler (char *record, int reclen, void *ptr);
static void usage (void);
-static void term_handler (int sig);
+#ifndef WIN32
+ #include
+ static void term_handler (int sig);
+#endif
int
main (int argc, char **argv)
@@ -141,7 +137,7 @@ main (int argc, char **argv)
/* Replace network code */
if ( netcode )
- strncpy (msr->network, netcode, sizeof(msr->network));
+ strncpy (msr->network, netcode, sizeof(msr->network) - 1);
/* If no samples in the record just pack the header */
if ( outfile && msr->numsamples == 0 )
diff --git a/bin/rt/orb2ringserver/libmseed/example/msview.c b/bin/rt/orb2ringserver/libmseed/example/msview.c
index 6bcd23e03..c150cba04 100644
--- a/bin/rt/orb2ringserver/libmseed/example/msview.c
+++ b/bin/rt/orb2ringserver/libmseed/example/msview.c
@@ -7,8 +7,6 @@
* details for each record.
*
* Written by Chad Trabant, ORFEUS/EC-Project MEREDIAN
- *
- * modified 2016.233
***************************************************************************/
#include
@@ -17,11 +15,6 @@
#include
#include
-#ifndef WIN32
-#include
-static void term_handler (int sig);
-#endif
-
#include
#define VERSION "[libmseed " LIBMSEED_VERSION " example]"
@@ -36,7 +29,10 @@ static char *inputfile = 0;
static int parameter_proc (int argcount, char **argvec);
static void usage (void);
-static void term_handler (int sig);
+#ifndef WIN32
+ #include
+ static void term_handler (int sig);
+#endif
int
main (int argc, char **argv)
@@ -238,7 +234,7 @@ usage (void)
#ifndef WIN32
/***************************************************************************
* term_handler:
- * Signal handler routine.
+ * Signal handler routine.
***************************************************************************/
static void
term_handler (int sig)
diff --git a/bin/rt/orb2ringserver/libmseed/gswap.c b/bin/rt/orb2ringserver/libmseed/gswap.c
index 5979126f8..c8d55a6a6 100644
--- a/bin/rt/orb2ringserver/libmseed/gswap.c
+++ b/bin/rt/orb2ringserver/libmseed/gswap.c
@@ -6,14 +6,12 @@
*
* Some standard integer types are needed, namely uint8_t and
* uint32_t, (these are normally declared by including inttypes.h or
- * stdint.h). Each function expects it's input to be a void pointer
+ * stdint.h). Each function expects its input to be a void pointer
* to a quantity of the appropriate size.
*
- * There are two versions of most routines, one that works on
- * quantities regardless of alignment (gswapX) and one that works on
- * memory aligned quantities (gswapXa). The memory aligned versions
- * (gswapXa) are much faster than the other versions (gswapX), but the
- * memory *must* be aligned.
+ * There are two versions of most routines. The memory aligned versions
+ * (gswapXa) are aliases of the other versions (gswapX) provided for backwards
+ * compatibility. There is no difference between them.
*
* Written by Chad Trabant,
* IRIS Data Management Center
@@ -28,115 +26,73 @@
void
ms_gswap2 (void *data2)
{
- uint8_t temp;
-
- union {
- uint8_t c[2];
- } dat;
+ uint16_t dat;
memcpy (&dat, data2, 2);
- temp = dat.c[0];
- dat.c[0] = dat.c[1];
- dat.c[1] = temp;
+
+ dat = ((dat & 0xff00) >> 8) | ((dat & 0x00ff) << 8);
+
memcpy (data2, &dat, 2);
}
void
ms_gswap3 (void *data3)
{
+ uint8_t dat[3];
uint8_t temp;
- union {
- uint8_t c[3];
- } dat;
-
memcpy (&dat, data3, 3);
- temp = dat.c[0];
- dat.c[0] = dat.c[2];
- dat.c[2] = temp;
+ temp = dat[0];
+ dat[0] = dat[2];
+ dat[2] = temp;
memcpy (data3, &dat, 3);
}
void
ms_gswap4 (void *data4)
{
- uint8_t temp;
-
- union {
- uint8_t c[4];
- } dat;
+ uint32_t dat;
memcpy (&dat, data4, 4);
- temp = dat.c[0];
- dat.c[0] = dat.c[3];
- dat.c[3] = temp;
- temp = dat.c[1];
- dat.c[1] = dat.c[2];
- dat.c[2] = temp;
+
+ dat = ((dat & 0xff000000) >> 24) | ((dat & 0x000000ff) << 24) |
+ ((dat & 0x00ff0000) >> 8) | ((dat & 0x0000ff00) << 8);
+
memcpy (data4, &dat, 4);
}
void
ms_gswap8 (void *data8)
{
- uint8_t temp;
-
- union {
- uint8_t c[8];
- } dat;
+ uint64_t dat;
- memcpy (&dat, data8, 8);
- temp = dat.c[0];
- dat.c[0] = dat.c[7];
- dat.c[7] = temp;
+ memcpy (&dat, data8, sizeof(uint64_t));
- temp = dat.c[1];
- dat.c[1] = dat.c[6];
- dat.c[6] = temp;
+ dat = ((dat & 0xff00000000000000) >> 56) | ((dat & 0x00000000000000ff) << 56) |
+ ((dat & 0x00ff000000000000) >> 40) | ((dat & 0x000000000000ff00) << 40) |
+ ((dat & 0x0000ff0000000000) >> 24) | ((dat & 0x0000000000ff0000) << 24) |
+ ((dat & 0x000000ff00000000) >> 8) | ((dat & 0x00000000ff000000) << 8);
- temp = dat.c[2];
- dat.c[2] = dat.c[5];
- dat.c[5] = temp;
-
- temp = dat.c[3];
- dat.c[3] = dat.c[4];
- dat.c[4] = temp;
- memcpy (data8, &dat, 8);
+ memcpy (data8, &dat, sizeof(uint64_t));
}
-/* Swap routines that work on memory aligned quantities */
+/* Swap routines that work on memory aligned quantities are the same as the
+ * generic routines. The symbols below exist for backwards compatibility. */
void
ms_gswap2a (void *data2)
{
- uint16_t *data = data2;
-
- *data = (((*data >> 8) & 0xff) | ((*data & 0xff) << 8));
+ ms_gswap2 (data2);
}
void
ms_gswap4a (void *data4)
{
- uint32_t *data = data4;
-
- *data = (((*data >> 24) & 0xff) | ((*data & 0xff) << 24) |
- ((*data >> 8) & 0xff00) | ((*data & 0xff00) << 8));
+ ms_gswap4 (data4);
}
void
ms_gswap8a (void *data8)
{
- uint32_t *data4 = data8;
- uint32_t h0, h1;
-
- h0 = data4[0];
- h0 = (((h0 >> 24) & 0xff) | ((h0 & 0xff) << 24) |
- ((h0 >> 8) & 0xff00) | ((h0 & 0xff00) << 8));
-
- h1 = data4[1];
- h1 = (((h1 >> 24) & 0xff) | ((h1 & 0xff) << 24) |
- ((h1 >> 8) & 0xff00) | ((h1 & 0xff00) << 8));
-
- data4[0] = h1;
- data4[1] = h0;
+ ms_gswap8 (data8);
}
diff --git a/bin/rt/orb2ringserver/libmseed/libmseed.h b/bin/rt/orb2ringserver/libmseed/libmseed.h
index 5d1aea2d8..6edd17071 100644
--- a/bin/rt/orb2ringserver/libmseed/libmseed.h
+++ b/bin/rt/orb2ringserver/libmseed/libmseed.h
@@ -17,7 +17,7 @@
* License along with this software.
* If not, see .
*
- * Copyright (C) 2017 Chad Trabant
+ * Copyright (C) 2022 Chad Trabant
* IRIS Data Management Center
***************************************************************************/
@@ -28,8 +28,8 @@
extern "C" {
#endif
-#define LIBMSEED_VERSION "2.19.6"
-#define LIBMSEED_RELEASE "2018.240"
+#define LIBMSEED_VERSION "2.19.8"
+#define LIBMSEED_RELEASE "2022.087"
/* C99 standard headers */
#include
@@ -157,8 +157,8 @@ extern int LM_SIZEOF_OFF_T; /* Size of off_t data type determined at build time
#define HPTERROR -2145916800000000LL
/* Macros to scale between Unix/POSIX epoch time & high precision time */
-#define MS_EPOCH2HPTIME(X) X * (hptime_t) HPTMODULUS
-#define MS_HPTIME2EPOCH(X) X / HPTMODULUS
+#define MS_EPOCH2HPTIME(X) (X) * (hptime_t) HPTMODULUS
+#define MS_HPTIME2EPOCH(X) (X) / HPTMODULUS
/* Macro to test a character for data record indicators */
#define MS_ISDATAINDICATOR(X) (X=='D' || X=='R' || X=='Q' || X=='M')
@@ -587,22 +587,22 @@ typedef struct Selections_s {
* pack byte orders */
extern flag packheaderbyteorder;
extern flag packdatabyteorder;
-#define MS_PACKHEADERBYTEORDER(X) (packheaderbyteorder = X);
-#define MS_PACKDATABYTEORDER(X) (packdatabyteorder = X);
+#define MS_PACKHEADERBYTEORDER(X) do { packheaderbyteorder = (X); } while(0)
+#define MS_PACKDATABYTEORDER(X) do { packdatabyteorder = (X); } while(0)
/* Global variables (defined in unpack.c) and macros to set/force
* unpack byte orders */
extern flag unpackheaderbyteorder;
extern flag unpackdatabyteorder;
-#define MS_UNPACKHEADERBYTEORDER(X) (unpackheaderbyteorder = X);
-#define MS_UNPACKDATABYTEORDER(X) (unpackdatabyteorder = X);
+#define MS_UNPACKHEADERBYTEORDER(X) do { unpackheaderbyteorder = (X); } while(0)
+#define MS_UNPACKDATABYTEORDER(X) do { unpackdatabyteorder = (X); } while(0)
/* Global variables (defined in unpack.c) and macros to set/force
* encoding and fallback encoding */
extern int unpackencodingformat;
extern int unpackencodingfallback;
-#define MS_UNPACKENCODINGFORMAT(X) (unpackencodingformat = X);
-#define MS_UNPACKENCODINGFALLBACK(X) (unpackencodingfallback = X);
+#define MS_UNPACKENCODINGFORMAT(X) do { unpackencodingformat = (X); } while(0)
+#define MS_UNPACKENCODINGFALLBACK(X) do { unpackencodingfallback = (X); } while(0)
/* Mini-SEED record related functions */
extern int msr_parse (char *record, int recbuflen, MSRecord **ppmsr, int reclen,
@@ -816,16 +816,35 @@ extern void ms_gswap3 ( void *data3 );
extern void ms_gswap4 ( void *data4 );
extern void ms_gswap8 ( void *data8 );
-/* Generic byte swapping routines for memory aligned quantities */
+/* Generic byte swapping routines for memory aligned quantities; names exist
+ * for backwards compatibility, but are the same as the generic routines. */
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) || defined (__clang__)
+__attribute__ ((deprecated("Use ms_gswap2 instead.")))
extern void ms_gswap2a ( void *data2 );
+__attribute__ ((deprecated("Use ms_gswap4 instead.")))
extern void ms_gswap4a ( void *data4 );
+__attribute__ ((deprecated("Use ms_gswap8 instead.")))
extern void ms_gswap8a ( void *data8 );
+#elif defined(_MSC_FULL_VER) && (_MSC_FULL_VER > 140050320)
+__declspec(deprecated("Use ms_gswap2 instead."))
+extern void ms_gswap2a ( void *data2 );
+__declspec(deprecated("Use ms_gswap4 instead."))
+extern void ms_gswap4a ( void *data4 );
+__declspec(deprecated("Use ms_gswap8 instead."))
+extern void ms_gswap8a ( void *data8 );
+#else
+extern void ms_gswap2a ( void *data2 );
+extern void ms_gswap4a ( void *data4 );
+extern void ms_gswap8a ( void *data8 );
+#endif
/* Byte swap macro for the BTime struct */
-#define MS_SWAPBTIME(x) \
- ms_gswap2 (x.year); \
- ms_gswap2 (x.day); \
- ms_gswap2 (x.fract);
+#define MS_SWAPBTIME(x) \
+ do { \
+ ms_gswap2 (x.year); \
+ ms_gswap2 (x.day); \
+ ms_gswap2 (x.fract); \
+ } while (0)
/* Platform portable functions */
extern off_t lmp_ftello (FILE *stream);
diff --git a/bin/rt/orb2ringserver/libmseed/msrutils.c b/bin/rt/orb2ringserver/libmseed/msrutils.c
index 28a8208c0..f75654089 100644
--- a/bin/rt/orb2ringserver/libmseed/msrutils.c
+++ b/bin/rt/orb2ringserver/libmseed/msrutils.c
@@ -6,8 +6,6 @@
* Written by Chad Trabant
* ORFEUS/EC-Project MEREDIAN
* IRIS Data Management Center
- *
- * modified: 2016.283
***************************************************************************/
#include
@@ -254,7 +252,7 @@ msr_normalize_header (MSRecord *msr, flag verbose)
struct blkt_link_s *cur_blkt;
hptime_t hptimems;
int8_t usecoffset;
- char seqnum[7];
+ char seqnum[16];
int offset = 0;
int blktcnt = 0;
int reclenexp = 0;
@@ -277,7 +275,7 @@ msr_normalize_header (MSRecord *msr, flag verbose)
msr->sequence_number = 1;
/* Update values in the MSRecord.fsdh struct */
- snprintf (seqnum, 7, "%06d", msr->sequence_number);
+ snprintf (seqnum, sizeof(seqnum), "%06d", msr->sequence_number);
memcpy (msr->fsdh->sequence_number, seqnum, 6);
msr->fsdh->dataquality = msr->dataquality;
msr->fsdh->reserved = ' ';
diff --git a/bin/rt/orb2ringserver/libmseed/pack.c b/bin/rt/orb2ringserver/libmseed/pack.c
index 056d148a2..900e1c4c7 100644
--- a/bin/rt/orb2ringserver/libmseed/pack.c
+++ b/bin/rt/orb2ringserver/libmseed/pack.c
@@ -6,8 +6,6 @@
*
* Written by Chad Trabant,
* IRIS Data Management Center
- *
- * modified: 2015.273
***************************************************************************/
#include
@@ -847,7 +845,7 @@ msr_update_header (MSRecord *msr, char *rawrec, flag swapflag,
struct fsdh_s *fsdh;
hptime_t hptimems;
int8_t usecoffset;
- char seqnum[7];
+ char seqnum[16];
if (!msr || !rawrec)
return -1;
@@ -858,7 +856,7 @@ msr_update_header (MSRecord *msr, char *rawrec, flag swapflag,
fsdh = (struct fsdh_s *)rawrec;
/* Pack values into the fixed section of header */
- snprintf (seqnum, 7, "%06d", msr->sequence_number);
+ snprintf (seqnum, sizeof(seqnum), "%06d", msr->sequence_number);
memcpy (fsdh->sequence_number, seqnum, 6);
/* Get start time rounded to tenths of milliseconds and microsecond offset */
diff --git a/bin/rt/orb2ringserver/libmseed/packdata.c b/bin/rt/orb2ringserver/libmseed/packdata.c
index 4841723c1..fc5288def 100644
--- a/bin/rt/orb2ringserver/libmseed/packdata.c
+++ b/bin/rt/orb2ringserver/libmseed/packdata.c
@@ -74,7 +74,7 @@ msr_encode_int16 (int32_t *input, int samplecount, int16_t *output,
output[idx] = (int16_t)input[idx];
if (swapflag)
- ms_gswap2a (&output[idx]);
+ ms_gswap2 (&output[idx]);
outputlength -= sizeof (int16_t);
}
@@ -111,7 +111,7 @@ msr_encode_int32 (int32_t *input, int samplecount, int32_t *output,
output[idx] = input[idx];
if (swapflag)
- ms_gswap4a (&output[idx]);
+ ms_gswap4 (&output[idx]);
outputlength -= sizeof (int32_t);
}
@@ -148,7 +148,7 @@ msr_encode_float32 (float *input, int samplecount, float *output,
output[idx] = input[idx];
if (swapflag)
- ms_gswap4a (&output[idx]);
+ ms_gswap4 (&output[idx]);
outputlength -= sizeof (float);
}
@@ -185,7 +185,7 @@ msr_encode_float64 (double *input, int samplecount, double *output,
output[idx] = input[idx];
if (swapflag)
- ms_gswap8a (&output[idx]);
+ ms_gswap8 (&output[idx]);
outputlength -= sizeof (double);
}
@@ -287,7 +287,7 @@ msr_encode_steim1 (int32_t *input, int samplecount, int32_t *output,
ms_log (1, "Frame %d: X0=%d\n", frameidx, frameptr[1]);
if (swapflag)
- ms_gswap4a (&frameptr[1]);
+ ms_gswap4 (&frameptr[1]);
Xnp = &frameptr[2];
@@ -360,8 +360,8 @@ msr_encode_steim1 (int32_t *input, int samplecount, int32_t *output,
if (swapflag)
{
- ms_gswap2a (&word->d16[0]);
- ms_gswap2a (&word->d16[1]);
+ ms_gswap2 (&word->d16[0]);
+ ms_gswap2 (&word->d16[1]);
}
/* 2-bit nibble is 0b10 (0x2) */
@@ -378,7 +378,7 @@ msr_encode_steim1 (int32_t *input, int samplecount, int32_t *output,
frameptr[widx] = diffs[0];
if (swapflag)
- ms_gswap4a (&frameptr[widx]);
+ ms_gswap4 (&frameptr[widx]);
/* 2-bit nibble is 0b11 (0x3) */
frameptr[0] |= 0x3ul << (30 - 2 * widx);
@@ -392,14 +392,14 @@ msr_encode_steim1 (int32_t *input, int samplecount, int32_t *output,
/* Swap word with nibbles */
if (swapflag)
- ms_gswap4a (&frameptr[0]);
+ ms_gswap4 (&frameptr[0]);
} /* Done with frames */
/* Set Xn (reverse integration constant) in first frame to last sample */
if (Xnp)
*Xnp = *(input + outputsamples - 1);
if (swapflag)
- ms_gswap4a (Xnp);
+ ms_gswap4 (Xnp);
/* Pad any remaining bytes */
if ((frameidx * 64) < outputlength)
@@ -478,7 +478,7 @@ msr_encode_steim2 (int32_t *input, int samplecount, int32_t *output,
ms_log (1, "Frame %d: X0=%d\n", frameidx, frameptr[1]);
if (swapflag)
- ms_gswap4a (&frameptr[1]);
+ ms_gswap4 (&frameptr[1]);
Xnp = (int32_t *)&frameptr[2];
@@ -687,7 +687,7 @@ msr_encode_steim2 (int32_t *input, int samplecount, int32_t *output,
/* Swap encoded word except for 4x8-bit samples */
if (swapflag && packedsamples != 4)
- ms_gswap4a (&frameptr[widx]);
+ ms_gswap4 (&frameptr[widx]);
diffcount -= packedsamples;
outputsamples += packedsamples;
@@ -695,14 +695,14 @@ msr_encode_steim2 (int32_t *input, int samplecount, int32_t *output,
/* Swap word with nibbles */
if (swapflag)
- ms_gswap4a (&frameptr[0]);
+ ms_gswap4 (&frameptr[0]);
} /* Done with frames */
/* Set Xn (reverse integration constant) in first frame to last sample */
if (Xnp)
*Xnp = *(input + outputsamples - 1);
if (swapflag)
- ms_gswap4a (Xnp);
+ ms_gswap4 (Xnp);
/* Pad any remaining bytes */
if ((frameidx * 64) < outputlength)
diff --git a/bin/rt/orb2ringserver/libmseed/parseutils.c b/bin/rt/orb2ringserver/libmseed/parseutils.c
index 3af786d05..bb2010ebf 100644
--- a/bin/rt/orb2ringserver/libmseed/parseutils.c
+++ b/bin/rt/orb2ringserver/libmseed/parseutils.c
@@ -4,8 +4,6 @@
*
* Written by Chad Trabant
* IRIS Data Management Center
- *
- * modified: 2015.108
***************************************************************************/
#include
@@ -396,12 +394,12 @@ ms_parse_raw (char *record, int maxreclen, flag details, flag swapflag)
if (swapflag)
{
MS_SWAPBTIME (&fsdh->start_time);
- ms_gswap2a (&fsdh->numsamples);
- ms_gswap2a (&fsdh->samprate_fact);
- ms_gswap2a (&fsdh->samprate_mult);
- ms_gswap4a (&fsdh->time_correct);
- ms_gswap2a (&fsdh->data_offset);
- ms_gswap2a (&fsdh->blockette_offset);
+ ms_gswap2 (&fsdh->numsamples);
+ ms_gswap2 (&fsdh->samprate_fact);
+ ms_gswap2 (&fsdh->samprate_mult);
+ ms_gswap4 (&fsdh->time_correct);
+ ms_gswap2 (&fsdh->data_offset);
+ ms_gswap2 (&fsdh->blockette_offset);
}
/* Validate fixed section header fields */
@@ -944,7 +942,9 @@ ms_parse_raw (char *record, int maxreclen, flag details, flag swapflag)
struct blkt_395_s *blkt_395 = (struct blkt_395_s *)(record + blkt_offset + 4);
if (swapflag)
+ {
MS_SWAPBTIME (&blkt_395->time);
+ }
if (details >= 1)
{
diff --git a/bin/rt/orb2ringserver/libmseed/tracelist.c b/bin/rt/orb2ringserver/libmseed/tracelist.c
index a333484b1..7db21e27b 100644
--- a/bin/rt/orb2ringserver/libmseed/tracelist.c
+++ b/bin/rt/orb2ringserver/libmseed/tracelist.c
@@ -4,8 +4,6 @@
* Routines to handle TraceList and related structures.
*
* Written by Chad Trabant, IRIS Data Management Center
- *
- * modified: 2015.108
***************************************************************************/
#include
@@ -989,8 +987,8 @@ mstl_printtracelist (MSTraceList *mstl, flag timeformat,
/* Create formatted time strings */
if (timeformat == 2)
{
- snprintf (stime, sizeof (stime), "%.6f", (double)MS_HPTIME2EPOCH (seg->starttime));
- snprintf (etime, sizeof (etime), "%.6f", (double)MS_HPTIME2EPOCH (seg->endtime));
+ snprintf (stime, sizeof (stime), "%.6f", MS_HPTIME2EPOCH ((double)seg->starttime));
+ snprintf (etime, sizeof (etime), "%.6f", MS_HPTIME2EPOCH ((double)seg->endtime));
}
else if (timeformat == 1)
{
@@ -1091,7 +1089,7 @@ mstl_printsynclist (MSTraceList *mstl, char *dccid, flag subsecond)
MSTraceSeg *seg = 0;
char starttime[30];
char endtime[30];
- char yearday[10];
+ char yearday[24];
time_t now;
struct tm *nt;
@@ -1230,8 +1228,8 @@ mstl_printgaplist (MSTraceList *mstl, flag timeformat,
/* Create formatted time strings */
if (timeformat == 2)
{
- snprintf (time1, sizeof (time1), "%.6f", (double)MS_HPTIME2EPOCH (seg->endtime));
- snprintf (time2, sizeof (time2), "%.6f", (double)MS_HPTIME2EPOCH (seg->next->starttime));
+ snprintf (time1, sizeof (time1), "%.6f", MS_HPTIME2EPOCH ((double)seg->endtime));
+ snprintf (time2, sizeof (time2), "%.6f", MS_HPTIME2EPOCH ((double)seg->next->starttime));
}
else if (timeformat == 1)
{
diff --git a/bin/rt/orb2ringserver/libmseed/traceutils.c b/bin/rt/orb2ringserver/libmseed/traceutils.c
index 8819a911d..359b3094f 100644
--- a/bin/rt/orb2ringserver/libmseed/traceutils.c
+++ b/bin/rt/orb2ringserver/libmseed/traceutils.c
@@ -438,7 +438,7 @@ mst_addmsr (MSTrace *mst, MSRecord *msr, flag whence)
{
int samplesize = 0;
- if (!mst || !msr)
+ if (!mst || !msr || (whence != 1 && whence != 2))
return -1;
/* Reallocate data sample buffer if samples are present */
@@ -473,40 +473,34 @@ mst_addmsr (MSTrace *mst, MSRecord *msr, flag whence)
ms_log (2, "mst_addmsr(): Cannot allocate memory\n");
return -1;
}
- }
- /* Add samples at end of trace */
- if (whence == 1)
- {
- if (msr->datasamples && msr->numsamples >= 0)
+ /* Add samples at end of trace */
+ if (whence == 1)
{
memcpy ((char *)mst->datasamples + (mst->numsamples * samplesize),
msr->datasamples,
(size_t) (msr->numsamples * samplesize));
mst->numsamples += msr->numsamples;
- }
- mst->endtime = msr_endtime (msr);
+ mst->endtime = msr_endtime (msr);
- if (mst->endtime == HPTERROR)
- {
- ms_log (2, "mst_addmsr(): Error calculating record end time\n");
- return -1;
+ if (mst->endtime == HPTERROR)
+ {
+ ms_log (2, "mst_addmsr(): Error calculating record end time\n");
+ return -1;
+ }
}
- }
- /* Add samples at the beginning of trace */
- else if (whence == 2)
- {
- if (msr->datasamples && msr->numsamples >= 0)
+ /* Add samples at the beginning of trace */
+ else if (whence == 2)
{
/* Move any samples to end of buffer */
if (mst->numsamples > 0)
{
memmove ((char *)mst->datasamples + (msr->numsamples * samplesize),
- mst->datasamples,
- (size_t) (mst->numsamples * samplesize));
+ mst->datasamples,
+ (size_t) (mst->numsamples * samplesize));
}
memcpy (mst->datasamples,
@@ -514,17 +508,17 @@ mst_addmsr (MSTrace *mst, MSRecord *msr, flag whence)
(size_t) (msr->numsamples * samplesize));
mst->numsamples += msr->numsamples;
- }
- mst->starttime = msr->starttime;
- }
+ mst->starttime = msr->starttime;
+ }
- /* If two different data qualities reset the MSTrace.dataquality to 0 */
- if (mst->dataquality && msr->dataquality && mst->dataquality != msr->dataquality)
- mst->dataquality = 0;
+ /* If two different data qualities reset the MSTrace.dataquality to 0 */
+ if (mst->dataquality && msr->dataquality && mst->dataquality != msr->dataquality)
+ mst->dataquality = 0;
- /* Update MSTrace sample count */
- mst->samplecnt += msr->samplecnt;
+ /* Update MSTrace sample count */
+ mst->samplecnt += msr->numsamples;
+ }
return 0;
} /* End of mst_addmsr() */
@@ -549,7 +543,7 @@ mst_addspan (MSTrace *mst, hptime_t starttime, hptime_t endtime,
{
int samplesize = 0;
- if (!mst)
+ if (!mst || (whence != 1 && whence != 2))
return -1;
if (datasamples && numsamples > 0)
@@ -576,34 +570,28 @@ mst_addspan (MSTrace *mst, hptime_t starttime, hptime_t endtime,
ms_log (2, "mst_addspan(): Cannot allocate memory\n");
return -1;
}
- }
- /* Add samples at end of trace */
- if (whence == 1)
- {
- if (datasamples && numsamples > 0)
+ /* Add samples at end of trace */
+ if (whence == 1)
{
memcpy ((char *)mst->datasamples + (mst->numsamples * samplesize),
datasamples,
(size_t) (numsamples * samplesize));
mst->numsamples += numsamples;
- }
- mst->endtime = endtime;
- }
+ mst->endtime = endtime;
+ }
- /* Add samples at the beginning of trace */
- else if (whence == 2)
- {
- if (datasamples && numsamples > 0)
+ /* Add samples at the beginning of trace */
+ else if (whence == 2)
{
/* Move any samples to end of buffer */
if (mst->numsamples > 0)
{
memmove ((char *)mst->datasamples + (numsamples * samplesize),
- mst->datasamples,
- (size_t) (mst->numsamples * samplesize));
+ mst->datasamples,
+ (size_t) (mst->numsamples * samplesize));
}
memcpy (mst->datasamples,
@@ -611,14 +599,15 @@ mst_addspan (MSTrace *mst, hptime_t starttime, hptime_t endtime,
(size_t) (numsamples * samplesize));
mst->numsamples += numsamples;
+
+ mst->starttime = starttime;
}
- mst->starttime = starttime;
- }
+ /* Update MSTrace sample count */
+ if (numsamples > 0)
+ mst->samplecnt += numsamples;
- /* Update MSTrace sample count */
- if (numsamples > 0)
- mst->samplecnt += numsamples;
+ }
return 0;
} /* End of mst_addspan() */
@@ -1341,8 +1330,8 @@ mst_printtracelist (MSTraceGroup *mstg, flag timeformat,
/* Create formatted time strings */
if (timeformat == 2)
{
- snprintf (stime, sizeof (stime), "%.6f", (double)MS_HPTIME2EPOCH (mst->starttime));
- snprintf (etime, sizeof (etime), "%.6f", (double)MS_HPTIME2EPOCH (mst->endtime));
+ snprintf (stime, sizeof (stime), "%.6f", MS_HPTIME2EPOCH ((double)mst->starttime));
+ snprintf (etime, sizeof (etime), "%.6f", MS_HPTIME2EPOCH ((double)mst->endtime));
}
else if (timeformat == 1)
{
@@ -1445,7 +1434,7 @@ mst_printsynclist (MSTraceGroup *mstg, char *dccid, flag subsecond)
MSTrace *mst = 0;
char stime[30];
char etime[30];
- char yearday[32];
+ char yearday[24];
time_t now;
struct tm *nt;
@@ -1586,8 +1575,8 @@ mst_printgaplist (MSTraceGroup *mstg, flag timeformat,
/* Create formatted time strings */
if (timeformat == 2)
{
- snprintf (time1, sizeof (time1), "%.6f", (double)MS_HPTIME2EPOCH (mst->endtime));
- snprintf (time2, sizeof (time2), "%.6f", (double)MS_HPTIME2EPOCH (mst->next->starttime));
+ snprintf (time1, sizeof (time1), "%.6f", MS_HPTIME2EPOCH ((double)mst->endtime));
+ snprintf (time2, sizeof (time2), "%.6f", MS_HPTIME2EPOCH ((double)mst->next->starttime));
}
else if (timeformat == 1)
{
diff --git a/bin/rt/orb2ringserver/libmseed/unpack.c b/bin/rt/orb2ringserver/libmseed/unpack.c
index 2866d5ec4..a78d6df80 100644
--- a/bin/rt/orb2ringserver/libmseed/unpack.c
+++ b/bin/rt/orb2ringserver/libmseed/unpack.c
@@ -156,12 +156,12 @@ msr_unpack (char *record, int reclen, MSRecord **ppmsr,
if (headerswapflag)
{
MS_SWAPBTIME (&msr->fsdh->start_time);
- ms_gswap2a (&msr->fsdh->numsamples);
- ms_gswap2a (&msr->fsdh->samprate_fact);
- ms_gswap2a (&msr->fsdh->samprate_mult);
- ms_gswap4a (&msr->fsdh->time_correct);
- ms_gswap2a (&msr->fsdh->data_offset);
- ms_gswap2a (&msr->fsdh->blockette_offset);
+ ms_gswap2 (&msr->fsdh->numsamples);
+ ms_gswap2 (&msr->fsdh->samprate_fact);
+ ms_gswap2 (&msr->fsdh->samprate_mult);
+ ms_gswap4 (&msr->fsdh->time_correct);
+ ms_gswap2 (&msr->fsdh->data_offset);
+ ms_gswap2 (&msr->fsdh->blockette_offset);
}
/* Populate some of the common header fields */
diff --git a/bin/rt/orb2ringserver/libmseed/unpackdata.c b/bin/rt/orb2ringserver/libmseed/unpackdata.c
index 24d30ff76..7c1a7f240 100644
--- a/bin/rt/orb2ringserver/libmseed/unpackdata.c
+++ b/bin/rt/orb2ringserver/libmseed/unpackdata.c
@@ -50,7 +50,7 @@ msr_decode_int16 (int16_t *input, int samplecount, int32_t *output,
sample = input[idx];
if (swapflag)
- ms_gswap2a (&sample);
+ ms_gswap2 (&sample);
output[idx] = (int32_t)sample;
@@ -86,7 +86,7 @@ msr_decode_int32 (int32_t *input, int samplecount, int32_t *output,
sample = input[idx];
if (swapflag)
- ms_gswap4a (&sample);
+ ms_gswap4 (&sample);
output[idx] = sample;
@@ -122,7 +122,7 @@ msr_decode_float32 (float *input, int samplecount, float *output,
memcpy (&sample, &input[idx], sizeof (float));
if (swapflag)
- ms_gswap4a (&sample);
+ ms_gswap4 (&sample);
output[idx] = sample;
@@ -158,7 +158,7 @@ msr_decode_float64 (double *input, int samplecount, double *output,
memcpy (&sample, &input[idx], sizeof (double));
if (swapflag)
- ms_gswap8a (&sample);
+ ms_gswap8 (&sample);
output[idx] = sample;
@@ -220,8 +220,8 @@ msr_decode_steim1 (int32_t *input, int inputlength, int samplecount,
{
if (swapflag)
{
- ms_gswap4a (&frame[1]);
- ms_gswap4a (&frame[2]);
+ ms_gswap4 (&frame[1]);
+ ms_gswap4 (&frame[2]);
}
X0 = frame[1];
@@ -242,7 +242,7 @@ msr_decode_steim1 (int32_t *input, int inputlength, int samplecount,
/* Swap 32-bit word containing the nibbles */
if (swapflag)
- ms_gswap4a (&frame[0]);
+ ms_gswap4 (&frame[0]);
/* Decode each 32-bit word according to nibble */
for (widx = startnibble; widx < 16 && samplecount > 0; widx++)
@@ -273,8 +273,8 @@ msr_decode_steim1 (int32_t *input, int inputlength, int samplecount,
if (swapflag)
{
- ms_gswap2a (&word->d16[0]);
- ms_gswap2a (&word->d16[1]);
+ ms_gswap2 (&word->d16[0]);
+ ms_gswap2 (&word->d16[1]);
}
if (decodedebug)
@@ -284,7 +284,7 @@ msr_decode_steim1 (int32_t *input, int inputlength, int samplecount,
case 3: /* 11: One 4-byte difference */
diffcount = 1;
if (swapflag)
- ms_gswap4a (&word->d32);
+ ms_gswap4 (&word->d32);
if (decodedebug)
ms_log (1, " W%02d: 11=1x32b %d\n", widx, word->d32);
@@ -375,8 +375,8 @@ msr_decode_steim2 (int32_t *input, int inputlength, int samplecount,
{
if (swapflag)
{
- ms_gswap4a (&frame[1]);
- ms_gswap4a (&frame[2]);
+ ms_gswap4 (&frame[1]);
+ ms_gswap4 (&frame[2]);
}
X0 = frame[1];
@@ -397,7 +397,7 @@ msr_decode_steim2 (int32_t *input, int inputlength, int samplecount,
/* Swap 32-bit word containing the nibbles */
if (swapflag)
- ms_gswap4a (&frame[0]);
+ ms_gswap4 (&frame[0]);
/* Decode each 32-bit word according to nibble */
for (widx = startnibble; widx < 16 && samplecount > 0; widx++)
@@ -428,7 +428,7 @@ msr_decode_steim2 (int32_t *input, int inputlength, int samplecount,
case 2: /* nibble=10: Must consult dnib, the high order two bits */
if (swapflag)
- ms_gswap4a (&frame[widx]);
+ ms_gswap4 (&frame[widx]);
dnib = EXTRACTBITRANGE (frame[widx], 30, 2);
switch (dnib)
@@ -480,7 +480,7 @@ msr_decode_steim2 (int32_t *input, int inputlength, int samplecount,
case 3: /* nibble=11: Must consult dnib, the high order two bits */
if (swapflag)
- ms_gswap4a (&frame[widx]);
+ ms_gswap4 (&frame[widx]);
dnib = EXTRACTBITRANGE (frame[widx], 30, 2);
switch (dnib)
@@ -638,7 +638,7 @@ msr_decode_geoscope (char *input, int samplecount, float *output,
case DE_GEOSCOPE163:
memcpy (&sint, input, sizeof (int16_t));
if (swapflag)
- ms_gswap2a (&sint);
+ ms_gswap2 (&sint);
/* Recover mantissa and gain range factor */
mantissa = (sint & GEOSCOPE_MANTISSA_MASK);
@@ -655,7 +655,7 @@ msr_decode_geoscope (char *input, int samplecount, float *output,
case DE_GEOSCOPE164:
memcpy (&sint, input, sizeof (int16_t));
if (swapflag)
- ms_gswap2a (&sint);
+ ms_gswap2 (&sint);
/* Recover mantissa and gain range factor */
mantissa = (sint & GEOSCOPE_MANTISSA_MASK);
@@ -751,7 +751,7 @@ msr_decode_cdsn (int16_t *input, int samplecount, int32_t *output,
{
memcpy (&sint, &input[idx], sizeof (int16_t));
if (swapflag)
- ms_gswap2a (&sint);
+ ms_gswap2 (&sint);
/* Recover mantissa and gain range factor */
mantissa = (sint & CDSN_MANTISSA_MASK);
@@ -844,7 +844,7 @@ msr_decode_sro (int16_t *input, int samplecount, int32_t *output,
{
memcpy (&sint, &input[idx], sizeof (int16_t));
if (swapflag)
- ms_gswap2a (&sint);
+ ms_gswap2 (&sint);
/* Recover mantissa and gain range factor */
mantissa = (sint & SRO_MANTISSA_MASK);
@@ -898,7 +898,7 @@ msr_decode_dwwssn (int16_t *input, int samplecount, int32_t *output,
{
memcpy (&sint, &input[idx], sizeof (uint16_t));
if (swapflag)
- ms_gswap2a (&sint);
+ ms_gswap2 (&sint);
sample = (int32_t)sint;
/* Take 2's complement for sample */
diff --git a/bin/rt/orb2ringserver/orb2ringserver.c b/bin/rt/orb2ringserver/orb2ringserver.c
index 0617f8856..b3587061c 100644
--- a/bin/rt/orb2ringserver/orb2ringserver.c
+++ b/bin/rt/orb2ringserver/orb2ringserver.c
@@ -21,7 +21,7 @@
#include "orb.h"
#define PACKAGE "orb2ringserver"
-#define VERSION "1.6"
+#define VERSION "1.7"
static int verbose = 0;
static char *match = 0; /* ORB streams to match */
@@ -945,10 +945,10 @@ parameter_proc (int argcount, char **argvec)
elog_init (argcount, argvec);
/* Initialize the logging for the dl_log family */
- dl_loginit (verbose - 1, &elog_printlog, NULL, &elog_printerr, NULL);
+ dl_loginit (verbose - 1, &elog_printlog, " ", &elog_printerr, "!");
/* Initialize the logging for the ms_log family */
- ms_loginit (&elog_printlog, NULL, &elog_printerr, NULL);
+ ms_loginit (&elog_printlog, " ", &elog_printerr, "!");
/* Make sure a source ORB server was specified */
if (!orbaddr)
@@ -1022,20 +1022,29 @@ getoptval (int argcount, char **argvec, int argopt)
/***************************************************************************
* elog_printlog():
- * A hook to re-direct sl_log() (libslink) log messages to elog_notify.
+ * A hook to re-direct dl_log() (libdali) and ms_log() (libmseed)
+ * log messages to elog_notify.
***************************************************************************/
static void
elog_printlog (char *msg)
{
- elog_notify (0, "%s", msg);
+ if (msg)
+ elog_notify (0, "%s", msg+1);
}
/***************************************************************************
* elog_printerr():
- * A hook to re-direct sl_log() (libslink) error messages to elog_complain.
+ * A hook to re-direct dl_log() (libdali) and ms_log() (libmseed)
+ * log messages to elog_complain.
***************************************************************************/
static void
elog_printerr (char *msg)
{
- elog_complain (0, "%s", msg);
+ if (msg)
+ {
+ if (msg[0] == '!')
+ elog_complain (0, "%s", msg+1);
+ else
+ elog_notify(0, "%s", msg+1);
+ }
}
diff --git a/bin/utility/mkmf/mkmf.csh b/bin/utility/mkmf/mkmf.csh
deleted file mode 100644
index 37a722823..000000000
--- a/bin/utility/mkmf/mkmf.csh
+++ /dev/null
@@ -1,44 +0,0 @@
-
-set nonomatch
-
-set mybins=""
-set patterns="*.c *.cpp *.F *.f *.sh *.csh *.tcl *.xpl *.xppl *.xpls *.xtcl *.xwish *.xvwish *.xwish8 *.xpy *.xbqpy"
-foreach pat ($patterns)
- set ft=( $pat )
- if (-e $ft[1] ) then
- set mybins=`printf "%s %s" $mybins $ft:gr`
- endif
-end
-if ( "${mybins}--" != "--"} ) then
-echo "BIN=$mybins"
-endif
-
-set pat="*.pf"
-set ft = ( $pat )
-if (-e $ft[1] ) then
- echo PF=$ft
-endif
-
-set myincludes=""
-set patterns="*.h *.i"
-foreach pat ($patterns)
- set ft=( $pat )
- if (-e $ft[1] ) then
- set myincludes=`printf "%s %s" $myincludes $ft`
- endif
-end
-if ( "${myincludes}--" != "--" ) then
-echo "INCLUDE=$myincludes"
-endif
-
-
-foreach mansect ( 1 2 3 4 5 6 7 8)
- set ft= ( *.$mansect* )
- if (-e $ft[1]) then
- echo "MAN$mansect=$ft"
- endif
-end
-
-echo 'include $(ANTELOPEMAKE)'
-echo 'DIRS='
-echo 'SUBDIR=/contrib'
diff --git a/bin/utility/mkmf/mkmf.sh b/bin/utility/mkmf/mkmf.sh
new file mode 100644
index 000000000..585a07d58
--- /dev/null
+++ b/bin/utility/mkmf/mkmf.sh
@@ -0,0 +1,65 @@
+#!/bin/sh
+
+# Version 1.1 2023-03-13
+# translated from csh to bash, since csh seems to disappear from our computers...
+
+declare -a mybins=()
+patterns=".c .cpp .F .f .sh .csh .tcl .xpl .xppl .xpls .ptk .xtcl .xwish .xvwish .xwish8 .oxwish .xpy .xbqpy .xbqpyn .xbqpyx .xpys"
+for pat in ${patterns[@]}
+do
+ for ff in *$pat; do
+ if [ -f $ff ]; then
+ fb=$(basename -s $pat $ff)
+ mybins+=($(basename -s $pat $ff))
+ fi
+ done
+done
+if [[ ${#mybins[@]} -gt 0 ]];then
+ mybins=$(printf " %s" "${mybins[@]}")
+ echo "BIN=${mybins:1}" # get rid of initial space
+fi
+
+declare -a mypfs=()
+pat=".pf"
+for ff in *$pat; do
+ if [ -f $ff ]; then
+ mypfs+=($ff)
+ fi
+done
+if [[ ${#mypfs[@]} -gt 0 ]];then
+ mypfs=$(printf " %s" "${mypfs[@]}")
+ echo "PF=${mypfs:1}"
+fi
+
+declare -a myincludes=()
+patterns=".h .i"
+for pat in ${patterns[@]}
+do
+ for ff in *$pat; do
+ if [ -f $ff ]; then
+ myincludes+=($ff)
+ fi
+ done
+done
+if [[ ${#myincludes[@]} -gt 0 ]];then
+ myincludes=$(printf " %s" "${myincludes[@]}")
+ echo "INCLUDE=${myincludes:1}"
+fi
+
+declare -a mymanpages
+for mansect in 1 2 3 4 5 6 7 8; do
+ mymanpages=()
+ for ff in *.$mansect*; do
+ if [ -f $ff ]; then
+ mymanpages+=($ff)
+ fi
+ if [[ ${#mymanpages[@]} -gt 0 ]];then
+ mp=$(printf " %s" "${mymanpages[@]}")
+ echo "MAN$mansect=${mp:1}"
+ fi
+ done
+done
+
+echo 'include $(ANTELOPEMAKE)'
+echo 'DIRS='
+echo 'SUBDIR=/contrib'
diff --git a/bin/utility/pfcp/LICENSE b/bin/utility/pfcp/LICENSE
new file mode 100644
index 000000000..98eb59478
--- /dev/null
+++ b/bin/utility/pfcp/LICENSE
@@ -0,0 +1,39 @@
+Copyright (c) 2003 Nikolaus Horn
+All rights reserved.
+
+This software is licensed under the New BSD license:
+
+Redistribution and use in source and binary forms,
+with or without modification, are permitted provided
+that the following conditions are met:
+
+* Redistributions of source code must retain the above
+copyright notice, this list of conditions and the
+following disclaimer.
+
+* Redistributions in binary form must reproduce the
+above copyright notice, this list of conditions and
+the following disclaimer in the documentation and/or
+other materials provided with the distribution.
+
+* Neither the name of Nikolaus Horn nor
+the names of its contributors may be used to endorse
+or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
diff --git a/bin/utility/reltime/LICENSE b/bin/utility/reltime/LICENSE
new file mode 100644
index 000000000..3aed15749
--- /dev/null
+++ b/bin/utility/reltime/LICENSE
@@ -0,0 +1,39 @@
+Copyright (c) 2005 Nikolaus Horn
+All rights reserved.
+
+This software is licensed under the New BSD license:
+
+Redistribution and use in source and binary forms,
+with or without modification, are permitted provided
+that the following conditions are met:
+
+* Redistributions of source code must retain the above
+copyright notice, this list of conditions and the
+following disclaimer.
+
+* Redistributions in binary form must reproduce the
+above copyright notice, this list of conditions and
+the following disclaimer in the documentation and/or
+other materials provided with the distribution.
+
+* Neither the name of Nikolaus Horn nor
+the names of its contributors may be used to endorse
+or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
diff --git a/bin/utility/schemastuff/.gitignore b/bin/utility/schemastuff/.gitignore
index de3645a1c..48a7fc1d2 100644
--- a/bin/utility/schemastuff/.gitignore
+++ b/bin/utility/schemastuff/.gitignore
@@ -1 +1,3 @@
schema2tables
+check_schema
+sortschema
diff --git a/bin/utility/schemastuff/Makefile b/bin/utility/schemastuff/Makefile
index f816214ba..6a604586f 100644
--- a/bin/utility/schemastuff/Makefile
+++ b/bin/utility/schemastuff/Makefile
@@ -1,7 +1,7 @@
DATADIR=awk
-MAN1=schema2tables.1 splitschema.awk.1
+MAN1=schema2tables.1 splitschema.awk.1 check_schema.1
DATA=splitschema.awk
-BIN=schema2tables
+BIN=schema2tables check_schema
SUBDIR=/contrib
include $(ANTELOPEMAKE)
diff --git a/bin/utility/schemastuff/check_schema.1 b/bin/utility/schemastuff/check_schema.1
new file mode 100644
index 000000000..b6948acb1
--- /dev/null
+++ b/bin/utility/schemastuff/check_schema.1
@@ -0,0 +1,50 @@
+.TH CHECK_SCHEMA 1
+.SH NAME
+check_schema \- check database definition for consistency and completeness
+.SH SYNOPSIS
+.nf
+check_schema [-a] [-s|-f] [-h] schema
+.fi
+
+.SH DESCRIPTION
+check_schema reads in schema definitions as all other antelope databaase processing does: schema definitions are read from one or more files found along a path that can be influenced by the environment variable \fBSCHEMA_DIR\fP as described in the manpage \fIdbschema\fP. Schema definitions can be redundant, i.e. something may be defined several times in varios files. It seems self-understanding that these definitions should be identical on all places. The program tries to detect all kind of inconsistencies in these definitions like:
+.nf
+ \(bu incomplete attribute definitions, i.e missing properties.
+ \(bu contradicting definitions, like range definitions out
+ of scope, null values in a different format than the actual
+ values, format definitions that use a datatype different
+ from the actual entry and so on.
+ \(bu incomplete definition of database tables (i.e. relations),
+ e.g. missing attributes, undefined keys and such.
+ \(bu inconsistent definition of attributes, e.g. same property
+ defined different in different files.
+.fi
+The program runs in two stages, first by reading in files one after each other and then by checking the resulting schema as presented by the antelope database engine itself. The first step is necessary to detect contradicting definitions and to indicate in which actual file the problems occur.
+The second step is necessary to verify if the database engine sees problems with the schema and to detect remaining problems.
+.SH OPTIONS
+.IP "-a"
+report all problems or inconsistencies, even only cosmetic ones.
+.IP "-f"
+File checks only.
+.IP "-s"
+Schema checks only.
+.IP "schema"
+Name of database schema. This argument is required
+
+.SH EXAMPLE
+.nf
+check_schema -a css3.0
+.fi
+
+.SH "BUGS AND CAVEATS"
+The biggest problem here is to give problems the true priority. The current implementation is probably a bit too verbose.
+
+.SH "SEE ALSO"
+.nf
+antelope(1), dbschema(5)
+.fi
+.SH AUTHOR
+.nf
+Nikolaus Horn, 2022
+
+ZAMG / Vienna, Nikolaus.Horn@zamg.ac.at
diff --git a/bin/utility/schemastuff/check_schema.xpy b/bin/utility/schemastuff/check_schema.xpy
new file mode 100644
index 000000000..d42ffae9c
--- /dev/null
+++ b/bin/utility/schemastuff/check_schema.xpy
@@ -0,0 +1,821 @@
+"""
+check schema definitions for inconsistencies
+this is done in 2 steps, first on the contents of the files parsed and then on the resultin schema in memory.
+The first step - files - is necessary to detect unused attributes, duplicate definitions and multiple definitions in general.
+
+
+@author Nikolaus Horn 1:
+ log_info(
+ "file %s: strange, found more than one relation (%d)"
+ % (filepath, n_relations)
+ )
+ problem_seen = True
+ for attribute in att:
+ my_att = att[attribute]
+ err = check_file_attribute(my_att, filepath)
+ if err:
+ error_seen = True
+ # for relation in rel:
+ # my_rel = rel[relation]
+ # check_relation(my_rel, att, filepath, base_attributes)
+
+ basedir = os.path.join(os.environ["ANTELOPE"] + "/contrib/data/schemas/" + extpath)
+ if os.path.exists(basedir):
+ directory = os.fsencode(basedir)
+ extension_attributes = {}
+ # first read the list of extension attributes
+ for myfile in os.listdir(directory):
+ filename = os.fsdecode(myfile)
+ fp = os.path.join(directory, myfile)
+ filepath = fp.decode()
+ if filename.startswith("."):
+ log_info("Attention: hidden file %s" % filepath)
+ problem_seen = True
+ err = False
+ err, att, __, __ = read_attributes(fp)
+ if err:
+ error_seen = True
+ extension_attributes.update(att)
+ # and then read in everything
+ for myfile in os.listdir(directory):
+ filename = os.fsdecode(myfile)
+ fp = os.path.join(directory, myfile)
+ filepath = fp.decode()
+ if filename.startswith("."):
+ log_info("Attention: hidden file %s" % filepath)
+ err = False
+ err, att, rel, schema = read_attributes(fp)
+ if err:
+ error_seen = True
+ attributes[filename] = att
+ all_attributes[fp] = att
+ relations[filename] = rel
+ all_relations[fp] = rel
+
+ if schema != {}:
+ log_info("file %s: second schema defined" % (filepath, schema))
+ error_seen = True
+ n_relations = len(rel.keys())
+ if n_relations > 1:
+ log_info(
+ "strange, found more than one relation (%d) in file %s"
+ % (n_relations, filepath)
+ )
+ error_seen = True
+ for attribute in att:
+ my_att = att[attribute]
+ err = check_file_attribute(my_att, filepath)
+ if err:
+ error_seen = True
+ for relation in rel:
+ my_rel = rel[relation]
+
+ other_attributes = copy.deepcopy(extension_attributes)
+ # for attribute in att:
+ # other_attributes.pop(attribute)
+ err = check_file_relation(
+ my_rel, att, filepath, base_attributes, other_attributes
+ )
+ if err:
+ error_seen = True
+ err = compare_all_attributes(all_attributes)
+ if err:
+ error_seen = True
+ return error_seen
+
+
+def compare_attribute(first, second):
+ """compare arrtibute definitions
+ type, length, format, units, range, null, description, detail
+ """
+ error_seen = False
+ name = first["attribute"]
+ f_file = first["file"].decode()
+ s_file = second["file"].decode()
+ f_type = first["type"]
+ s_type = second["type"]
+ f_len = first["len"]
+ s_len = second["len"]
+ f_format = None
+ s_format = None
+ if f_type != s_type:
+ error_seen = True
+ log_error(
+ "attribute '%s': TYPE '%s' != '%s' (defined in files %s and %s)"
+ % (name, f_type, s_type, f_file, s_file)
+ )
+ if f_len != s_len:
+ error_seen = True
+ log_error(
+ "attribute '%s': LENGTH '%d' != '%d' (defined in files %s and %s)"
+ % (name, f_len, s_len, f_file, s_file)
+ )
+
+ for thing in ["format", "units", "range", "null", "description", "detail"]:
+ f_thing = None
+ s_thing = None
+ if thing in first:
+ f_thing = first[thing]
+ if thing in second:
+ s_thing = second[thing]
+ if f_thing is not None and s_thing is not None:
+ if f_thing != s_thing:
+ if thing == "detail":
+ f_desc = f_thing.strip()
+ s_desc = s_thing.strip()
+ f_unif = f_desc.replace(" ", "").replace("\t", "").replace("\n", "")
+ s_unif = s_desc.replace(" ", "").replace("\t", "").replace("\n", "")
+ if f_desc != s_desc:
+ if f_unif == s_unif:
+ log_info(
+ "attribute '%s': whitespace differs in DETAIL between files %s and %s"
+ % (name, f_file, f_file)
+ )
+ else:
+ log_error(
+ "attribute '%s': DETAIL definitions \n'%s'\nand \n'%s'\ndiffer in files %s and %s)"
+ % (name, f_desc, s_desc, f_file, s_file)
+ )
+ else:
+ error_seen = True
+ log_error(
+ "attribute '%s': %s definitions '%s' and '%s' differ in files %s and %s)"
+ % (name, thing.upper(), f_thing, s_thing, f_file, s_file)
+ )
+ elif f_thing is not None:
+ error_seen = True
+ log_error(
+ "attribute '%s': %s '%s' defined in file %s but not in file %s)"
+ % (name, thing.upper(), f_thing, f_file, s_file)
+ )
+ elif s_thing is not None:
+ error_seen = True
+ log_error(
+ "attribute '%s': %s '%s' not defined in file %s but in file %s)"
+ % (name, thing.upper(), s_thing, f_file, s_file)
+ )
+ return error_seen
+
+
+def compare_all_attributes(all_attributes):
+ error_seen = False
+ a_checked = []
+ files = all_attributes.keys()
+ for file in files:
+ f_atts = all_attributes[file]
+ for a_name in f_atts.keys():
+ if not a_name in a_checked:
+ a_checked.append(a_name)
+ this_attribute = f_atts[a_name]
+ for other_file in files:
+ if other_file != file:
+ of_atts = all_attributes[other_file]
+ if a_name in of_atts:
+ of_attribute = of_atts[a_name]
+ err = compare_attribute(this_attribute, of_attribute)
+ if err:
+ error_seen = True
+ # print("fatt", f_atts, f_atts.keys())
+ # print("myfile: ", file)
+ return error_seen
+
+
+def check_file_relation(rel, att, filename, base_attributes, other_attributes):
+ error_seen = False
+ name = ""
+ if "relation" in rel:
+ name = rel["relation"]
+ else:
+ error_seen = True
+ log_complaint("file %s: nameless relation %s" % (filename, rel.keys()))
+ return
+ if not "fields" in rel:
+ error_seen = True
+ log_complaint("file %s: no fields in relation %s" % (filename, name))
+ return
+ for field in rel["fields"]:
+ defined_here = False
+ defined_there = False
+ defined_in_extensions = False
+ if field in att:
+ defined_here = True
+ if field in base_attributes:
+ defined_there = True
+ if field in other_attributes:
+ defined_in_extensions = True
+ if not (defined_here or defined_there):
+ if not defined_in_extensions:
+ error_seen = True
+ log_complaint("file %s: attribute '%s' undefined" % (filename, field))
+ else:
+ dfile = ""
+ if "file" in other_attributes[field]:
+ dfile = other_attributes[field]["file"].decode()
+ else:
+ error_seen = True
+ log_complaint(
+ "file %s: HELP! Unable to find filename for attribute '%s'"
+ % (filename, field)
+ )
+ error_seen = True
+ log_complaint(
+ "file %s: attribute '%s' defined in another extension (%s)"
+ % (filename, field, dfile)
+ )
+ return error_seen
+
+
+def check_file_attribute(att, filename):
+ name = ""
+ atype = ""
+ length = -1
+ error_seen = False
+ if "attribute" in att:
+ name = att["attribute"]
+ else:
+ log_complaintt("nameless attribute '%s'" % att.keys())
+ return
+ if "len" in att:
+ length = att["len"]
+ else:
+ error_seen = True
+ log_complaint(
+ "%s: no lenght defined for attribute '%s', giving up format check for this attribute"
+ % (filename, name)
+ )
+ return
+ if "type" in att:
+ atype = att["type"]
+ else:
+ error_seen = True
+ log_complaint(
+ "file %s: no type defined for attribute '%s', giving up format check for this attribute"
+ % (filename, name)
+ )
+ return
+
+ if "format" in att:
+ ftype = ""
+ formatstr = att["format"]
+ if len(formatstr) < 2:
+ error_seen = True
+ log_complaint(
+ "file %s: format specification '%s' too short for attribute '%s'"
+ % (filename, formatstr, name)
+ )
+ if atype != "dbptr":
+ fmtmatch = re.match(r"%(.*\d+)([a-z]+)", formatstr)
+ if fmtmatch:
+ fmt_nr = fmtmatch.group(1)
+ l_ftype = fmtmatch.group(2)
+ ftype = l_ftype[-1]
+ if len(l_ftype) == 2 and l_ftype[0] != "l":
+ error_seen = True
+ log_complaint(
+ "file %s: suspicious length specification '%s' in format for attribute '%s'"
+ % (filename, formatstr, name)
+ )
+ len_from_format = abs(int(float(fmt_nr)))
+ if len_from_format != length:
+ error_seen = True
+ log_complaint(
+ "file %s: length mismatch %d != '%s' for attribute '%s'"
+ % (filename, length, formatstr, name)
+ )
+ else:
+ error_seen = True
+ log_complaint(
+ "file %s: suspicious format '%s' for attribute '%s'"
+ % (filename, formatstr, name)
+ )
+
+ if not formatstr.startswith("%"):
+ error_seen = True
+ log_complaint(
+ "file %s: format %s for attribute '%s' should start with '%%'"
+ % (filename, formatstr, name)
+ )
+ if atype == "int" and ftype != "d":
+ error_seen = True
+ log_complaint(
+ "file %s: format type mismatch for attribute '%s' ('%s' != %s)"
+ % (filename, name, formatstr, atype)
+ )
+ if atype == "real" and ftype not in "efg":
+ error_seen = True
+ log_complaint(
+ "file %s: format type mismatch for attribute '%s' ('%s' != %s)"
+ % (filename, name, formatstr, atype)
+ )
+ if atype == "string" and ftype != "s":
+ error_seen = True
+ log_complaint(
+ "file %s: format type mismatch for attribute '%s' ('%s' != %s)"
+ % (filename, name, formatstr, atype)
+ )
+ if atype == "time" and ftype != "f":
+ error_seen = True
+ log_complaint(
+ "file %s: format type mismatch for attribute '%s' ('%s' != %s)"
+ % (filename, name, formatstr, atype)
+ )
+ else:
+ error_seen = True
+ log_complaint(
+ "file %s: no format specification for attribute '%s'" % (filename, name)
+ )
+
+ if "null" in att:
+ fnull = att["null"]
+ if atype == "real":
+ if not "." in fnull:
+ error_seen = True
+ log_complaint(
+ "file %s: NULL specification for attribute '%s' should be a float instead of '%s'"
+ % (filename, name, fnull)
+ )
+ else:
+ problem_seen = True
+ log_info("file %s: no NULL for attribute '%s'." % (filename, name))
+
+ if "range" in att:
+ frange = att["range"]
+ if name not in frange:
+ error_seen = True
+ log_complaint(
+ "file %s: meaningless RANGE check for attribute '%s'. Attribute not mentioned in definition of RANGE '%s'"
+ % (filename, name, frange)
+ )
+ else:
+ problem_seen = True
+ log_info("file %s: no RANGE for attribute '%s'." % (filename, name))
+
+ if not "detail" in att:
+ error_seen = True
+ log_info("file %s: no DETAIL for attribute '%s'." % (filename, name))
+ if not "description" in att:
+ error_seen = True
+ log_complaint("file %s: no DESCRIPTION for attribute '%s'." % (filename, name))
+
+ return error_seen
+
+
+def check_keys(tablename, fields, keys, ktype):
+ error_seen = False
+ """see if keys are defined"""
+ if len(keys) > 0:
+ for key in keys:
+ if "::" in key:
+ for sub_key in key.split("::"):
+ if sub_key not in fields:
+ eror_seen = True
+ log_info(
+ "%s key '%s' (%s) not found in table %s"
+ % (ktype, sub_key, key, tablename)
+ )
+ elif key not in fields:
+ error_seen = True
+ log_error("%s key '%s' not found in table %s" % (ktype, key, tablename))
+ return error_seen
+ else:
+ return True # I think it is an error if a table has no keys
+
+
+def check_table_keys(table):
+ error_seen = False
+ tablename = table.query(ds.dbTABLE_NAME)
+ fields = table.query(ds.dbTABLE_FIELDS)
+ primary_keys = table.query(ds.dbPRIMARY_KEY)
+ alternate_key = table.query(ds.dbALTERNATE_KEY)
+ foreign_keys = table.query(ds.dbFOREIGN_KEYS)
+ err = False
+ err = check_keys(tablename, fields, primary_keys, "Primary")
+ if err:
+ error_seen = True
+ err = check_keys(tablename, fields, alternate_key, "Alternate")
+ if err:
+ error_seen = True
+ err = check_keys(tablename, fields, foreign_keys, "Foreign")
+ if err:
+ error_seen = True
+ return error_seen
+
+
+def check_range(range, fieldname):
+ pass
+
+
+def check_attribute(db, field):
+ """
+ validate if:
+ NULL key present (and makes sense)
+ FORMAT defined and matches type definition
+ UNITS defined
+ and such...
+ """
+ fnull = None
+ ftype = None
+
+ error_seen = False
+ with warnings.catch_warnings():
+ warnings.simplefilter("ignore")
+ # this is needed to catch errors when looking up a nonexisting field-attribute
+ # the usual try-catch does not help here
+ tables = db.query(ds.dbSCHEMA_TABLES)
+ not_found = True
+ for table in tables:
+ dbt = db.lookup(table=table)
+ fields = dbt.query(ds.dbTABLE_FIELDS)
+ if field in fields:
+ not_found = False
+ break # we found the field in a table
+ if not_found:
+ log_complaint("attribute '%s': defined but not used in any table" % field)
+ error_seen = True
+ return
+
+ dbq = dbt.lookup(field=field, record="dbNULL")
+ flen = dbq.query(ds.dbFIELD_SIZE)
+ try:
+ fformat = dbq.query(ds.dbFIELD_FORMAT)
+ except Exception as __:
+ log_info("attribute '%s': no FORMAT" % field)
+ error_seen = True
+ funits = dbq.query(ds.dbFIELD_UNITS)
+ ftype = dbq.query(ds.dbFIELD_TYPE)
+ # fnull = dbq.query(sd.dbNULL)
+ try:
+ [fnull] = dbq.getv(field)
+ except Exception as __:
+ log_info("attribute '%s': no NULL" % field)
+ error_seen = True
+
+ if fnull == "":
+ log_complaint("attribute '%s': empty NULL value" % field)
+
+ if not funits or funits == "":
+ log_info("attribute '%s': no UNITS" % field)
+ error_seen = True
+ if fformat and fformat != "" and ftype and ftype != "":
+ pass
+ if fnull and fnull != "" and fformat and fformat != "":
+ if ftype != ds.dbDBPTR:
+ try:
+ testval = fformat % fnull
+ except Exception as __:
+ error_seen = True
+ log_complaint(
+ "attribute '%s': problem formatting NULL value '%s' or null '%s'"
+ % (field, fformat, fnull)
+ )
+ str_null = str(fnull).strip()
+ testval = testval.strip()
+ if len(str_null) > len(testval):
+ error_seen = True
+ log_complaint(
+ "attribute '%s': NULL value '%s' does not fit into field when unsing format specification '%s'"
+ % (field, fnull, fformat)
+ )
+ if testval != str_null:
+ log_info(
+ "attribute '%s': NULL value does not match formatted NULL: '%s' != %s"
+ % (field, fnull, testval)
+ )
+
+
+import getopt
+import warnings
+import re
+import copy
+
+# Import Antelope modules
+
+import antelope.datascope as ds
+import antelope.stock as stock
+import antelope.elog as elog
+
+
+def usage(progname):
+ print(progname, "[-v] [-f|-s] schema [table]")
+
+
+def main():
+ progname = sys.argv[0].split("/")[-1]
+ elog.init(progname)
+ global pedantic
+
+ tablename = None
+ verbose = False
+ schema_checks = True
+ file_checks = True
+ error_seen = False
+ opts = []
+ args = []
+ try:
+ opts, args = getopt.getopt(sys.argv[1:], "avfs", "")
+ except getopt.GetoptError:
+ usage(progname)
+ elog.die("Illegal option")
+ return 2
+
+ for o, a in opts:
+ if o == "-v":
+ verbose = True
+ elif o == "-a":
+ pedantic = True
+ elif o == "-s":
+ schema_checks = True
+ file_checks = False
+ elif o == "-f":
+ file_checks = True
+ schema_checks = False
+
+ if len(args) > 2 or len(args) < 1:
+ usage(progname)
+ sys.exit(1)
+
+ schemaname = args[0]
+
+ if len(args) > 1:
+ tablename = args[1]
+
+ # 1st check on stuff read from files
+ if file_checks:
+ err = False
+ err, check_schema_files(schemaname)
+ if err:
+ error_seen = True
+ # 2nd check on the object in memory
+ if schema_checks:
+ # trange enough, try... does not work with dbtmp
+ db = ds.dbtmp(schemaname)
+ # but fortunately it retruns dbinvalid in case of a problem
+ if db == ds.dbinvalid():
+ # elog.flush(False, -1)
+ elog.die(
+ "problem with database schema '%s'. Maybe the schema does not exist?"
+ % schemaname
+ )
+ try:
+ name = db.query(ds.dbSCHEMA_NAME)
+ except Exception as __:
+ elog.flush(False, 0)
+ elog.die("problen with database schema %s" % schemaname)
+ with ds.destroying(ds.dbtmp(schemaname)) as db:
+ if tablename:
+ try:
+ dbt = db.lookup(table=tablename)
+ except Exception as __:
+ elog.die(
+ "table %s not found in schema %s" % (tablename, schemaname)
+ )
+ err = check_table_keys(dbt)
+ if err:
+ error_seen = True
+ for fieldname in sorted(dbt.query(ds.dbTABLE_FIELDS)):
+ check_attribute(dbt, fieldname)
+ else:
+ for tablename in sorted(db.query(ds.dbSCHEMA_TABLES)):
+ dbt = db.lookup(table=tablename)
+ err = check_table_keys(dbt)
+ if err:
+ error_seen = True
+ for fieldname in sorted(db.query(ds.dbSCHEMA_FIELDS)):
+ check_attribute(db, fieldname)
+
+ if error_seen:
+ return -1
+ else:
+ log_info("not a single problem in schema '%s'" % schemaname)
+ return 0
+
+
+if __name__ == "__main__":
+ status = main()
+ sys.exit(status)
diff --git a/bin/utility/schemastuff/sortschema.csh b/bin/utility/schemastuff/sortschema.csh
new file mode 100755
index 000000000..04c601b84
--- /dev/null
+++ b/bin/utility/schemastuff/sortschema.csh
@@ -0,0 +1,29 @@
+if ( "$#" != 2 ) then
+ echo "usage $0 schemafile newschema"
+ echo " "
+ echo "little helper to sort a schema"
+ exit 1
+endif
+set schemafile=$1
+set newfile=$2
+if ( -f $ANTELOPE/contrib/data/awk/splitschema.awk ) then
+ set SPLITS=$ANTELOPE/contrib/data/awk/splitschema.awk
+else if (-f $ANTELOPE/data/awk/splitschema.awk ) then
+ set SPLITS=$ANTELOPE/data/awk/splitschema.awk
+else
+ echo "helper splitschema.awk not found!"
+ exit 1
+endif
+rm -f $newfile
+egrep "^Attribute" $schemafile | awk '{print $2}' > Attributes
+egrep "^Relation" $schemafile|awk '{print $2}' > Relations
+foreach att (`cat Attributes|sort -u`)
+ awk -f $SPLITS -v var=$att -v type=a $schemafile >> $newfile
+ echo >> $newfile
+end
+foreach rel (`cat Relations|sort -u`)
+ awk -f $SPLITS -v var=$rel -v type=r $schemafile >> $newfile
+end
+
+rm -f Attributes
+rm -f Relations
diff --git a/bin/utility/split_pf/.gitignore b/bin/utility/split_pf/.gitignore
new file mode 100644
index 000000000..f1bf1b123
--- /dev/null
+++ b/bin/utility/split_pf/.gitignore
@@ -0,0 +1,3 @@
+hosts2pf
+sort_pf
+split_pf
diff --git a/bin/utility/split_pf/Makefile b/bin/utility/split_pf/Makefile
new file mode 100644
index 000000000..006172e2d
--- /dev/null
+++ b/bin/utility/split_pf/Makefile
@@ -0,0 +1,8 @@
+BIN= split_pf sort_pf hosts2pf
+
+MAN1=hosts2pf.1 sort_pf.1 split_pf.1
+
+
+include $(ANTELOPEMAKE)
+DIRS=
+SUBDIR=/contrib
diff --git a/bin/utility/split_pf/hosts2pf.1 b/bin/utility/split_pf/hosts2pf.1
new file mode 100644
index 000000000..b0047f2a5
--- /dev/null
+++ b/bin/utility/split_pf/hosts2pf.1
@@ -0,0 +1,47 @@
+.TH HOSTS2PF 1
+.SH NAME
+hosts2pf \- read hosts file and populate stations in a parameterfile with primary and backup network addresses.
+.SH SYNOPSIS
+.nf
+\fBhosts2pf \fP\fIhostsfile\fP \fIparameterfile\fP
+.fi
+
+.SH DESCRIPTION
+This little helper prepares a list of primary and backup ip addresses per station. This list can then be used as input for the program \fIsplit_pf\fP.
+.SH OPTIONS
+.IP "hostfile"
+File with primary and backup addresses of stations in the format: network address followed by one or more names, as described in hosts.5. A suffix of -backup after a sitename indicates the backup address.
+.IP "parameterfile"
+New Antelope parameterfile.
+.SH EXAMPLE
+.in 2c
+.ft CW
+.nf
+.ne 2
+Assume a hosts file with the following entries:
+138.22.223.1 RSNA
+138.22.223.76 RSNA-backup
+
+This results in the following output:
+stations &Arr{
+ RSNA &Arr{
+ backup 138.22.223.76
+ primary 138.22.223.1
+ }
+}
+
+.fi
+.ft R
+.in
+
+.SH "BUGS AND CAVEATS"
+The output parameter file is silently overwritten.
+.SH "SEE ALSO"
+.nf
+antelope(1), rtexec(1), split_pf(1), hosts(5)
+.fi
+.SH AUTHOR
+.nf
+Nikolaus Horn, 2022
+
+ZAMG / Vienna, Nikolaus.Horn@zamg.ac.at
diff --git a/bin/utility/split_pf/hosts2pf.xpy b/bin/utility/split_pf/hosts2pf.xpy
new file mode 100644
index 000000000..1d7d79768
--- /dev/null
+++ b/bin/utility/split_pf/hosts2pf.xpy
@@ -0,0 +1,74 @@
+"""
+@author Nikolaus Horn 2 or len(args) < 2:
+ usage(progname)
+ sys.exit(1)
+
+ hostfile = args[0]
+ pfname = args[1]
+
+ pf = stock.ParameterFile()
+ stations = {}
+ lines = [line.strip() for line in open(hostfile)]
+ for line in lines:
+ if line.startswith("#"):
+ next
+ info = line.split()
+ if len(info) < 2: # need at least ip and name
+ next
+ ip = info[0]
+ name = info[1]
+ if name.endswith("-backup"):
+ sta = name.replace("-backup", "")
+ if sta not in stations:
+ stations[sta] = {}
+ stations[sta]["backup"] = ip
+ else:
+ sta = name
+ if sta not in stations:
+ stations[sta] = {}
+ stations[sta]["primary"] = ip
+ pf.update(dict(stations=stations))
+ pf.pfwrite(pfname)
+
+
+if __name__ == "__main__":
+ status = main()
+ sys.exit(status)
diff --git a/bin/utility/split_pf/sort_pf.1 b/bin/utility/split_pf/sort_pf.1
new file mode 100644
index 000000000..c479e3ad3
--- /dev/null
+++ b/bin/utility/split_pf/sort_pf.1
@@ -0,0 +1,42 @@
+.TH SORT_PF 1
+.SH NAME
+sort_pf \- sort stations in parameter file for \fBorbrtd\fP or \fBorbmonrtd_dep\fP
+.SH SYNOPSIS
+.nf
+\fBsort_pf\fP [-s \fIexpr\fP] [-r] \fIparameterfile\fP \fIdbmaster\fP
+.fi
+
+.SH DESCRIPTION
+This little helper sorts stations in the parameterfiles for orbrtd or obmonrtd_dep. The sort can be any database expression, it defaults to alphabetical sorting by station name.
+.SH OPTIONS
+.IP "-s expr"
+Datascope expression for sorting. Default is to use \fIsta\fP, i.e. alphabetical sort. Use \fIlat\fP or \fIlon\fP for geographical sorting.
+.IP "-r"
+Reverse the sorting order
+.IP "parameterfile"
+Antelope parameterfile for orbrtd or orbmonrtd.
+.IP "dbmaster"
+Antelope database. Only the site table is needed to lookup station coordinates.
+.SH EXAMPLE
+Sort stations from west to east.
+.in 2c
+.ft CW
+.nf
+.ne 2
+sort_pf -s lon orbrtd mydb > sorted.pf
+
+.fi
+.ft R
+.in
+
+.SH "BUGS AND CAVEATS"
+The output contains only the sorted part of the input parameter file. It is up to the user to construct a valid parameter file.
+.SH "SEE ALSO"
+.nf
+antelope(1), rtexec(1), orbrtd(1), orbmortd_dep(1)
+.fi
+.SH AUTHOR
+.nf
+Nikolaus Horn, 2022
+
+ZAMG / Vienna, Nikolaus.Horn@zamg.ac.at
diff --git a/bin/utility/split_pf/sort_pf.xpy b/bin/utility/split_pf/sort_pf.xpy
new file mode 100644
index 000000000..ce425dd15
--- /dev/null
+++ b/bin/utility/split_pf/sort_pf.xpy
@@ -0,0 +1,98 @@
+"""
+@author Nikolaus Horn 2 or len(args) < 2:
+ usage(progname)
+ sys.exit(1)
+
+ pfname = args[0]
+ dbname = args[1]
+
+ etime = stock.now()
+ db = ds.dbopen(dbname, "r")
+ dbsite = db.lookup(table="site")
+ dbsite = dbsite.subset("offdate == NULL || offdate > %f" % etime)
+ dbsite = dbsite.sort(sort_expression)
+ pfitems = []
+ pf = stock.pfread(pfname)
+ if pf.has_key("sources"):
+ mode = "sources"
+ nsc_list = pf["sources"]
+ elif pf.has_key("traces"):
+ mode = "traces"
+ nsc_list = pf["traces"]
+ else:
+ elog.die("input parameterfile must be either for orbrtd or orbmonrtd_dep")
+
+ for myline in nsc_list:
+ try:
+ nsc, __ = myline.split(None, 1)
+ except ValueError as ve:
+ nsc = myline
+ if not "_" in nsc:
+ continue
+ net, sta, __ = nsc.split("_", 2)
+ try:
+ order = dbsite.find("sta == '%s'" % sta, first=-1)
+ except Exception as __:
+ order = -1
+ elog.notify(
+ "station %s not found, we assume it comes very early in the sorting"
+ )
+ pfitems.append(dict(sta=sta, order=order, pfstuff=myline))
+
+ slist = sorted(pfitems, key=itemgetter("order"), reverse=reverse_sort)
+ print("%s &Tbl{" % mode) # start a sorted list
+ for myitem in slist:
+ print("\t", myitem["pfstuff"])
+ print("}") # end the sorted list
+
+
+if __name__ == "__main__":
+ status = main()
+ sys.exit(status)
diff --git a/bin/utility/split_pf/split_pf.1 b/bin/utility/split_pf/split_pf.1
new file mode 100644
index 000000000..5e6ee115c
--- /dev/null
+++ b/bin/utility/split_pf/split_pf.1
@@ -0,0 +1,52 @@
+.TH split_pf 1
+.SH NAME
+split_pf \- split datalogger entries in parameter files for a few data acquisistion programs
+.SH SYNOPSIS
+.nf
+\fBsplit_pf\fP [-f nr] [-s expr] [-b pf] \fIparameterfile\fP \fIdbmaster\fP
+.fi
+
+.SH DESCRIPTION
+This little helper splits datalogger entries in the parameterfiles for \fIorb2orb\fP, \fIq3302orb\fP, \fIslink2orb\fP and \fIrtexec\fP.
+This helps to split data acquisition across different computers to increase redundancy and stability.
+Optionally, a second parameterfile can be produced for sites that can be reached via an alternative ip-address.
+.SH OPTIONS
+.IP "-f nr"
+Split the datalogger entries into chuncks of length \fBnr\fP. the defaults to split into two pieces.
+.IP "-s expr"
+Datascope expression to sort the datalogger entries. The sorting follows the order of entries in the site table. The default ist is to sort by name, but geographical might also be interesting.
+.IP "-b pf"
+Try to find an alternate ip-address for each connection to a datalogger and, if found, list the connection then in a second parameter file.
+The paramterfile must contain a list of sites, for each of these sites at least a primary connection and optionally a backup connection.
+The program \fBhosts2pf\fP can be used to construct such a file from a hosts table.
+.in 2c
+.ft CW
+.nf
+Here the entry for a typical station:
+stations &Arr{
+ ADSA &Arr{
+ backup 138.22.223.71
+ primary 138.22.223.15
+ }
+ ...
+}
+.fi
+.ft R
+.in
+.IP "parameterfile"
+Antelope parameterfile for q3302orb, orb2orb, slink2orb or rtexec. This script identifies the program by values in the parameter file required by the respective program.
+.IP "dbmaster"
+Database with at least a site-table. This is needed to sort the stations by geographical location.
+
+.SH "BUGS AND CAVEATS"
+The output parameter files are silently overwritten.
+.SH "SEE ALSO"
+.nf
+antelope(1), rtexec(1), q3302orb(1), orb2orb(1), slink2orb(1), hosts2pf(1) and sort_pf(1).
+.fi
+.SH AUTHOR
+.nf
+Nikolaus Horn, 2022
+
+ZAMG / Vienna, Nikolaus.Horn@zamg.ac.at
+
diff --git a/bin/utility/split_pf/split_pf.xpy b/bin/utility/split_pf/split_pf.xpy
new file mode 100644
index 000000000..af0414da0
--- /dev/null
+++ b/bin/utility/split_pf/split_pf.xpy
@@ -0,0 +1,233 @@
+"""
+@author Nikolaus Horn 2 or len(args) < 2:
+ usage(progname)
+ sys.exit(1)
+
+ pfname = args[0]
+ dbname = args[1]
+
+ etime = stock.now()
+ db = ds.dbopen(dbname, "r")
+ dbsite = db.lookup(table="site")
+ dbsite = dbsite.subset("offdate == NULL || offdate > %f" % etime)
+ dbsite = dbsite.sort(sort_expression)
+ stalist = []
+ pfitems = []
+ # pf = stock.pfin(pfname)
+ if show_backups:
+ bpf = stock.pfread(connections_pfname)
+ stations_array = bpf["stations"]
+ pf = stock.pfread(pfname)
+ if pf.has_key("connections"):
+ mode = "orb2orb"
+ connections = pf["connections"]
+ for connection in connections:
+ if "name" in connection:
+ sta = connection["name"]
+ try:
+ order = dbsite.find("sta == '%s'" % sta, first=-1)
+ except Exception as __:
+ order = -1
+ pfitems.append(dict(sta=sta, order=order, pfstuff=connection))
+ else:
+ print("no name found")
+ print(connection)
+
+ elif pf.has_key("dataloggers"):
+ mode = "q3302orb"
+ dls = pf["dataloggers"]
+ for dl in dls:
+ dlname, net, sta, __ = dl.split(None, 3)
+ try:
+ order = dbsite.find("sta == '%s'" % sta, first=-1)
+ except Exception as __:
+ order = -1
+ pfitems.append(dict(sta=sta, order=order, pfstuff=dl))
+
+ elif pf.has_key("stations"):
+ mode = "slink2orb"
+ stalist = pf["stations"]
+ for netsta in stalist.keys():
+ net, sta = netsta.split("_", 1)
+ try:
+ order = dbsite.find("sta == '%s'" % sta, first=-1)
+ except Exception as __:
+ order = -1
+ line = "%s %s" % (netsta, stalist[netsta])
+ pfitems.append(
+ dict(
+ sta=sta,
+ order=order,
+ pfstuff=line,
+ netsta=netsta,
+ selectors=stalist[netsta],
+ )
+ )
+
+ elif pf.has_key("Processes"):
+ mode = "rtexec"
+ jobs = pf["Processes"]
+ for job in jobs:
+ name, cmdline = job.split(None, 1)
+ if name.startswith("slink2orb"):
+ sta = name.replace("slink2orb", "")
+ try:
+ order = dbsite.find("sta == '%s'" % sta, first=-1)
+ except Exception as __:
+ order = -1
+ pfitems.append(dict(sta=sta, order=order, pfstuff=job))
+
+ slist = sorted(pfitems, key=itemgetter("order"))
+ # slist = sorted(pfitems, key=itemgetter('order'), reverse=True)
+
+ for i in range(fraction):
+ pfarr = []
+ pfdict = {}
+ pfarr_backup = []
+ pfdict_backup = {}
+ start = i
+ index = 0
+ for pf in slist:
+ if ((start + index) % fraction) == 0:
+ txt = pf["pfstuff"]
+ if mode == "rtexec" or mode == "q3302orb":
+ pfarr.append(txt)
+ elif mode == "slink2orb":
+ netsta = pf["netsta"]
+ selectors = pf["selectors"]
+ pfdict[netsta] = selectors
+ elif mode == "orb2orb":
+ pfarr.append(pf["pfstuff"])
+ if show_backups:
+ sta = pf["sta"]
+ if sta in stations_array:
+ sta_cons = stations_array[sta]
+ if "backup" in sta_cons:
+ ip = sta_cons["primary"]
+ ip2 = sta_cons["backup"]
+ if mode != "orb2orb":
+ ntxt = txt.replace(ip, ip2)
+ ntxt = ntxt.replace(sta, sta + alternate_suffix, 1)
+ if mode == "rtexec" or mode == "q3302orb":
+ pfarr_backup.append(ntxt)
+ elif mode == "orb2orb":
+ tmpdict = pf["pfstuff"]
+ newdict = {}
+ for key in tmpdict.keys():
+ val = tmpdict[key]
+ newval = val.replace(ip, ip2)
+ newval = newval.replace(
+ sta, sta + alternate_suffix, 1
+ )
+ newdict[key] = newval
+ pfarr_backup.append(newdict)
+
+ index += 1
+ if mode == "rtexec":
+ newpf = stock.ParameterFile()
+ newpf.update(dict(Processes=pfarr))
+ pfname = "rtexec-%d.pf" % (i + 1)
+ newpf.pfwrite(pfname)
+ if verbose:
+ print("wrote %s to new parameter file %s" % ("Processes", pfname))
+ if show_backups:
+ newpf = stock.ParameterFile()
+ newpf.update(dict(Processes=pfarr_backup))
+ pfname = "rtexec-%d-backup.pf" % (i + 1)
+ newpf.pfwrite(pfname)
+ if verbose:
+ print("wrote %s to new parameter file %s" % ("Processes", pfname))
+ elif mode == "q3302orb":
+ newpf = stock.ParameterFile()
+ newpf.update(dict(dataloggers=pfarr))
+ pfname = "q3302orb-%d.pf" % (i + 1)
+ newpf.pfwrite(pfname)
+ if verbose:
+ print("wrote %s to new parameter file %s" % ("dataloggers", pfname))
+ if show_backups:
+ newpf = stock.ParameterFile()
+ newpf.update(dict(dataloggers=pfarr_backup))
+ pfname = "q3302orb-%d-backup.pf" % (i + 1)
+ newpf.pfwrite(pfname)
+ if verbose:
+ print("wrote %s to new parameter file %s" % ("dataloggers", pfname))
+ elif mode == "slink2orb":
+ newpf = stock.ParameterFile()
+ newpf.update(dict(stations=pfdict))
+ pfname = "slink2orb-%d.pf" % (i + 1)
+ newpf.pfwrite(pfname)
+ if verbose:
+ print("wrote %s to new parameter file %s" % ("stations", pfname))
+ elif mode == "orb2orb":
+ newpf = stock.ParameterFile()
+ newpf.update(dict(connections=pfarr))
+ pfname = "orb2orb-%d.pf" % (i + 1)
+ newpf.pfwrite(pfname)
+ if verbose:
+ print("wrote %s to new parameter file %s" % ("connections", pfname))
+ if show_backups:
+ newpf = stock.ParameterFile()
+ newpf.update(dict(connections=pfarr_backup))
+ pfname = "orb2orb-%d-backup.pf" % (i + 1)
+ newpf.pfwrite(pfname)
+ if verbose:
+ print("wrote %s to new parameter file %s" % ("connections", pfname))
+
+
+if __name__ == "__main__":
+ status = main()
+ sys.exit(status)
diff --git a/bin/utility/ttgrid_info/.gitignore b/bin/utility/ttgrid_info/.gitignore
new file mode 100644
index 000000000..5c02d4b26
--- /dev/null
+++ b/bin/utility/ttgrid_info/.gitignore
@@ -0,0 +1 @@
+ttgrid_info
diff --git a/bin/utility/ttgrid_info/Makefile b/bin/utility/ttgrid_info/Makefile
new file mode 100644
index 000000000..31853be0f
--- /dev/null
+++ b/bin/utility/ttgrid_info/Makefile
@@ -0,0 +1,5 @@
+BIN=ttgrid_info
+MAN1=ttgrid_info.1
+include $(ANTELOPEMAKE)
+DIRS=
+SUBDIR=/contrib
diff --git a/bin/utility/ttgrid_info/ttgrid_info.1 b/bin/utility/ttgrid_info/ttgrid_info.1
new file mode 100644
index 000000000..a402cf430
--- /dev/null
+++ b/bin/utility/ttgrid_info/ttgrid_info.1
@@ -0,0 +1,38 @@
+.TH TTGRID_INFO 1
+.SH NAME
+ttgrid_info \- textual info for ttgrid traveltime files
+.SH SYNOPSIS
+.nf
+ttgrid_info [-v] [-g] [-N] gridfile [gridname]
+.fi
+
+.SH DESCRIPTION
+The utility ttgrid_show has disappeared. This helper is a poor man's replacement.
+.SH OPTIONS
+.IP "-v"
+verbose flag
+.IP "-g"
+Show gridpoints. Default is to show stations only.
+.IP "-N"
+Don't show stations. Default is to show stations.
+.IP "gridfile"
+Name of file with ttgrid traveltime file. This argument is required.
+.IP "gridname"
+Name of grid. If this is not specified, the names of all grids in the \fIgridfile\fP specified before are listed.
+
+.SH EXAMPLE
+.nf
+ttgrid_info myworldgrid tele_uni
+.fi
+
+.SH "BUGS AND CAVEATS"
+None.
+.SH "SEE ALSO"
+.nf
+ttgrid(1), displayttgrid(1)
+.fi
+.SH AUTHOR
+.nf
+Nikolaus Horn, 2020
+
+ZAMG / Vienna, Nikolaus.Horn@zamg.ac.at
diff --git a/bin/utility/ttgrid_info/ttgrid_info.xpy b/bin/utility/ttgrid_info/ttgrid_info.xpy
new file mode 100755
index 000000000..ad56dac67
--- /dev/null
+++ b/bin/utility/ttgrid_info/ttgrid_info.xpy
@@ -0,0 +1,78 @@
+
+import getopt
+from antelope.buvector import *
+from antelope import _ttgrid
+
+
+def usage(progname):
+ print("usage: %s [-g] [-N] filename [gridname]" % progname)
+
+progname = sys.argv[0].split("/")[-1]
+pfname = progname
+
+showstations = True
+showgridpoints=False
+
+verbose = 0
+opts = []
+args = []
+try:
+ opts, args = getopt.getopt(sys.argv[1:], "vNg", "")
+except getopt.GetoptError:
+ print("illegal option")
+ usage(progname)
+ sys.exit(2)
+
+for o, a in opts:
+ if o == "-v":
+ verbose = 1
+ elif o == "-N":
+ showstations = False
+ elif o == "-g":
+ showgridpoints = True
+
+if len(args) > 2 or len(args) < 1:
+ usage(progname)
+ sys.exit(1)
+
+filename = args[0]
+ttgrids = _ttgrid._ttgrid_mapfile(filename)
+if ttgrids is None:
+ print("displayttgrid: ttgrid_mapfile error")
+ sys.exit(1)
+
+if len(args) > 1:
+ gridname = args[1]
+else:
+ print(' '.join(ttgrids))
+ sys.exit(0)
+
+found= False
+for grid in ttgrids:
+ if gridname == grid:
+ found = True
+ break
+
+if not found:
+ print("displayttgrid: Cannot find grid %s in %s" % (gridname, filename))
+ sys.exit(1)
+
+if showstations:
+ stations = _ttgrid._ttgrid_get(gridname, 'stations')
+ if stations is None:
+ print("displayttgrid: ttgrid_get (%s,'stations') error" % gridname)
+ sys.exit(1)
+
+ (rc, npts, ny, x, y, label) = buvector_get_points (stations, -1, True)
+ for i in range(npts):
+ print("%s %.2f %.2f" % (label[i], x[i], y[0][i]))
+
+if showgridpoints:
+ gridpoints = _ttgrid._ttgrid_get(gridname, 'sources')
+ if gridpoints is None:
+ print("displayttgrid: ttgrid_get (%s,'sources') error" % gridname)
+ sys.exit(1)
+
+ (rc, npts, ny, x, y ) = buvector_get_points (gridpoints, -1, False)
+ for i in range(npts):
+ print("%.2f %.2f" % (x[i], y[0][i]))
diff --git a/data/icons/ANZA-logo-small.png b/data/icons/ANZA-logo-small.png
new file mode 100644
index 000000000..6ede28ac7
Binary files /dev/null and b/data/icons/ANZA-logo-small.png differ
diff --git a/data/icons/Makefile b/data/icons/Makefile
new file mode 100644
index 000000000..e7fe009d0
--- /dev/null
+++ b/data/icons/Makefile
@@ -0,0 +1,19 @@
+
+DATADIR=icons
+
+
+DATA= ANZA-logo-small.png \
+ google_map_anza_icon.png \
+ green_star_nooutline.png \
+ orange_star_nooutline.png \
+ purple_star_nooutline.png \
+ red_star_nooutline.png \
+ red_triangle.png \
+ vsm_red_circle.png \
+ wht_triangle.png \
+ yel_triangle.png \
+ yellow_star_nooutline.png
+
+SUBDIR=/contrib
+include $(ANTELOPEMAKE)
+
diff --git a/data/icons/google_map_anza_icon.png b/data/icons/google_map_anza_icon.png
new file mode 100644
index 000000000..d07823472
Binary files /dev/null and b/data/icons/google_map_anza_icon.png differ
diff --git a/data/icons/green_star_nooutline.png b/data/icons/green_star_nooutline.png
new file mode 100644
index 000000000..6aa701a84
Binary files /dev/null and b/data/icons/green_star_nooutline.png differ
diff --git a/data/icons/orange_star_nooutline.png b/data/icons/orange_star_nooutline.png
new file mode 100644
index 000000000..b8e4dde70
Binary files /dev/null and b/data/icons/orange_star_nooutline.png differ
diff --git a/data/icons/purple_star_nooutline.png b/data/icons/purple_star_nooutline.png
new file mode 100644
index 000000000..63760505b
Binary files /dev/null and b/data/icons/purple_star_nooutline.png differ
diff --git a/data/icons/red_star_nooutline.png b/data/icons/red_star_nooutline.png
new file mode 100644
index 000000000..5474be4c3
Binary files /dev/null and b/data/icons/red_star_nooutline.png differ
diff --git a/data/icons/red_triangle.png b/data/icons/red_triangle.png
new file mode 100644
index 000000000..bfde78799
Binary files /dev/null and b/data/icons/red_triangle.png differ
diff --git a/data/icons/vsm_red_circle.png b/data/icons/vsm_red_circle.png
new file mode 100644
index 000000000..59e467943
Binary files /dev/null and b/data/icons/vsm_red_circle.png differ
diff --git a/data/icons/wht_triangle.png b/data/icons/wht_triangle.png
new file mode 100644
index 000000000..2710ce499
Binary files /dev/null and b/data/icons/wht_triangle.png differ
diff --git a/data/icons/yel_triangle.png b/data/icons/yel_triangle.png
new file mode 100644
index 000000000..6d82a96ab
Binary files /dev/null and b/data/icons/yel_triangle.png differ
diff --git a/data/icons/yellow_star_nooutline.png b/data/icons/yellow_star_nooutline.png
new file mode 100644
index 000000000..a504beac6
Binary files /dev/null and b/data/icons/yellow_star_nooutline.png differ
diff --git a/data/instruments/dataloggers/kmi/etna2_acausal.pf b/data/instruments/dataloggers/kmi/etna2_acausal.pf
index 0e3c4f430..3a36a0052 100644
--- a/data/instruments/dataloggers/kmi/etna2_acausal.pf
+++ b/data/instruments/dataloggers/kmi/etna2_acausal.pf
@@ -2,13 +2,14 @@ category Kinemetrics
configuration Etna-2 Acausal Filter 5Vpp Input
originator Mathias Franke
-last_modified December 16, 2016
+last_modified April 07, 2023
description KMI Etna-2 Acausal
dfile etna2_ac
info &Literal{
These are the decimation FIR filters with a final acausal brickwall filter.
-The information was derived from Kinemetrics Document 300905 Revision X5
+The information was derived from Kinemetrics Document 300905 Revision X5.
+State-Of-Health channels are included.
}
@@ -65,3 +66,98 @@ decifac 2
response &datafile(responses/coefB2-80)
}
+soh LCE LCQ LEC LEP LKI CPU
+
+LCE &Arr{
+stages phase
+iunits s
+ounits counts
+samprate 1
+rsptype T
+}
+
+LCQ &Arr{
+stages clk_qual
+iunits percent
+ounits counts
+samprate 1
+rsptype p
+}
+
+LEC &Arr{
+stages mamp
+iunits A
+ounits counts
+samprate 1
+rsptype i
+}
+
+LEP &Arr{
+stages mvolt
+iunits V
+ounits counts
+samprate 1
+rsptype v
+}
+
+LKI &Arr{
+stages temp
+iunits Celsius
+ounits counts
+samprate 1
+rsptype t
+}
+
+CPU &Arr{
+stages load
+iunits counts
+ounits counts
+samprate 1
+rsptype c
+}
+
+phase &Arr{
+gtype clock phase
+gnom 1000000
+iunits s
+ounits counts
+sn datalogger
+}
+
+clk_qual &Arr{
+gtype clock quality
+iunits percent
+ounits counts
+sn datalogger
+}
+
+mamp &Arr{
+gtype current meter
+gnom 1000
+iunits A
+ounits counts
+sn datalogger
+}
+
+mvolt &Arr{
+gtype volt meter
+gnom 1000
+iunits V
+ounits counts
+sn datalogger
+}
+
+temp &Arr{
+gtype thermometer
+gnom 10
+iunits Celsius
+ounits counts
+sn datalogger
+}
+
+load &Arr{
+gtype cpu load
+iunits counts
+ounits counts
+sn datalogger
+}
diff --git a/data/instruments/dataloggers/kmi/etna2_causal.pf b/data/instruments/dataloggers/kmi/etna2_causal.pf
index 67b66cf9d..1381c430f 100644
--- a/data/instruments/dataloggers/kmi/etna2_causal.pf
+++ b/data/instruments/dataloggers/kmi/etna2_causal.pf
@@ -2,13 +2,14 @@ category Kinemetrics
configuration Etna-2 Causal Filter 5Vpp Input
originator Mathias Franke
-last_modified December 16, 2016
+last_modified April 07, 2023
description KMI Etna-2 Causal
dfile etna2_c
info &Literal{
These are the decimation FIR filters with a final causal brickwall filter.
-The information was derived from Kinemetrics Document 300905 Revision X5
+The information was derived from Kinemetrics Document 300905 Revision X5.
+State-Of-Health channels are included.
}
@@ -65,3 +66,98 @@ decifac 2
response &datafile(responses/coefB2C-80)
}
+soh LCE LCQ LEC LEP LKI CPU
+
+LCE &Arr{
+stages phase
+iunits s
+ounits counts
+samprate 1
+rsptype T
+}
+
+LCQ &Arr{
+stages clk_qual
+iunits percent
+ounits counts
+samprate 1
+rsptype p
+}
+
+LEC &Arr{
+stages mamp
+iunits A
+ounits counts
+samprate 1
+rsptype i
+}
+
+LEP &Arr{
+stages mvolt
+iunits V
+ounits counts
+samprate 1
+rsptype v
+}
+
+LKI &Arr{
+stages temp
+iunits Celsius
+ounits counts
+samprate 1
+rsptype t
+}
+
+CPU &Arr{
+stages load
+iunits counts
+ounits counts
+samprate 1
+rsptype c
+}
+
+phase &Arr{
+gtype clock phase
+gnom 1000000
+iunits s
+ounits counts
+sn datalogger
+}
+
+clk_qual &Arr{
+gtype clock quality
+iunits percent
+ounits counts
+sn datalogger
+}
+
+mamp &Arr{
+gtype current meter
+gnom 1000
+iunits A
+ounits counts
+sn datalogger
+}
+
+mvolt &Arr{
+gtype volt meter
+gnom 1000
+iunits V
+ounits counts
+sn datalogger
+}
+
+temp &Arr{
+gtype thermometer
+gnom 10
+iunits Celsius
+ounits counts
+sn datalogger
+}
+
+load &Arr{
+gtype cpu load
+iunits counts
+ounits counts
+sn datalogger
+}
diff --git a/data/instruments/dataloggers/kmi/obsidian_acausal_10.pf b/data/instruments/dataloggers/kmi/obsidian_acausal_10.pf
index b04f61945..5a819fbcb 100644
--- a/data/instruments/dataloggers/kmi/obsidian_acausal_10.pf
+++ b/data/instruments/dataloggers/kmi/obsidian_acausal_10.pf
@@ -2,21 +2,23 @@ category Kinemetrics
configuration Obsidian Non-Causal Filter 10Vpp Input
originator Mathias Franke
-last_modified August 23, 2018
+last_modified April 07, 2023
description KMI Obsidian Acausal w 10Vpp Input
dfile obsidian_ac_10pp
info &Literal{
This are the decimation FIR filters with a final non-causal brickwall filter.
This is the configuration for an Obsidian recorder set to 10Vpp input.
-The information was derived from Kinemetrics Application Note 39F
+The information was derived from Kinemetrics Application Note 39F.
+State-Of-Health channels are included.
}
-streams 5000sps 2000sps 1000sps 500sps 250sps 200sps 100sps 50sps 20sps 10sps 1sps
+streams 2000sps 1000sps 500sps 250sps 200sps 100sps 50sps 20sps 10sps 1sps
+##streams 5000sps 2000sps 1000sps 500sps 250sps 200sps 100sps 50sps 20sps 10sps 1sps
# definitions of streams
-5000sps 5000 a/d coefA3_60 coefB2_60
+##5000sps 5000 a/d coefA3_60 coefB2_60
2000sps 2000 a/d coefA5_50_s5c coefB3_80
1000sps 1000 a/d coefA5_50_s5c coefA3_50 coefB2_80_140
500sps 500 a/d coefA5_50_s5c coefA3_50 coefA2_20 coefB2_80
@@ -104,3 +106,99 @@ decifac 2
response &datafile(responses/coefB2-60)
samplerate 5000
}
+
+soh LCE LCQ LEC LEP LKI CPU
+
+LCE &Arr{
+stages phase
+iunits s
+ounits counts
+samprate 1
+rsptype T
+}
+
+LCQ &Arr{
+stages clk_qual
+iunits percent
+ounits counts
+samprate 1
+rsptype p
+}
+
+LEC &Arr{
+stages mamp
+iunits A
+ounits counts
+samprate 1
+rsptype i
+}
+
+LEP &Arr{
+stages mvolt
+iunits V
+ounits counts
+samprate 1
+rsptype v
+}
+
+LKI &Arr{
+stages temp
+iunits Celsius
+ounits counts
+samprate 1
+rsptype t
+}
+
+CPU &Arr{
+stages load
+iunits counts
+ounits counts
+samprate 1
+rsptype c
+}
+
+phase &Arr{
+gtype clock phase
+gnom 1000000
+iunits s
+ounits counts
+sn datalogger
+}
+
+clk_qual &Arr{
+gtype clock quality
+iunits percent
+ounits counts
+sn datalogger
+}
+
+mamp &Arr{
+gtype current meter
+gnom 1000
+iunits A
+ounits counts
+sn datalogger
+}
+
+mvolt &Arr{
+gtype volt meter
+gnom 1000
+iunits V
+ounits counts
+sn datalogger
+}
+
+temp &Arr{
+gtype thermometer
+gnom 10
+iunits Celsius
+ounits counts
+sn datalogger
+}
+
+load &Arr{
+gtype cpu load
+iunits counts
+ounits counts
+sn datalogger
+}
diff --git a/data/instruments/dataloggers/kmi/obsidian_acausal_40.pf b/data/instruments/dataloggers/kmi/obsidian_acausal_40.pf
index a23701e0d..e0312200b 100644
--- a/data/instruments/dataloggers/kmi/obsidian_acausal_40.pf
+++ b/data/instruments/dataloggers/kmi/obsidian_acausal_40.pf
@@ -2,25 +2,27 @@ category Kinemetrics
configuration Obsidian Non-Causal Filter 40Vpp Input
originator Mathias Franke
-last_modified August 23, 2018
+last_modified April 07, 2023
description KMI Obsidian Acausal w 40Vpp Input
dfile obsidian_ac_40pp
info &Literal{
This are the decimation FIR filters with a final non-causal brickwall filter.
This is the configuration for an Obsidian recorder set to 40Vpp input.
-The information was derived from Kinemetrics Application Note 39F
+The information was derived from Kinemetrics Application Note 39F.
+State-Of-Health channels are included.
}
-streams 5000sps 2000sps 1000sps 500sps 250sps 200sps 100sps 50sps 20sps 10sps 1sps
+streams 2000sps 1000sps 500sps 250sps 200sps 100sps 50sps 20sps 10sps 1sps
+##streams 5000sps 2000sps 1000sps 500sps 250sps 200sps 100sps 50sps 20sps 10sps 1sps
# definitions of streams
-5000sps 5000 a/d coefA3_60 coefB2_60
+##5000sps 5000 a/d coefA3_60 coefB2_60
2000sps 2000 a/d coefA5_50_s5c coefB3_80
1000sps 1000 a/d coefA5_50_s5c coefA3_50 coefB2_80_140
500sps 500 a/d coefA5_50_s5c coefA3_50 coefA2_20 coefB2_80
-250sps 250 a/d coefA5_50_s5c coefA3_50 coefA2_20 coefA2_20 coefB2_80
+250sps 250 a/d coefA5_50_s5c coefA3_50 coefA2_20 coefA2_20 coefB2_80
200sps 200 a/d coefA5_50_s5c coefA3_50 coefA5_50 coefB2_80
100sps 100 a/d coefA5_50_s5c coefA3_50 coefA2_20 coefA5_50 coefB2_80
50sps 50 a/d coefA5_50_s5c coefA3_50 coefA4_50 coefA5_50 coefB2_80
@@ -105,3 +107,98 @@ response &datafile(responses/coefB2-60)
samplerate 5000
}
+soh LCE LCQ LEC LEP LKI CPU
+
+LCE &Arr{
+stages phase
+iunits s
+ounits counts
+samprate 1
+rsptype T
+}
+
+LCQ &Arr{
+stages clk_qual
+iunits percent
+ounits counts
+samprate 1
+rsptype p
+}
+
+LEC &Arr{
+stages mamp
+iunits A
+ounits counts
+samprate 1
+rsptype i
+}
+
+LEP &Arr{
+stages mvolt
+iunits V
+ounits counts
+samprate 1
+rsptype v
+}
+
+LKI &Arr{
+stages temp
+iunits Celsius
+ounits counts
+samprate 1
+rsptype t
+}
+
+CPU &Arr{
+stages load
+iunits counts
+ounits counts
+samprate 1
+rsptype c
+}
+
+phase &Arr{
+gtype clock phase
+gnom 1000000
+iunits s
+ounits counts
+sn datalogger
+}
+
+clk_qual &Arr{
+gtype clock quality
+iunits percent
+ounits counts
+sn datalogger
+}
+
+mamp &Arr{
+gtype current meter
+gnom 1000
+iunits A
+ounits counts
+sn datalogger
+}
+
+mvolt &Arr{
+gtype volt meter
+gnom 1000
+iunits V
+ounits counts
+sn datalogger
+}
+
+temp &Arr{
+gtype thermometer
+gnom 10
+iunits Celsius
+ounits counts
+sn datalogger
+}
+
+load &Arr{
+gtype cpu load
+iunits counts
+ounits counts
+sn datalogger
+}
diff --git a/data/instruments/dataloggers/kmi/obsidian_acausal_5.pf b/data/instruments/dataloggers/kmi/obsidian_acausal_5.pf
index 0f6e202c4..c0e832a03 100644
--- a/data/instruments/dataloggers/kmi/obsidian_acausal_5.pf
+++ b/data/instruments/dataloggers/kmi/obsidian_acausal_5.pf
@@ -2,26 +2,26 @@ category Kinemetrics
configuration Obsidian Non-Causal Filter 5Vpp Input
originator Mathias Franke
-last_modified August 23, 2018
+last_modified April 07, 2023
description KMI Obsidian Acausal w 5Vpp Input
dfile obsidian_ac_5pp
info &Literal{
This are the decimation FIR filters with a final non-causal brickwall filter.
This is the configuration for an Obsidian recorder set to 5Vpp input.
-The information was derived from Kinemetrics Application Note 39F
+The information was derived from Kinemetrics Application Note 39F.
+State-Of-Health channels are included.
}
-streams 2000sps 1000sps 500sps 250sps 200sps 100sps 50sps 20sps 10sps 1sps
-#streams 2000sps 1000sps 500sps 250sps 200sps 100sps 50sps 20sps 10sps 1sps
+streams 5000sps 2000sps 1000sps 500sps 250sps 200sps 100sps 50sps 20sps 10sps 1sps
# definitions of streams
-#5000sps 5000 a/d coefA3_60 coefB2_60
+5000sps 5000 a/d coefA3_60 coefB2_60
2000sps 2000 a/d coefA5_50_s5c coefB3_80
1000sps 1000 a/d coefA5_50_s5c coefA3_50 coefB2_80_140
500sps 500 a/d coefA5_50_s5c coefA3_50 coefA2_20 coefB2_80
-250sps 250 a/d coefA5_50_s5c coefA3_50 coefA2_20 coefA2_20 coefB2_80
+250sps 250 a/d coefA5_50_s5c coefA3_50 coefA2_20 coefA2_20 coefB2_80
200sps 200 a/d coefA5_50_s5c coefA3_50 coefA5_50 coefB2_80
100sps 100 a/d coefA5_50_s5c coefA3_50 coefA2_20 coefA5_50 coefB2_80
50sps 50 a/d coefA5_50_s5c coefA3_50 coefA4_50 coefA5_50 coefB2_80
@@ -105,3 +105,99 @@ decifac 2
response &datafile(responses/coefB2-60)
samplerate 5000
}
+
+soh LCE LCQ LEC LEP LKI CPU
+
+LCE &Arr{
+stages phase
+iunits s
+ounits counts
+samprate 1
+rsptype T
+}
+
+LCQ &Arr{
+stages clk_qual
+iunits percent
+ounits counts
+samprate 1
+rsptype p
+}
+
+LEC &Arr{
+stages mamp
+iunits A
+ounits counts
+samprate 1
+rsptype i
+}
+
+LEP &Arr{
+stages mvolt
+iunits V
+ounits counts
+samprate 1
+rsptype v
+}
+
+LKI &Arr{
+stages temp
+iunits Celsius
+ounits counts
+samprate 1
+rsptype t
+}
+
+CPU &Arr{
+stages load
+iunits counts
+ounits counts
+samprate 1
+rsptype c
+}
+
+phase &Arr{
+gtype clock phase
+gnom 1000000
+iunits s
+ounits counts
+sn datalogger
+}
+
+clk_qual &Arr{
+gtype clock quality
+iunits percent
+ounits counts
+sn datalogger
+}
+
+mamp &Arr{
+gtype current meter
+gnom 1000
+iunits A
+ounits counts
+sn datalogger
+}
+
+mvolt &Arr{
+gtype volt meter
+gnom 1000
+iunits V
+ounits counts
+sn datalogger
+}
+
+temp &Arr{
+gtype thermometer
+gnom 10
+iunits Celsius
+ounits counts
+sn datalogger
+}
+
+load &Arr{
+gtype cpu load
+iunits counts
+ounits counts
+sn datalogger
+}
diff --git a/data/instruments/dataloggers/kmi/obsidian_causal_10.pf b/data/instruments/dataloggers/kmi/obsidian_causal_10.pf
index d91fe5299..c6858520a 100644
--- a/data/instruments/dataloggers/kmi/obsidian_causal_10.pf
+++ b/data/instruments/dataloggers/kmi/obsidian_causal_10.pf
@@ -2,21 +2,23 @@ category Kinemetrics
configuration Obsidian Causal Filter 10Vpp Input
originator Mathias Franke
-last_modified August 23, 2018
+last_modified April 07, 2023
description KMI Obsidian Causal w 10Vpp Input
dfile obsidian_c_10pp
info &Literal{
This are the decimation FIR filters with a final causal brickwall filter.
This is the configuration for an Obsidian recorder set to 10Vpp input.
-The information was derived from Kinemetrics Application Note 39F
+The information was derived from Kinemetrics Application Note 39F.
+State-Of-Health channels are included.
}
-streams 5000sps 2000sps 1000sps 250sps 500sps 200sps 100sps 50sps 20sps 10sps 1sps
+streams 5000sps 2000sps 1000sps 500sps 250sps 200sps 100sps 50sps 20sps 10sps 1sps
+##streams 5000sps 2000sps 1000sps 500sps 250sps 200sps 100sps 50sps 20sps 10sps 1sps
# definitions of streams
-5000sps 5000 a/d coefA3_60 coefB2C_60
+##5000sps 5000 a/d coefA3_60 coefB2C_60
2000sps 2000 a/d coefA5_50_s5c coefB3C_80
1000sps 1000 a/d coefA5_50_s5c coefA3_50 coefB2C_80_140
500sps 500 a/d coefA5_50_s5c coefA3_50 coefA2_20 coefB2C_80
@@ -104,3 +106,99 @@ decifac 2
response &datafile(responses/coefB2C-60)
samplerate 5000
}
+
+soh LCE LCQ LEC LEP LKI CPU
+
+LCE &Arr{
+stages phase
+iunits s
+ounits counts
+samprate 1
+rsptype T
+}
+
+LCQ &Arr{
+stages clk_qual
+iunits percent
+ounits counts
+samprate 1
+rsptype p
+}
+
+LEC &Arr{
+stages mamp
+iunits A
+ounits counts
+samprate 1
+rsptype i
+}
+
+LEP &Arr{
+stages mvolt
+iunits V
+ounits counts
+samprate 1
+rsptype v
+}
+
+LKI &Arr{
+stages temp
+iunits Celsius
+ounits counts
+samprate 1
+rsptype t
+}
+
+CPU &Arr{
+stages load
+iunits counts
+ounits counts
+samprate 1
+rsptype c
+}
+
+phase &Arr{
+gtype clock phase
+gnom 1000000
+iunits s
+ounits counts
+sn datalogger
+}
+
+clk_qual &Arr{
+gtype clock quality
+iunits percent
+ounits counts
+sn datalogger
+}
+
+mamp &Arr{
+gtype current meter
+gnom 1000
+iunits A
+ounits counts
+sn datalogger
+}
+
+mvolt &Arr{
+gtype volt meter
+gnom 1000
+iunits V
+ounits counts
+sn datalogger
+}
+
+temp &Arr{
+gtype thermometer
+gnom 10
+iunits Celsius
+ounits counts
+sn datalogger
+}
+
+load &Arr{
+gtype cpu load
+iunits counts
+ounits counts
+sn datalogger
+}
diff --git a/data/instruments/dataloggers/kmi/obsidian_causal_40.pf b/data/instruments/dataloggers/kmi/obsidian_causal_40.pf
index 86b480f02..bcd95cf51 100644
--- a/data/instruments/dataloggers/kmi/obsidian_causal_40.pf
+++ b/data/instruments/dataloggers/kmi/obsidian_causal_40.pf
@@ -2,25 +2,27 @@ category Kinemetrics
configuration Obsidian Causal Filter 40Vpp Input
originator Mathias Franke
-last_modified August 23, 2018
+last_modified April 07, 2023
description KMI Obsidian Causal w 40Vpp Input
dfile obsidian_c_40pp
info &Literal{
This are the decimation FIR filters with a final causal brickwall filter.
This is the configuration for an Obsidian recorder set to 40Vpp input.
-The information was derived from Kinemetrics Application Note 39F
+The information was derived from Kinemetrics Application Note 39F.
+State-Of-Health channels are included.
}
-streams 5000sps 2000sps 1000sps 500sps 250sps 200sps 100sps 50sps 20sps 10sps 1sps
+streams 2000sps 1000sps 500sps 250sps 200sps 100sps 50sps 20sps 10sps 1sps
+##streams 5000sps 2000sps 1000sps 500sps 250sps 200sps 100sps 50sps 20sps 10sps 1sps
# definitions of streams
-5000sps 5000 a/d coefA3_60 coefB2C_60
+##5000sps 5000 a/d coefA3_60 coefB2C_60
2000sps 2000 a/d coefA5_50_s5c coefB3C_80
1000sps 1000 a/d coefA5_50_s5c coefA3_50 coefB2C_80_140
500sps 500 a/d coefA5_50_s5c coefA3_50 coefA2_20 coefB2C_80
-250sps 250 a/d coefA5_50_s5c coefA3_50 coefA2_20 coefA2_20 coefB2C_80
+250sps 250 a/d coefA5_50_s5c coefA3_50 coefA2_20 coefA2_20 coefB2C_80
200sps 200 a/d coefA5_50_s5c coefA3_50 coefA5_50 coefB2C_80
100sps 100 a/d coefA5_50_s5c coefA3_50 coefA2_20 coefA5_50 coefB2C_80
50sps 50 a/d coefA5_50_s5c coefA3_50 coefA4_50 coefA5_50 coefB2C_80
@@ -104,3 +106,99 @@ decifac 2
response &datafile(responses/coefB2C-60)
samplerate 5000
}
+
+soh LCE LCQ LEC LEP LKI CPU
+
+LCE &Arr{
+stages phase
+iunits s
+ounits counts
+samprate 1
+rsptype T
+}
+
+LCQ &Arr{
+stages clk_qual
+iunits percent
+ounits counts
+samprate 1
+rsptype p
+}
+
+LEC &Arr{
+stages mamp
+iunits A
+ounits counts
+samprate 1
+rsptype i
+}
+
+LEP &Arr{
+stages mvolt
+iunits V
+ounits counts
+samprate 1
+rsptype v
+}
+
+LKI &Arr{
+stages temp
+iunits Celsius
+ounits counts
+samprate 1
+rsptype t
+}
+
+CPU &Arr{
+stages load
+iunits counts
+ounits counts
+samprate 1
+rsptype c
+}
+
+phase &Arr{
+gtype clock phase
+gnom 1000000
+iunits s
+ounits counts
+sn datalogger
+}
+
+clk_qual &Arr{
+gtype clock quality
+iunits percent
+ounits counts
+sn datalogger
+}
+
+mamp &Arr{
+gtype current meter
+gnom 1000
+iunits A
+ounits counts
+sn datalogger
+}
+
+mvolt &Arr{
+gtype volt meter
+gnom 1000
+iunits V
+ounits counts
+sn datalogger
+}
+
+temp &Arr{
+gtype thermometer
+gnom 10
+iunits Celsius
+ounits counts
+sn datalogger
+}
+
+load &Arr{
+gtype cpu load
+iunits counts
+ounits counts
+sn datalogger
+}
diff --git a/data/instruments/dataloggers/kmi/obsidian_causal_5.pf b/data/instruments/dataloggers/kmi/obsidian_causal_5.pf
index 3805ebc03..2d3e6dc2f 100644
--- a/data/instruments/dataloggers/kmi/obsidian_causal_5.pf
+++ b/data/instruments/dataloggers/kmi/obsidian_causal_5.pf
@@ -2,14 +2,15 @@ category Kinemetrics
configuration Obsidian Causal Filter 5Vpp Input
originator Mathias Franke
-last_modified August 23, 2018
+last_modified April 07, 2023
description KMI Obsidian Acausal w 5Vpp Input
dfile obsidian_c_5pp
info &Literal{
This are the decimation FIR filters with a final causal brickwall filter.
This is the configuration for an Obsidian recorder set to 5Vpp input.
-The information was derived from Kinemetrics Application Note 39F
+The information was derived from Kinemetrics Application Note 39F.
+State-Of-Health channels are included.
}
@@ -20,7 +21,7 @@ streams 5000sps 2000sps 1000sps 500sps 250sps 200sps 100sps 50sps 20sps 10sps 1
2000sps 2000 a/d coefA5_50_s5c coefB3C_80
1000sps 1000 a/d coefA5_50_s5c coefA3_50 coefB2C_80_140
500sps 500 a/d coefA5_50_s5c coefA3_50 coefA2_20 coefB2C_80
-250sps 250 a/d coefA5_50_s5c coefA3_50 coefA2_20 coefA2_20 coefB2C_80
+250sps 250 a/d coefA5_50_s5c coefA3_50 coefA2_20 coefA2_20 coefB2C_80
200sps 200 a/d coefA5_50_s5c coefA3_50 coefA5_50 coefB2C_80
100sps 100 a/d coefA5_50_s5c coefA3_50 coefA2_20 coefA5_50 coefB2C_80
50sps 50 a/d coefA5_50_s5c coefA3_50 coefA4_50 coefA5_50 coefB2C_80
@@ -104,3 +105,99 @@ decifac 2
response &datafile(responses/coefB2C-60)
samplerate 5000
}
+
+soh LCE LCQ LEC LEP LKI CPU
+
+LCE &Arr{
+stages phase
+iunits s
+ounits counts
+samprate 1
+rsptype T
+}
+
+LCQ &Arr{
+stages clk_qual
+iunits percent
+ounits counts
+samprate 1
+rsptype p
+}
+
+LEC &Arr{
+stages mamp
+iunits A
+ounits counts
+samprate 1
+rsptype i
+}
+
+LEP &Arr{
+stages mvolt
+iunits V
+ounits counts
+samprate 1
+rsptype v
+}
+
+LKI &Arr{
+stages temp
+iunits Celsius
+ounits counts
+samprate 1
+rsptype t
+}
+
+CPU &Arr{
+stages load
+iunits counts
+ounits counts
+samprate 1
+rsptype c
+}
+
+phase &Arr{
+gtype clock phase
+gnom 1000000
+iunits s
+ounits counts
+sn datalogger
+}
+
+clk_qual &Arr{
+gtype clock quality
+iunits percent
+ounits counts
+sn datalogger
+}
+
+mamp &Arr{
+gtype current meter
+gnom 1000
+iunits A
+ounits counts
+sn datalogger
+}
+
+mvolt &Arr{
+gtype volt meter
+gnom 1000
+iunits V
+ounits counts
+sn datalogger
+}
+
+temp &Arr{
+gtype thermometer
+gnom 10
+iunits Celsius
+ounits counts
+sn datalogger
+}
+
+load &Arr{
+gtype cpu load
+iunits counts
+ounits counts
+sn datalogger
+}
diff --git a/data/instruments/dataloggers/misc/Makefile b/data/instruments/dataloggers/misc/Makefile
index 81604ec9e..0f3421445 100644
--- a/data/instruments/dataloggers/misc/Makefile
+++ b/data/instruments/dataloggers/misc/Makefile
@@ -2,6 +2,8 @@ DATADIR=instruments/dataloggers
DATA= parosci.pf \
saic_2001.pf \
SMACH_SM2.pf \
+ mss2.pf \
+ sara_is.pf \
unknown.pf
SUBDIR=/contrib
diff --git a/data/instruments/dataloggers/misc/mss2.pf b/data/instruments/dataloggers/misc/mss2.pf
new file mode 100644
index 000000000..a9f24ed36
--- /dev/null
+++ b/data/instruments/dataloggers/misc/mss2.pf
@@ -0,0 +1,32 @@
+# https://www.mertl-research.at/en/projects/macro_seismic_network/
+originator Nikolaus Horn, ZAMG
+last_modified 2022-04-01
+
+category MSS
+configuration MacroSeismic Sensor # Oxymoron or contradictio in adjecto
+
+description MacroSeismik Sensor Network
+dfile mss2 # no response, a mystery
+
+streams 100sps
+
+# definitions of streams
+100sps 100 a/d lp_12.8
+
+# gain = counts/V = (1 / 0.000125 V/count)
+gains 8000
+
+
+# Stages
+a/d &Arr{
+ gtype digitizer
+ samprate 100
+ iunits V
+ ounits counts
+ sn datalogger
+}
+lp_12.8 &Arr{
+ gtype analog_lp
+ gain 1
+ response &datafile(responses/lp12_8hz)
+}
diff --git a/data/instruments/dataloggers/misc/sara_is.pf b/data/instruments/dataloggers/misc/sara_is.pf
new file mode 100644
index 000000000..428ddc99e
--- /dev/null
+++ b/data/instruments/dataloggers/misc/sara_is.pf
@@ -0,0 +1,32 @@
+# https://www.mertl-research.at/en/projects/macro_seismic_network/
+originator Nikolaus Horn, ZAMG
+last_modified 2022-04-05
+
+category SARA
+configuration Sara SL06 for Infrasound
+
+description
+dfile sl06 # no response, a mystery
+
+streams 20sps
+
+# definitions of streams
+20sps 20 a/d lp_8.8hz
+
+# gain = counts/V
+gains 838860.8 # 20 V peak-to-peak, that results in a factor of 838860.8 Count/V, or 0.000001192093 V/Count.
+
+
+# Stages
+a/d &Arr{
+ gtype digitizer
+ samprate 20
+ iunits V
+ ounits counts
+ sn datalogger
+}
+lp_8.8hz &Arr{
+ gtype analog_lp
+ gain 1
+ response &datafile(responses/lp8_8hz)
+}
diff --git a/data/instruments/sensors/ifs_3000.pf b/data/instruments/sensors/ifs_3000.pf
index e83310740..38c1e738b 100644
--- a/data/instruments/sensors/ifs_3000.pf
+++ b/data/instruments/sensors/ifs_3000.pf
@@ -12,7 +12,7 @@ band l # broadband
sensor_type_code D
gtype sensor
-sensitivity 0.1725 # (17.25 mv / Pa)
+sensitivity 0.01725 # (17.25 mv / Pa)
iunits Pa
ounits V
@@ -20,5 +20,5 @@ orientations &Tbl{
D 0 0
}
-response &datafile(responses/ifs3000)
+response &datafile(responses/ifs_3000)
diff --git a/data/python/polygon/LICENSE b/data/python/polygon/LICENSE
new file mode 100644
index 000000000..4c4e3808e
--- /dev/null
+++ b/data/python/polygon/LICENSE
@@ -0,0 +1,39 @@
+Copyright (c) 2014,2022 Nikolaus Horn
+All rights reserved.
+
+This software is licensed under the New BSD license:
+
+Redistribution and use in source and binary forms,
+with or without modification, are permitted provided
+that the following conditions are met:
+
+* Redistributions of source code must retain the above
+copyright notice, this list of conditions and the
+following disclaimer.
+
+* Redistributions in binary form must reproduce the
+above copyright notice, this list of conditions and
+the following disclaimer in the documentation and/or
+other materials provided with the distribution.
+
+* Neither the name of Nikolaus Horn nor
+the names of its contributors may be used to endorse
+or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
diff --git a/data/python/polygon/polygon_utils.3y b/data/python/polygon/polygon_utils.3y
index 8c0852552..dfb803140 100644
--- a/data/python/polygon/polygon_utils.3y
+++ b/data/python/polygon/polygon_utils.3y
@@ -3,18 +3,18 @@
polygon_utils \- little helper for polygon data
.SH SYNOPSIS
.nf
-import matplotlib as mpl
+from matplotlib import pyplot as as plt
import numpy as np
import antelope.datascope as ds
sys.path.append(os.environ['ANTELOPE'] + "/contrib/data/python")
import zamg.polygon as zp
-import \fBzamg.polygon_utilities\fP as \fBzpu\fP
+import \fBzamg.polygon_utils\fP as \fBzpu\fP
db=ds.dbopen("/opt/antelope/local/data/database/plz_austria_2021","r")
db = db.lookup(table="polygon")
dbs = db.subset("pname=~/1010/")
-pdata = zp.readpolygon(db) # returns a list of lsits, each inner list is a sequence of (lon, lat)-tuples
+pdata = zp.readpolygon(db) # returns a list of lists, each inner list is a sequence of (lon, lat)-tuples
ndata = np.array(pdata[0])
lon, lat = ndata.T # transpose array
sp = zpu.simplify(pdata[0], 0.001)
@@ -33,10 +33,11 @@ utilities to make life with polygon data easier
return simplified version of polygon
.SH "SEE ALSO"
.nf
+https://github.com/omarestrella/simplify.py
antelope_python(3y), pythonpolygon(3y), polygon(3)
.fi
.SH "BUGS AND CAVEATS"
-This surrently implements a mthod for simplifying probably adds a few bugs to the polygon library.
+This currently implements a mthod for simplifying probably adds a few bugs to the polygon library.
Once I understand how the \fIbuplot\fP stuff
works, I will add more functionality
.SH AUTHOR
diff --git a/data/python/python_missing/LICENSE b/data/python/python_missing/LICENSE
new file mode 100644
index 000000000..99141b68a
--- /dev/null
+++ b/data/python/python_missing/LICENSE
@@ -0,0 +1,39 @@
+Copyright (c) 2022 Nikolaus Horn
+All rights reserved.
+
+This software is licensed under the New BSD license:
+
+Redistribution and use in source and binary forms,
+with or without modification, are permitted provided
+that the following conditions are met:
+
+* Redistributions of source code must retain the above
+copyright notice, this list of conditions and the
+following disclaimer.
+
+* Redistributions in binary form must reproduce the
+above copyright notice, this list of conditions and
+the following disclaimer in the documentation and/or
+other materials provided with the distribution.
+
+* Neither the name of Nikolaus Horn nor
+the names of its contributors may be used to endorse
+or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
diff --git a/data/python/python_missing/python_missing.3y b/data/python/python_missing/python_missing.3y
index eb817c96c..bbcf5ce2b 100644
--- a/data/python/python_missing/python_missing.3y
+++ b/data/python/python_missing/python_missing.3y
@@ -7,26 +7,32 @@ sys.path.append(os.environ['ANTELOPE'] + "/contrib/data/python")
import zamg.missing as zm
-t=stock.now()
-#print(t)
-dbname="/geoseismik/dbmaster/AGS"
-[calib, calper, st] = zm.dbget_calib("UNNA","HHZ",t, dbname)
-print(calib, calper, st)
+t=stock.str2epoch("2016-01-12 03:29:00")
+
+dbname="/opt/antelope/data/db/demo/demo"
+[calib, calper, st] = zm.dbget_calib("KNW","HHZ",t, dbname)
+if catib != 0.0:
+ print(calib, calper, st)
+else:
+ print(calib, calper, st)
.fi
.SH DESCRIPTION
An interface to important functions missing in the Python interface
-.SH OPTIONS
+.SH FUNCTIONS
.SS dbget_calib
-dbget_calib(sta, chan, time, dbname). Returns a tuple with calib, calper and segtype.
+[calib, calper, segtype] = dbget_calib(sta, chan, time, dbname). Returns a tuple with calib, calper and segtype.
If nothing is found, calib is returned as 0
.SS "TIME2SAMP SAMP2TIME SAMPRATE NSAMP ENDTIME"
trace utility functions to obtain endtime, sampling rate, number of samples and such. see trutil(3)
+.SS "dbget_remark(db), dbadd_remark(db, remark)"
+simple wrappers for the C-library functions of the same name. See dbremark(3). Pretty much useless with non-ASCII formatted strings.
+See zamg_utilities(3) for alternatives.
.SH "SEE ALSO"
.nf
antelope_python(3y), dbget_calib(3), trutil(3)
.fi
.SH "BUGS AND CAVEATS"
-This is an interface to some important Antelope-functions missing in the Python interface from BRTT
+This is an interface to some more or less important Antelope-functions missing in the 'official' Python interface from BRTT
.SH AUTHOR
Nikolaus Horn
diff --git a/data/python/zamg_utilities/.gitignore b/data/python/zamg_utilities/.gitignore
index 3b8c02d97..d91609a28 100644
--- a/data/python/zamg_utilities/.gitignore
+++ b/data/python/zamg_utilities/.gitignore
@@ -1,18 +1,5 @@
__init__.py
__pycache__
mkso
-create_dbdesc.3y
-epoch2rfc3339.3y
-rfc33392epoch.3y
-spherical_distance.3y
-string_charsplit.3y
-string_maxbytes.3y
-utf8len.3y
-haversine_distance.3y
-init_statefile.3y
-update_statefile.3y
-multipartemail.3y
-send_multipartemail.3y
-add_remark.3y
-get_remark.3y
-set_remark.3y
+testme.xpy
+*.3y
diff --git a/data/python/zamg_utilities/LICENSE b/data/python/zamg_utilities/LICENSE
new file mode 100644
index 000000000..d2b68e96f
--- /dev/null
+++ b/data/python/zamg_utilities/LICENSE
@@ -0,0 +1,39 @@
+Copyright (c) 2018-2022 Nikolaus Horn
+All rights reserved.
+
+This software is licensed under the New BSD license:
+
+Redistribution and use in source and binary forms,
+with or without modification, are permitted provided
+that the following conditions are met:
+
+* Redistributions of source code must retain the above
+copyright notice, this list of conditions and the
+following disclaimer.
+
+* Redistributions in binary form must reproduce the
+above copyright notice, this list of conditions and
+the following disclaimer in the documentation and/or
+other materials provided with the distribution.
+
+* Neither the name of Nikolaus Horn nor
+the names of its contributors may be used to endorse
+or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
diff --git a/data/python/zamg_utilities/Makefile b/data/python/zamg_utilities/Makefile
index 997a4f63a..a7d230ea1 100644
--- a/data/python/zamg_utilities/Makefile
+++ b/data/python/zamg_utilities/Makefile
@@ -6,14 +6,15 @@ DATA= __init__.py utilities.py mailutils.py
MAN3Y=init_statefile.3y multipartemail.3y send_multipartemail.3y update_statefile.3y \
zamg_utilities.3y zamg_mailutils.3y utf8len.3y string_charsplit.3y string_maxbytes.3y \
create_dbdesc.3y rfc33392epoch.3y epoch2rfc3339.3y \
- spherical_distance.3y haversine_distance.3y set_remark.3y add_remark.3y get_remark.3y
+ spherical_distance.3y haversine_distance.3y next_number.3y \
+ set_remark.3y add_remark.3y get_remark.3y mark_remark.3y
CLEAN= mkso *.pyc *.so __init__.py \
init_statefile.3y update_statefile.3y \
utf8len.3y string_charsplit.3y string_maxbytes.3y \
create_dbdesc.3y rfc33392epoch.3y epoch2rfc3339.3y \
spherical_distance.3y haversine_distance.3y \
- multipartemail.3y send_email.3y add_remark.3y get_remark.3y set_remark.3y
+ multipartemail.3y send_email.3y add_remark.3y get_remark.3y set_remark.3y mark_remark.3y next_number.3y
include $(ANTELOPEMAKE)
SUBDIR=/contrib
diff --git a/data/python/zamg_utilities/next_number.3y b/data/python/zamg_utilities/next_number.3y
deleted file mode 100644
index a122ef9e0..000000000
--- a/data/python/zamg_utilities/next_number.3y
+++ /dev/null
@@ -1,2 +0,0 @@
-.so man3y/zamg_utilities.3y
-
diff --git a/data/python/zamg_utilities/utilities.py b/data/python/zamg_utilities/utilities.py
index 2c1001c48..8bb12a164 100755
--- a/data/python/zamg_utilities/utilities.py
+++ b/data/python/zamg_utilities/utilities.py
@@ -86,12 +86,12 @@ def string_charsplit(my_string, bytelen):
def string_maxbytes(my_string, bytelen):
"""chop encoded string into characters, not bytes"""
chars = 1
- while utf8len(my_string[:chars]) <= bytelen:
+ while utf8len(my_string[:chars]) <= bytelen and chars <= len(my_string):
chars += 1
return my_string[: chars - 1]
-def create_dbdesc(dbpath, dbschema, tablename):
+def create_dbdesc(dbpath, dbschema, tablename=None):
"""create database descriptor. Returns database pointer to a table"""
kdb = ds.dbopen(dbpath, "r+")
descname = kdb.query("dbDATABASE_FILENAME")
@@ -108,14 +108,17 @@ def create_dbdesc(dbpath, dbschema, tablename):
ds.dbcreate(dbpath, dbschema)
kdb = ds.dbopen(dbpath, "r+")
- try:
- idmatch = kdb.lookup(table=tablename)
- except Exception as __:
- elog.complain(
- "table %s does not exist in schema for database %s" % (tablename, dbpath)
- )
- return None
- return idmatch
+ if tablename != None:
+ try:
+ idmatch = kdb.lookup(table=tablename)
+ except Exception as __:
+ elog.complain(
+ "table %s does not exist in schema for database %s" % (tablename, dbpath)
+ )
+ return None
+ return idmatch
+ else:
+ return kdb
def add_remark(db, remark):
@@ -238,6 +241,24 @@ def get_remark(db):
remark = "".join(remarks)
return remark
+def mark_remark(db):
+ if db.table < 0 or db.record < 0:
+ elog.complain("cannot clear remark from unspecified record")
+ try:
+ db_r = db.lookup(table="remark")
+ except Exception as __:
+ elog.notify("cannot lookup remark table")
+ try:
+ [commid] = db.getv("commid")
+ except Exception as __:
+ elog.notify("cannot retrieve commid")
+ if commid >= 0:
+ db_r = db_r.sort(["commid", "lineno"])
+ matcher = db.matches(db_r, kpattern="commid", tpattern="commid")
+ records = matcher()
+ if len(records) > 0:
+ for db_r.record in records:
+ db_r.mark()
def rfc33392epoch(timestring):
"""convert internet timestamp in RFC3339 format. Returns normal antelope epoch time"""
diff --git a/data/python/zamg_utilities/zamg_utilities.3y b/data/python/zamg_utilities/zamg_utilities.3y
index b72d02028..0604386e7 100644
--- a/data/python/zamg_utilities/zamg_utilities.3y
+++ b/data/python/zamg_utilities/zamg_utilities.3y
@@ -1,6 +1,6 @@
.TH PYTHON_PJ 3Y
.SH NAME
-init_statefile, update_statefile, rfc33392epoch, epoch2rfc3339, string_charsplit, utf8len, string_maxbytes, set_remark, add_remark, get_remark, create_dbdesc, spherical_distance \- little helpers
+init_statefile, update_statefile, rfc33392epoch, epoch2rfc3339, string_charsplit, utf8len, string_maxbytes, set_remark, add_remark, get_remark, mark_remar, create_dbdesc, spherical_distance, haversine_distance \- little helpers
.SH SYNOPSIS
.nf
sys.path.append(os.environ['ANTELOPE'] + "/contrib/data/python")
@@ -26,27 +26,30 @@ Useful for wring unicode data to records of fixed length like e.g in the remark
.SS bytelen = utf8len(string)
length of encoded string in bytes
.SS substr = string_maxbytes(input, bytelen)
-return at most \fBbytelen\fP bytes of encoded string.
+return at most \fBbytelen\fP bytes of encoded string.
Useful for avoiding half-written bytes
.SS commid = set_remark(dbt, remark)
-Set or update remark for specified table and record. Really useful :-) !
+Set or update remark for specified table and record. Really useful :-) !
.SS commid = add_remark(dbt, remark)
Add remark to specified table and record. This function splits the remark using
\fBstring_charsplit\fP to avoid broken chars. Sets (overwrites) commid in the specified record.
Previous remarks are left in the remark table but no longer associated to the specified record.
.SS remark = get_remark(dbt)
-retrieve remark for specified record.
-.SS db = create_dbdesc(path, schema, table)
-create database descriptor with specified schema and return specified table
-Useful for non-default schemata
+Retrieve remark for specified table and record in one line.
+.SS mark_remark(dbt)
+Mark (clear) remark for specified table and record. This function uses \fIdbmark\fP to mark specified remarks.
+One should remove nullified records later by calling \fIdbcrunch(1)\fP.
+.SS db = create_dbdesc(path, schema, table=NULL)
+Return database and table, if specified. If necessary, create database descriptor with specified schema.
+Mainly useful for non-default schemata.
.SS dist = spherical_distance(lat1,lon1, lat2, lon2, degrees=True)
-return great-arc distance between 2 points. Input is in degrees.
+return great-arc distance between 2 points. Input is in degrees, output is selectable.
.SS dist = haversine_distance(lat1,lon1, lat2, lon2, degrees=True)
-return great-arc distance between 2 points, computed using the haversine formula. Input is in degrees.
+return great-arc distance between 2 points, computed using the haversine formula. Input is in degrees, output unit can be selected.
.SS lastid, lasttime = init_statefile(statefilename)
-read from existing statefile or prepare to use one. Returns id and time
+read from existing statefile or prepare to use one. Returns id and time.
.SS update_statefile(statefilename, id, time)
-update statefile with id and time
+update statefile with id and time.
.SH "SEE ALSO"
.nf
antelope_python(3y), epoch(3)
diff --git a/data/responses/infrasound/Makefile b/data/responses/infrasound/Makefile
index 00e6391ad..da7da173a 100644
--- a/data/responses/infrasound/Makefile
+++ b/data/responses/infrasound/Makefile
@@ -1,7 +1,8 @@
DATADIR=responses
DATA= \
chaparral_25 \
- hyperion \
+ hyperion \
+ ifs3000 \
mb2000_fil \
mb2000_raw \
ncpa \
diff --git a/data/responses/infrasound/ifs3000 b/data/responses/infrasound/ifs3000
new file mode 100644
index 000000000..243fd7a06
--- /dev/null
+++ b/data/responses/infrasound/ifs3000
@@ -0,0 +1,22 @@
+# Hyperion IS 3000
+#
+# 3 num of zeroes
+# 3 num of poles
+# 1 normalization factor
+# 1.0 gain
+# # From the Manual:
+# the frequencies of the poles for the transfer function of the sensors are:
+#f1 = 1.483 mHz
+#f2 = 3.387 mHz
+#f3 = 29.49 mHz.
+theoretical 1 anti-alias paz Hyperion
+1
+3 Poles
+-9.317963E-03 0.000000E+00 0.000000E+00 0.000000E+00
+-2.128114E-02 0.000000E+00 0.000000E+00 0.000000E+00
+-1.852911E-01 0.000000E+00 0.000000E+00 0.000000E+00
+
+3 Zeros
+0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00
+0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00
+0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00
diff --git a/data/responses/misc/Makefile b/data/responses/misc/Makefile
index d1282bd52..c7e79a82c 100644
--- a/data/responses/misc/Makefile
+++ b/data/responses/misc/Makefile
@@ -1,7 +1,9 @@
DATADIR=responses
DATA=SSA2_50 dummy GEOS_100 SCSN_20 SSR1_50 uwiseismic unkn_vel fir_dummy \
gsv_111_10mm sm6-b BH1 \
- seismonitor sm2_aa_128sps sm2_aa_256sps ifs3000
+ seismonitor lp12_8hz lp8_8hz \
+ sm2_aa_128sps sm2_aa_256sps \
+ ifs3000
SUBDIR=/contrib
diff --git a/data/responses/misc/ifs3000 b/data/responses/misc/ifs3000
deleted file mode 100644
index 20c0a1618..000000000
--- a/data/responses/misc/ifs3000
+++ /dev/null
@@ -1,25 +0,0 @@
-# Hyperion IFS 3000
-#
-# 3 num of zeroes
-# 3 num of poles
-# 1 normalization factor
-# 1.0 gain
-####### original (in Hz) #####
-# theoretical 1 sensor paz Niko
-# 1.0
-# 3 Poles
-# 1.483E-3 0.0000e+00 0.0000E+00 0.0000E+00
-# 3.387E-3 0.0000e+00 0.0000E+00 0.0000E+00
-# 29.49E-3 0.0000e+00 0.0000E+00 0.0000E+00
-# 0 Zeros
-####### converted (to rad) ##### nawk -f hz2rad filename > newfilename
-theoretical 1 sensor paz Niko
-1
-3 Poles
--0.009318 0.000000 0 0
--0.021281 0.000000 0 0
--0.185291 0.000000 0 0
-3 Zeros
-0 0 0 0
-0 0 0 0
-0 0 0 0
diff --git a/data/responses/misc/lp12_8hz b/data/responses/misc/lp12_8hz
new file mode 100644
index 000000000..dda46e9ec
--- /dev/null
+++ b/data/responses/misc/lp12_8hz
@@ -0,0 +1,14 @@
+# 12.8Hz lowpass 20dB/Decade
+# All poles and zeroes in radians/sec
+# 1 type
+# 1 num of zeroes
+# 0 num of poles
+# 0.0 input sample interval
+# 1 decim factor
+# 2.010660e+1 normalization factor
+# 1.0 gain
+theoretical 1 lowpass paz pz6seismo
+8.04244772E+01
+1 Poles
+-8.0424772E+01 0.0E+00 0.0000E+00 0.0000E+00
+0 Zeros
diff --git a/data/responses/misc/lp8_8hz b/data/responses/misc/lp8_8hz
new file mode 100644
index 000000000..8fe14c60f
--- /dev/null
+++ b/data/responses/misc/lp8_8hz
@@ -0,0 +1,14 @@
+# 8.8Hz lowpass 20dB/Decade
+# All poles and zeroes in radians/sec
+# 1 type
+# 1 num of zeroes
+# 0 num of poles
+# 0.0 input sample interval
+# 1 decim factor
+# 2.010660e+1 normalization factor
+# 1.0 gain
+theoretical 1 lowpass paz pz6seismo
+5.529203E+01
+1 Poles
+5.529203E+01 0.000000E+00 0.000000E+00 0.000000E+00
+0 Zeros
diff --git a/data/schemas/css3.0.ext/origqual b/data/schemas/css3.0.ext/origqual
index da988ef89..163b61870 100644
--- a/data/schemas/css3.0.ext/origqual
+++ b/data/schemas/css3.0.ext/origqual
@@ -136,6 +136,6 @@ Relation origqual
Foreign ( commid )
Description ( "origin quality idicators" )
Detail {
- blabla parameters to assess origin quality
+ Parameters to assess origin quality
}
;
diff --git a/lib/libpolygon/LICENSE b/lib/libpolygon/LICENSE
new file mode 100644
index 000000000..98eb59478
--- /dev/null
+++ b/lib/libpolygon/LICENSE
@@ -0,0 +1,39 @@
+Copyright (c) 2003 Nikolaus Horn
+All rights reserved.
+
+This software is licensed under the New BSD license:
+
+Redistribution and use in source and binary forms,
+with or without modification, are permitted provided
+that the following conditions are met:
+
+* Redistributions of source code must retain the above
+copyright notice, this list of conditions and the
+following disclaimer.
+
+* Redistributions in binary form must reproduce the
+above copyright notice, this list of conditions and
+the following disclaimer in the documentation and/or
+other materials provided with the distribution.
+
+* Neither the name of Nikolaus Horn nor
+the names of its contributors may be used to endorse
+or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
diff --git a/lib/libpolygon/Makefile b/lib/libpolygon/Makefile
index d49134669..43c3d7a58 100644
--- a/lib/libpolygon/Makefile
+++ b/lib/libpolygon/Makefile
@@ -18,6 +18,9 @@ MAN3= \
ldlibs= $(DBLIBS)
cflags = -g
+#-dynamiclib
+#ldflags = -target x86_64-apple-macos12.0 -dynamiclib
+
SUBDIR=/contrib
include $(ANTELOPEMAKE)
diff --git a/lib/perl/perlpolygon/LICENSE b/lib/perl/perlpolygon/LICENSE
new file mode 100644
index 000000000..98eb59478
--- /dev/null
+++ b/lib/perl/perlpolygon/LICENSE
@@ -0,0 +1,39 @@
+Copyright (c) 2003 Nikolaus Horn
+All rights reserved.
+
+This software is licensed under the New BSD license:
+
+Redistribution and use in source and binary forms,
+with or without modification, are permitted provided
+that the following conditions are met:
+
+* Redistributions of source code must retain the above
+copyright notice, this list of conditions and the
+following disclaimer.
+
+* Redistributions in binary form must reproduce the
+above copyright notice, this list of conditions and
+the following disclaimer in the documentation and/or
+other materials provided with the distribution.
+
+* Neither the name of Nikolaus Horn nor
+the names of its contributors may be used to endorse
+or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+