sac-format 0.6.0
C++20 SAC (Seismic Analysis Code) File Library
Loading...
Searching...
No Matches
sacfmt::Trace Class Reference

The Trace class. More...

#include <sac_format.hpp>

Public Member Functions

 Trace () noexcept
 Trace default constructor.
 
 Trace (const std::filesystem::path &path)
 Binary SAC-file reader.
 
void write (const std::filesystem::path &path, bool legacy=false) const
 Binary SAC-file writer.
 
void legacy_write (const std::filesystem::path &path) const
 Binary SAC-file legacy-write convenience function.
 
bool operator== (const Trace &other) const noexcept
 Trace equality operator.
 
void calc_geometry () noexcept
 Calculates gcarc, dist, az, and baz from stla, stlo, evla, and evlo.
 
double frequency () const noexcept
 Calculate frequency from delta.
 
std::string date () const noexcept
 Get date string.
 
std::string time () const noexcept
 Get time string.
 
float depmin () const noexcept
 
float depmax () const noexcept
 
float odelta () const noexcept
 
float resp0 () const noexcept
 
float resp1 () const noexcept
 
float resp2 () const noexcept
 
float resp3 () const noexcept
 
float resp4 () const noexcept
 
float resp5 () const noexcept
 
float resp6 () const noexcept
 
float resp7 () const noexcept
 
float resp8 () const noexcept
 
float resp9 () const noexcept
 
float stel () const noexcept
 
float stdp () const noexcept
 
float evel () const noexcept
 
float evdp () const noexcept
 
float mag () const noexcept
 
float user0 () const noexcept
 
float user1 () const noexcept
 
float user2 () const noexcept
 
float user3 () const noexcept
 
float user4 () const noexcept
 
float user5 () const noexcept
 
float user6 () const noexcept
 
float user7 () const noexcept
 
float user8 () const noexcept
 
float user9 () const noexcept
 
float dist () const noexcept
 
float az () const noexcept
 
float baz () const noexcept
 
float gcarc () const noexcept
 
float depmen () const noexcept
 
float cmpaz () const noexcept
 
float cmpinc () const noexcept
 
float xminimum () const noexcept
 
float xmaximum () const noexcept
 
float yminimum () const noexcept
 
float ymaximum () const noexcept
 
double delta () const noexcept
 
double b () const noexcept
 
double e () const noexcept
 
double o () const noexcept
 
double a () const noexcept
 
double t0 () const noexcept
 
double t1 () const noexcept
 
double t2 () const noexcept
 
double t3 () const noexcept
 
double t4 () const noexcept
 
double t5 () const noexcept
 
double t6 () const noexcept
 
double t7 () const noexcept
 
double t8 () const noexcept
 
double t9 () const noexcept
 
double f () const noexcept
 
double stla () const noexcept
 
double stlo () const noexcept
 
double evla () const noexcept
 
double evlo () const noexcept
 
double sb () const noexcept
 
double sdelta () const noexcept
 
int nzyear () const noexcept
 
int nzjday () const noexcept
 
int nzhour () const noexcept
 
int nzmin () const noexcept
 
int nzsec () const noexcept
 
int nzmsec () const noexcept
 
int nvhdr () const noexcept
 
int norid () const noexcept
 
int nevid () const noexcept
 
int npts () const noexcept
 
int nsnpts () const noexcept
 
int nwfid () const noexcept
 
int nxsize () const noexcept
 
int nysize () const noexcept
 
int iftype () const noexcept
 
int idep () const noexcept
 
int iztype () const noexcept
 
int iinst () const noexcept
 
int istreg () const noexcept
 
int ievreg () const noexcept
 
int ievtyp () const noexcept
 
int iqual () const noexcept
 
int isynth () const noexcept
 
int imagtyp () const noexcept
 
int imagsrc () const noexcept
 
int ibody () const noexcept
 
bool leven () const noexcept
 
bool lpspol () const noexcept
 
bool lovrok () const noexcept
 
bool lcalda () const noexcept
 
std::string kstnm () const noexcept
 
std::string kevnm () const noexcept
 
std::string khole () const noexcept
 
std::string ko () const noexcept
 
std::string ka () const noexcept
 
std::string kt0 () const noexcept
 
std::string kt1 () const noexcept
 
std::string kt2 () const noexcept
 
std::string kt3 () const noexcept
 
std::string kt4 () const noexcept
 
std::string kt5 () const noexcept
 
std::string kt6 () const noexcept
 
std::string kt7 () const noexcept
 
std::string kt8 () const noexcept
 
std::string kt9 () const noexcept
 
std::string kf () const noexcept
 
std::string kuser0 () const noexcept
 
std::string kuser1 () const noexcept
 
std::string kuser2 () const noexcept
 
std::string kcmpnm () const noexcept
 
std::string knetwk () const noexcept
 
std::string kdatrd () const noexcept
 
std::string kinst () const noexcept
 
std::vector< doubledata1 () const noexcept
 
std::vector< doubledata2 () const noexcept
 
void depmin (float input) noexcept
 
void depmax (float input) noexcept
 
void odelta (float input) noexcept
 
void resp0 (float input) noexcept
 
void resp1 (float input) noexcept
 
void resp2 (float input) noexcept
 
void resp3 (float input) noexcept
 
void resp4 (float input) noexcept
 
void resp5 (float input) noexcept
 
void resp6 (float input) noexcept
 
void resp7 (float input) noexcept
 
void resp8 (float input) noexcept
 
void resp9 (float input) noexcept
 
void stel (float input) noexcept
 
void stdp (float input) noexcept
 
void evel (float input) noexcept
 
void evdp (float input) noexcept
 
void mag (float input) noexcept
 
void user0 (float input) noexcept
 
void user1 (float input) noexcept
 
void user2 (float input) noexcept
 
void user3 (float input) noexcept
 
void user4 (float input) noexcept
 
void user5 (float input) noexcept
 
void user6 (float input) noexcept
 
void user7 (float input) noexcept
 
void user8 (float input) noexcept
 
void user9 (float input) noexcept
 
void dist (float input) noexcept
 
void az (float input) noexcept
 
void baz (float input) noexcept
 
void gcarc (float input) noexcept
 
void depmen (float input) noexcept
 
void cmpaz (float input) noexcept
 
void cmpinc (float input) noexcept
 
void xminimum (float input) noexcept
 
void xmaximum (float input) noexcept
 
void yminimum (float input) noexcept
 
void ymaximum (float input) noexcept
 
void delta (double input) noexcept
 
void b (double input) noexcept
 
void e (double input) noexcept
 
void o (double input) noexcept
 
void a (double input) noexcept
 
void t0 (double input) noexcept
 
void t1 (double input) noexcept
 
void t2 (double input) noexcept
 
void t3 (double input) noexcept
 
void t4 (double input) noexcept
 
void t5 (double input) noexcept
 
void t6 (double input) noexcept
 
void t7 (double input) noexcept
 
void t8 (double input) noexcept
 
void t9 (double input) noexcept
 
void f (double input) noexcept
 
void stla (double input) noexcept
 
void stlo (double input) noexcept
 
void evla (double input) noexcept
 
void evlo (double input) noexcept
 
void sb (double input) noexcept
 
void sdelta (double input) noexcept
 
void nzyear (int input) noexcept
 
void nzjday (int input) noexcept
 
void nzhour (int input) noexcept
 
void nzmin (int input) noexcept
 
void nzsec (int input) noexcept
 
void nzmsec (int input) noexcept
 
void nvhdr (int input) noexcept
 
void norid (int input) noexcept
 
void nevid (int input) noexcept
 
void npts (int input) noexcept
 
void nsnpts (int input) noexcept
 
void nwfid (int input) noexcept
 
void nxsize (int input) noexcept
 
void nysize (int input) noexcept
 
void iftype (int input) noexcept
 
void idep (int input) noexcept
 
void iztype (int input) noexcept
 
void iinst (int input) noexcept
 
void istreg (int input) noexcept
 
void ievreg (int input) noexcept
 
void ievtyp (int input) noexcept
 
void iqual (int input) noexcept
 
void isynth (int input) noexcept
 
void imagtyp (int input) noexcept
 
void imagsrc (int input) noexcept
 
void ibody (int input) noexcept
 
void leven (bool input) noexcept
 
void lpspol (bool input) noexcept
 
void lovrok (bool input) noexcept
 
void lcalda (bool input) noexcept
 
void kstnm (const std::string &input) noexcept
 
void kevnm (const std::string &input) noexcept
 
void khole (const std::string &input) noexcept
 
void ko (const std::string &input) noexcept
 
void ka (const std::string &input) noexcept
 
void kt0 (const std::string &input) noexcept
 
void kt1 (const std::string &input) noexcept
 
void kt2 (const std::string &input) noexcept
 
void kt3 (const std::string &input) noexcept
 
void kt4 (const std::string &input) noexcept
 
void kt5 (const std::string &input) noexcept
 
void kt6 (const std::string &input) noexcept
 
void kt7 (const std::string &input) noexcept
 
void kt8 (const std::string &input) noexcept
 
void kt9 (const std::string &input) noexcept
 
void kf (const std::string &input) noexcept
 
void kuser0 (const std::string &input) noexcept
 
void kuser1 (const std::string &input) noexcept
 
void kuser2 (const std::string &input) noexcept
 
void kcmpnm (const std::string &input) noexcept
 
void knetwk (const std::string &input) noexcept
 
void kdatrd (const std::string &input) noexcept
 
void kinst (const std::string &input) noexcept
 
void data1 (const std::vector< double > &input) noexcept
 
void data2 (const std::vector< double > &input) noexcept
 

Static Public Member Functions

static void write_data (std::ofstream *sac_file, const std::vector< double > &data_vec)
 Writes data vectors.
 

Private Member Functions

void calc_gcarc () noexcept
 Calculate great-circle arc-distance (gcarc).
 
void calc_dist () noexcept
 Calculate distance (using gcarc).
 
void calc_az () noexcept
 Calculate azimuth.
 
void calc_baz () noexcept
 Calculate back-azimuth.
 
void read_float_headers_starter (std::ifstream *sac_file)
 Reads SAC-headers from words 000–009.
 
void read_float_headers_t (std::ifstream *sac_file)
 Reads SAC-headers from words 010–020.
 
void read_float_headers_resp (std::ifstream *sac_file)
 Reads SAC-headers from words 021–030.
 
void read_float_headers_station_event (std::ifstream *sac_file)
 Reads SAC-headers from words 031–039.
 
void read_float_headers_user (std::ifstream *sac_file)
 Reads SAC-headers from words 040–049.
 
void read_float_headers_geometry (std::ifstream *sac_file)
 Reads SAC-headers from words 050–053.
 
void read_float_headers_meta (std::ifstream *sac_file)
 Reads SAC-headers from words 054–069.
 
void read_float_headers (std::ifstream *sac_file)
 Reads SAC-headers from words 000–069.
 
void read_int_headers_datetime (std::ifstream *sac_file)
 Reads SAC-headers from words 070–075.
 
void read_int_headers_meta (std::ifstream *sac_file)
 Reads SAC-headers from words 076–104.
 
void read_int_headers (std::ifstream *sac_file)
 Reads SAC-headers from words 070–104.
 
void read_bool_headers (std::ifstream *sac_file)
 Reads SAC-headers from words 105–109.
 
void read_string_headers (std::ifstream *sac_file)
 Reads SAC-headers from words 110–157.
 
void read_datas (std::ifstream *sac_file)
 Reads data vectors.
 
void read_footers (std::ifstream *sac_file)
 Reads SAC-footers (post-data words 00–43).
 
void write_float_headers_starter (std::ofstream *sac_file) const
 Writes SAC-headers from words 000–009.
 
void write_float_headers_t (std::ofstream *sac_file) const
 Writes SAC-headers from words 010–020.
 
void write_float_headers_resp (std::ofstream *sac_file) const
 Writes SAC-headers from words 021–030.
 
void write_float_headers_station_event (std::ofstream *sac_file) const
 Writes SAC-headers from words 031–039.
 
void write_float_headers_user (std::ofstream *sac_file) const
 Writes SAC-headers from words 040–049.
 
void write_float_headers_geometry (std::ofstream *sac_file) const
 Writes SAC-headers from words 050–053.
 
void write_float_headers_meta (std::ofstream *sac_file) const
 Writes SAC-headers from words 054–069.
 
void write_float_headers (std::ofstream *sac_file) const
 Writes SAC-headers from words 000–069.
 
void write_int_headers_datetime (std::ofstream *sac_file) const
 Writes SAC-headers from words 070–075.
 
void write_int_headers_meta (std::ofstream *sac_file, int hdr_ver) const
 Writes SAC-headers from words 076–104.
 
void write_int_headers (std::ofstream *sac_file, int hdr_ver) const
 Writes SAC-headers from words 070–104.
 
void write_bool_headers (std::ofstream *sac_file) const
 Writes SAC-headers from words 105–109.
 
void write_string_headers (std::ofstream *sac_file) const
 Writes SAC-headers from words 110–157.
 
void write_footers (std::ofstream *sac_file) const
 Writes SAC-footers (post-data words 00–43).
 
bool geometry_set () const noexcept
 Determine if locations are set for geometry calculation.
 
point station_location () const noexcept
 Return station location as a point.
 
point event_location () const noexcept
 Return even location as a point.
 
void resize_data1 (size_t size) noexcept
 
void resize_data2 (size_t size) noexcept
 
void resize_data (size_t size) noexcept
 Resize data vectors (only if eligible).
 

Private Attributes

std::array< float, num_floatfloats {}
 Float storage array.
 
std::array< double, num_doubledoubles {}
 Double storage array.
 
std::array< int, num_intints {}
 Integer storage array.
 
std::array< bool, num_boolbools {}
 Boolean storage array.
 
std::array< std::string, num_stringstrings {}
 String storage array.
 
std::array< std::vector< double >, num_datadata {}
 std::vector<double> storage array.
 

Detailed Description

The Trace class.

This class is the recommended way for reading/writing SAC-files.

It safely reads all data, provides automatic write support based upon the nVHdr header value (determine if a footer should be included or not).

It provides getters and setters for all SAC headers and the data.

Constructor & Destructor Documentation

◆ Trace() [1/2]

sacfmt::Trace::Trace()
noexcept

Trace default constructor.

Fills all values with their default (unset) values. Data vectors are of size zero.

Returns
Default created Trace object.
861 {
862 std::fill(floats.begin(), floats.end(), unset_float);
863 std::fill(doubles.begin(), doubles.end(), unset_double);
864 std::fill(ints.begin(), ints.end(), unset_int);
865 std::fill(bools.begin(), bools.end(), unset_bool);
866 std::fill(strings.begin(), strings.end(), unset_word);
867}
std::array< std::string, num_string > strings
String storage array.
Definition sac_format.hpp:1408
std::array< int, num_int > ints
Integer storage array.
Definition sac_format.hpp:1404
std::array< bool, num_bool > bools
Boolean storage array.
Definition sac_format.hpp:1406
std::array< float, num_float > floats
Float storage array.
Definition sac_format.hpp:1400
std::array< double, num_double > doubles
Double storage array.
Definition sac_format.hpp:1402
constexpr float unset_float
Float-point unset value (SAC Magic).
Definition sac_format.hpp:72
constexpr double unset_double
Double-precision unset value (SAC Magic).
Definition sac_format.hpp:74
constexpr bool unset_bool
Boolean unset value (SAC Magic).
Definition sac_format.hpp:76
const std::string unset_word
String unset value (SAC Magic).
Definition sac_format.hpp:78
constexpr int unset_int
Integer unset value (SAC Magic).
Definition sac_format.hpp:70

◆ Trace() [2/2]

sacfmt::Trace::Trace(const std::filesystem::path & path)
explicit

Binary SAC-file reader.

Parameters
[in]pathstd::filesystem::path SAC-file to be read.
Returns
Trace read in-file.
Exceptions
io_errorIf the file is not safe to read for whatever reason.
std::exception(disk failure).
2186 {
2187 std::ifstream file(path, std::ifstream::binary);
2188 if (!file) {
2189 throw io_error(path.string() + " cannot be opened to read.");
2190 }
2191 safe_to_read_header(&file); // throws io_error if not safe
2192 read_float_headers(&file);
2193 read_int_headers(&file);
2194 read_bool_headers(&file);
2195 read_string_headers(&file);
2196 read_datas(&file);
2197 if (nvhdr() == modern_hdr_version) {
2198 safe_to_read_footer(&file); // throws io_error if not safe
2199 read_footers(&file);
2200 }
2201 safe_to_finish_reading(&file); // throws io_error if the file isn't finished
2202 file.close();
2203}
void read_string_headers(std::ifstream *sac_file)
Reads SAC-headers from words 110–157.
Definition sac_format.cpp:2084
void read_float_headers(std::ifstream *sac_file)
Reads SAC-headers from words 000–069.
Definition sac_format.cpp:1957
void read_datas(std::ifstream *sac_file)
Reads data vectors.
Definition sac_format.cpp:2125
void read_int_headers(std::ifstream *sac_file)
Reads SAC-headers from words 070–104.
Definition sac_format.cpp:2045
void read_bool_headers(std::ifstream *sac_file)
Reads SAC-headers from words 105–109.
Definition sac_format.cpp:2062
void read_footers(std::ifstream *sac_file)
Reads SAC-footers (post-data words 00–43).
Definition sac_format.cpp:2153
int nvhdr() const noexcept
Definition sac_format.cpp:1118
void safe_to_read_footer(std::ifstream *sac)
Determines if the SAC-file has enough space remaining to contain a complete footer.
Definition sac_format.cpp:1708
void safe_to_finish_reading(std::ifstream *sac)
Determines if the SAC-file is finished.
Definition sac_format.cpp:1749
void safe_to_read_header(std::ifstream *sac)
Determine if the SAC-file is large enough to contain a complete header.
Definition sac_format.cpp:1692
constexpr int modern_hdr_version
nVHdr value for newest SAC format (2020+).
Definition sac_format.hpp:106
Here is the call graph for this function:

Member Function Documentation

◆ a() [1/2]

double sacfmt::Trace::a()const
noexcept
1091{ return doubles[sac_map.at(name::a)]; }
const std::unordered_map< name, const size_t > sac_map
Lookup table for variable locations.
Definition sac_format.hpp:946
Here is the caller graph for this function:

◆ a() [2/2]

void sacfmt::Trace::a(double input)
noexcept
1346 {
1347 doubles[sac_map.at(name::a)] = input;
1348}

◆ az() [1/2]

float sacfmt::Trace::az()const
noexcept
1062{ return floats[sac_map.at(name::az)]; }
Here is the caller graph for this function:

◆ az() [2/2]

void sacfmt::Trace::az(float input)
noexcept
1303 {
1304 floats[sac_map.at(name::az)] = input;
1305}

◆ b() [1/2]

double sacfmt::Trace::b()const
noexcept
1088{ return doubles[sac_map.at(name::b)]; }
Here is the caller graph for this function:

◆ b() [2/2]

void sacfmt::Trace::b(double input)
noexcept
1337 {
1338 doubles[sac_map.at(name::b)] = input;
1339}

◆ baz() [1/2]

float sacfmt::Trace::baz()const
noexcept
1063{ return floats[sac_map.at(name::baz)]; }
Here is the caller graph for this function:

◆ baz() [2/2]

void sacfmt::Trace::baz(float input)
noexcept
1306 {
1307 floats[sac_map.at(name::baz)] = input;
1308}

◆ calc_az()

void sacfmt::Trace::calc_az()
privatenoexcept

Calculate azimuth.

\[\color{orange}
Station\rightarrow Event
\]

971 {
972 az(static_cast<float>(azimuth(event_location(), station_location())));
973}
point station_location() const noexcept
Return station location as a point.
Definition sac_format.hpp:1388
point event_location() const noexcept
Return even location as a point.
Definition sac_format.hpp:1392
float az() const noexcept
Definition sac_format.cpp:1062
double azimuth(point location1, point location2) noexcept
Calculate azimuth between two points.
Definition sac_format.cpp:766
Here is the call graph for this function:
Here is the caller graph for this function:

◆ calc_baz()

void sacfmt::Trace::calc_baz()
privatenoexcept

Calculate back-azimuth.

\[\color{orange}
Event\rightarrow Station
\]

982 {
983 baz(static_cast<float>(azimuth(station_location(), event_location())));
984}
float baz() const noexcept
Definition sac_format.cpp:1063
Here is the call graph for this function:
Here is the caller graph for this function:

◆ calc_dist()

void sacfmt::Trace::calc_dist()
privatenoexcept

Calculate distance (using gcarc).

Assumes spherical Earth (in future may update to include flattening and different planteray bodies).

\[\color{orange}
d=r_{E}\cdot\Delta
\]

960 {
961 dist(static_cast<float>(earth_radius * rad_per_deg * gcarc()));
962}
float gcarc() const noexcept
Definition sac_format.cpp:1064
float dist() const noexcept
Definition sac_format.cpp:1061
constexpr double rad_per_deg
Radians per degree.
Definition sac_format.hpp:112
constexpr double earth_radius
Average radius of Earth (kilometers).
Definition sac_format.hpp:118
Here is the call graph for this function:
Here is the caller graph for this function:

◆ calc_gcarc()

void sacfmt::Trace::calc_gcarc()
privatenoexcept

Calculate great-circle arc-distance (gcarc).

945 {
947 static_cast<float>(sacfmt::gcarc(station_location(), event_location())));
948}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ calc_geometry()

void sacfmt::Trace::calc_geometry()
noexcept

Calculates gcarc, dist, az, and baz from stla, stlo, evla, and evlo.

901 {
902 if (geometry_set()) {
903 calc_gcarc();
904 calc_dist();
905 calc_az();
906 calc_baz();
907 } else {
912 }
913}
void calc_gcarc() noexcept
Calculate great-circle arc-distance (gcarc).
Definition sac_format.cpp:945
bool geometry_set() const noexcept
Determine if locations are set for geometry calculation.
Definition sac_format.cpp:937
void calc_baz() noexcept
Calculate back-azimuth.
Definition sac_format.cpp:982
void calc_dist() noexcept
Calculate distance (using gcarc).
Definition sac_format.cpp:960
void calc_az() noexcept
Calculate azimuth.
Definition sac_format.cpp:971
Here is the call graph for this function:

◆ cmpaz() [1/2]

float sacfmt::Trace::cmpaz()const
noexcept
1068{ return floats[sac_map.at(name::cmpaz)]; }
Here is the caller graph for this function:

◆ cmpaz() [2/2]

void sacfmt::Trace::cmpaz(float input)
noexcept
1315 {
1316 floats[sac_map.at(name::cmpaz)] = input;
1317}

◆ cmpinc() [1/2]

float sacfmt::Trace::cmpinc()const
noexcept
1069 {
1070 return floats[sac_map.at(name::cmpinc)];
1071}
Here is the caller graph for this function:

◆ cmpinc() [2/2]

void sacfmt::Trace::cmpinc(float input)
noexcept
1318 {
1319 floats[sac_map.at(name::cmpinc)] = input;
1320}

◆ data1() [1/2]

std::vector< double > sacfmt::Trace::data1()const
noexcept
1208 {
1209 return data[sac_map.at(name::data1)];
1210}
std::array< std::vector< double >, num_data > data
std::vector<double> storage array.
Definition sac_format.hpp:1411
Here is the caller graph for this function:

◆ data1() [2/2]

void sacfmt::Trace::data1(const std::vector< double > & input)
noexcept
1596 {
1597 data[sac_map.at(name::data1)] = input;
1598 // Propagate change as needed
1599 int size{static_cast<int>(data1().size())};
1600 size = (((size == 0) && (npts() == unset_int)) ? unset_int : size);
1601 if (size != npts()) {
1602 npts(size);
1603 }
1604}
int npts() const noexcept
Definition sac_format.cpp:1121
std::vector< double > data1() const noexcept
Definition sac_format.cpp:1208

◆ data2() [1/2]

std::vector< double > sacfmt::Trace::data2()const
noexcept
1211 {
1212 return data[sac_map.at(name::data2)];
1213}
Here is the caller graph for this function:

◆ data2() [2/2]

void sacfmt::Trace::data2(const std::vector< double > & input)
noexcept
1606 {
1607 data[sac_map.at(name::data2)] = input;
1608 // Proagate change as needed
1609 int size{static_cast<int>(data2().size())};
1610 size = (((size == 0) && (npts() == unset_int)) ? unset_int : size);
1611 // Need to make sure this is legal
1612 // If positive size and not-legal, make spectral
1613 if (size > 0) {
1614 // If not legal, make spectral
1615 if (leven() && (iftype() <= 1)) {
1616 iftype(2);
1617 }
1618 // If legal and different from npts, update npts
1619 if ((!leven() || (iftype() > 1)) && (size != npts())) {
1620 npts(size);
1621 }
1622 }
1623}
int iftype() const noexcept
Definition sac_format.cpp:1126
std::vector< double > data2() const noexcept
Definition sac_format.cpp:1211
bool leven() const noexcept
Definition sac_format.cpp:1139

◆ date()

std::string sacfmt::Trace::date()const
noexcept

Get date string.

Returns
std::string Date (YYYY-JJJ).
991 {
992 // Require all to be set
993 if ((nzyear() == unset_int) || (nzjday() == unset_int)) {
994 return unset_word;
995 }
996 std::ostringstream oss{};
997 oss << nzyear();
998 oss << '-';
999 oss << nzjday();
1000 return oss.str();
1001}
int nzyear() const noexcept
Definition sac_format.cpp:1112
int nzjday() const noexcept
Definition sac_format.cpp:1113
Here is the call graph for this function:

◆ delta() [1/2]

double sacfmt::Trace::delta()const
noexcept
1085 {
1086 return doubles[sac_map.at(name::delta)];
1087}
Here is the caller graph for this function:

◆ delta() [2/2]

void sacfmt::Trace::delta(double input)
noexcept
1334 {
1335 doubles[sac_map.at(name::delta)] = input;
1336}

◆ depmax() [1/2]

float sacfmt::Trace::depmax()const
noexcept
1030 {
1031 return floats[sac_map.at(name::depmax)];
1032}
Here is the caller graph for this function:

◆ depmax() [2/2]

void sacfmt::Trace::depmax(float input)
noexcept
1219 {
1220 floats[sac_map.at(name::depmax)] = input;
1221}

◆ depmen() [1/2]

float sacfmt::Trace::depmen()const
noexcept
1065 {
1066 return floats[sac_map.at(name::depmen)];
1067}
Here is the caller graph for this function:

◆ depmen() [2/2]

void sacfmt::Trace::depmen(float input)
noexcept
1312 {
1313 floats[sac_map.at(name::depmen)] = input;
1314}

◆ depmin() [1/2]

float sacfmt::Trace::depmin()const
noexcept
1027 {
1028 return floats[sac_map.at(name::depmin)];
1029}
Here is the caller graph for this function:

◆ depmin() [2/2]

void sacfmt::Trace::depmin(float input)
noexcept
1216 {
1217 floats[sac_map.at(name::depmin)] = input;
1218}

◆ dist() [1/2]

float sacfmt::Trace::dist()const
noexcept
1061{ return floats[sac_map.at(name::dist)]; }
Here is the caller graph for this function:

◆ dist() [2/2]

void sacfmt::Trace::dist(float input)
noexcept
1300 {
1301 floats[sac_map.at(name::dist)] = input;
1302}

◆ e() [1/2]

double sacfmt::Trace::e()const
noexcept
1089{ return doubles[sac_map.at(name::e)]; }
Here is the caller graph for this function:

◆ e() [2/2]

void sacfmt::Trace::e(double input)
noexcept
1340 {
1341 doubles[sac_map.at(name::e)] = input;
1342}

◆ evdp() [1/2]

float sacfmt::Trace::evdp()const
noexcept
1049{ return floats[sac_map.at(name::evdp)]; }
Here is the caller graph for this function:

◆ evdp() [2/2]

void sacfmt::Trace::evdp(float input)
noexcept
1264 {
1265 floats[sac_map.at(name::evdp)] = input;
1266}

◆ evel() [1/2]

float sacfmt::Trace::evel()const
noexcept
1048{ return floats[sac_map.at(name::evel)]; }
Here is the caller graph for this function:

◆ evel() [2/2]

void sacfmt::Trace::evel(float input)
noexcept
1261 {
1262 floats[sac_map.at(name::evel)] = input;
1263}

◆ event_location()

point sacfmt::Trace::event_location()const
inlineprivatenoexcept

Return even location as a point.

1392 {
1393 return point{coord{evla(), true}, coord{evlo(), true}};
1394 }
double evlo() const noexcept
Definition sac_format.cpp:1106
double evla() const noexcept
Definition sac_format.cpp:1105
Here is the call graph for this function:
Here is the caller graph for this function:

◆ evla() [1/2]

double sacfmt::Trace::evla()const
noexcept
1105{ return doubles[sac_map.at(name::evla)]; }
Here is the caller graph for this function:

◆ evla() [2/2]

void sacfmt::Trace::evla(double input)
noexcept
1396 {
1397 double clean_input{input};
1398 if (clean_input != unset_double) {
1399 clean_input = limit_90(clean_input);
1400 }
1401 doubles[sac_map.at(name::evla)] = clean_input;
1402}
double limit_90(double degrees) noexcept
Takes a decimal degree value and constrains it to a quarter circle using symmetry.
Definition sac_format.cpp:840
Here is the call graph for this function:

◆ evlo() [1/2]

double sacfmt::Trace::evlo()const
noexcept
1106{ return doubles[sac_map.at(name::evlo)]; }
Here is the caller graph for this function:

◆ evlo() [2/2]

void sacfmt::Trace::evlo(double input)
noexcept
1403 {
1404 double clean_input{input};
1405 if (clean_input != unset_double) {
1406 clean_input = limit_180(clean_input);
1407 }
1408 doubles[sac_map.at(name::evlo)] = clean_input;
1409}
double limit_180(double degrees) noexcept
Takes a decimal degree value and constrains it to a half circle using symmetry.
Definition sac_format.cpp:820
Here is the call graph for this function:

◆ f() [1/2]

double sacfmt::Trace::f()const
noexcept
1102{ return doubles[sac_map.at(name::f)]; }
Here is the caller graph for this function:

◆ f() [2/2]

void sacfmt::Trace::f(double input)
noexcept
1379 {
1380 doubles[sac_map.at(name::f)] = input;
1381}

◆ frequency()

double sacfmt::Trace::frequency()const
noexcept

Calculate frequency from delta.

\[\color{orange}
f=\frac{1}{\delta}
\]

Returns
double Frequency.
924 {
925 const double delta_val{delta()};
926 if ((delta_val == unset_double) || (delta_val <= 0)) {
927 return unset_double;
928 }
929 return 1.0 / delta_val;
930}
double delta() const noexcept
Definition sac_format.cpp:1085
Here is the call graph for this function:

◆ gcarc() [1/2]

float sacfmt::Trace::gcarc()const
noexcept
1064{ return floats[sac_map.at(name::gcarc)]; }
Here is the caller graph for this function:

◆ gcarc() [2/2]

void sacfmt::Trace::gcarc(float input)
noexcept
1309 {
1310 floats[sac_map.at(name::gcarc)] = input;
1311}

◆ geometry_set()

bool sacfmt::Trace::geometry_set()const
privatenoexcept

Determine if locations are set for geometry calculation.

Returns
bool True if able to calculate geometry.
937 {
938 return (stla() != unset_double) && (stlo() != unset_double) &&
939 (evla() != unset_double) && (evlo() != unset_double);
940}
double stlo() const noexcept
Definition sac_format.cpp:1104
double stla() const noexcept
Definition sac_format.cpp:1103
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ibody() [1/2]

int sacfmt::Trace::ibody()const
noexcept
1137{ return ints[sac_map.at(name::ibody)]; }
Here is the caller graph for this function:

◆ ibody() [2/2]

void sacfmt::Trace::ibody(int input)
noexcept
1502 {
1503 ints[sac_map.at(name::ibody)] = input;
1504}

◆ idep() [1/2]

int sacfmt::Trace::idep()const
noexcept
1127{ return ints[sac_map.at(name::idep)]; }
Here is the caller graph for this function:

◆ idep() [2/2]

void sacfmt::Trace::idep(int input)
noexcept
1472 {
1473 ints[sac_map.at(name::idep)] = input;
1474}

◆ ievreg() [1/2]

int sacfmt::Trace::ievreg()const
noexcept
1131{ return ints[sac_map.at(name::ievreg)]; }
Here is the caller graph for this function:

◆ ievreg() [2/2]

void sacfmt::Trace::ievreg(int input)
noexcept
1484 {
1485 ints[sac_map.at(name::ievreg)] = input;
1486}

◆ ievtyp() [1/2]

int sacfmt::Trace::ievtyp()const
noexcept
1132{ return ints[sac_map.at(name::ievtyp)]; }
Here is the caller graph for this function:

◆ ievtyp() [2/2]

void sacfmt::Trace::ievtyp(int input)
noexcept
1487 {
1488 ints[sac_map.at(name::ievtyp)] = input;
1489}

◆ iftype() [1/2]

int sacfmt::Trace::iftype()const
noexcept
1126{ return ints[sac_map.at(name::iftype)]; }
Here is the caller graph for this function:

◆ iftype() [2/2]

void sacfmt::Trace::iftype(int input)
noexcept
1463 {
1464 ints[sac_map.at(name::iftype)] = input;
1465 const size_t size{npts() >= 0 ? static_cast<size_t>(npts()) : 0};
1466 // Uneven 2D data not supported as not in specification
1467 if ((input > 1) && !leven()) {
1468 leven(true);
1469 }
1470 resize_data2(size);
1471}
void resize_data2(size_t size) noexcept
Definition sac_format.cpp:1633

◆ iinst() [1/2]

int sacfmt::Trace::iinst()const
noexcept
1129{ return ints[sac_map.at(name::iinst)]; }
Here is the caller graph for this function:

◆ iinst() [2/2]

void sacfmt::Trace::iinst(int input)
noexcept
1478 {
1479 ints[sac_map.at(name::iinst)] = input;
1480}

◆ imagsrc() [1/2]

int sacfmt::Trace::imagsrc()const
noexcept
1136{ return ints[sac_map.at(name::imagsrc)]; }
Here is the caller graph for this function:

◆ imagsrc() [2/2]

void sacfmt::Trace::imagsrc(int input)
noexcept
1499 {
1500 ints[sac_map.at(name::imagsrc)] = input;
1501}

◆ imagtyp() [1/2]

int sacfmt::Trace::imagtyp()const
noexcept
1135{ return ints[sac_map.at(name::imagtyp)]; }
Here is the caller graph for this function:

◆ imagtyp() [2/2]

void sacfmt::Trace::imagtyp(int input)
noexcept
1496 {
1497 ints[sac_map.at(name::imagtyp)] = input;
1498}

◆ iqual() [1/2]

int sacfmt::Trace::iqual()const
noexcept
1133{ return ints[sac_map.at(name::iqual)]; }
Here is the caller graph for this function:

◆ iqual() [2/2]

void sacfmt::Trace::iqual(int input)
noexcept
1490 {
1491 ints[sac_map.at(name::iqual)] = input;
1492}

◆ istreg() [1/2]

int sacfmt::Trace::istreg()const
noexcept
1130{ return ints[sac_map.at(name::istreg)]; }
Here is the caller graph for this function:

◆ istreg() [2/2]

void sacfmt::Trace::istreg(int input)
noexcept
1481 {
1482 ints[sac_map.at(name::istreg)] = input;
1483}

◆ isynth() [1/2]

int sacfmt::Trace::isynth()const
noexcept
1134{ return ints[sac_map.at(name::isynth)]; }
Here is the caller graph for this function:

◆ isynth() [2/2]

void sacfmt::Trace::isynth(int input)
noexcept
1493 {
1494 ints[sac_map.at(name::isynth)] = input;
1495}

◆ iztype() [1/2]

int sacfmt::Trace::iztype()const
noexcept
1128{ return ints[sac_map.at(name::iztype)]; }
Here is the caller graph for this function:

◆ iztype() [2/2]

void sacfmt::Trace::iztype(int input)
noexcept
1475 {
1476 ints[sac_map.at(name::iztype)] = input;
1477}

◆ ka() [1/2]

std::string sacfmt::Trace::ka()const
noexcept
1154{ return strings[sac_map.at(name::ka)]; }
Here is the caller graph for this function:

◆ ka() [2/2]

void sacfmt::Trace::ka(const std::string & input)
noexcept
1537 {
1538 strings[sac_map.at(name::ka)] = input;
1539}

◆ kcmpnm() [1/2]

std::string sacfmt::Trace::kcmpnm()const
noexcept
1195 {
1196 return strings[sac_map.at(name::kcmpnm)];
1197}
Here is the caller graph for this function:

◆ kcmpnm() [2/2]

void sacfmt::Trace::kcmpnm(const std::string & input)
noexcept
1582 {
1583 strings[sac_map.at(name::kcmpnm)] = input;
1584}

◆ kdatrd() [1/2]

std::string sacfmt::Trace::kdatrd()const
noexcept
1201 {
1202 return strings[sac_map.at(name::kdatrd)];
1203}
Here is the caller graph for this function:

◆ kdatrd() [2/2]

void sacfmt::Trace::kdatrd(const std::string & input)
noexcept
1588 {
1589 strings[sac_map.at(name::kdatrd)] = input;
1590}

◆ kevnm() [1/2]

std::string sacfmt::Trace::kevnm()const
noexcept
1147 {
1148 return strings[sac_map.at(name::kevnm)];
1149}
Here is the caller graph for this function:

◆ kevnm() [2/2]

void sacfmt::Trace::kevnm(const std::string & input)
noexcept
1528 {
1529 strings[sac_map.at(name::kevnm)] = input;
1530}

◆ kf() [1/2]

std::string sacfmt::Trace::kf()const
noexcept
1185{ return strings[sac_map.at(name::kf)]; }
Here is the caller graph for this function:

◆ kf() [2/2]

void sacfmt::Trace::kf(const std::string & input)
noexcept
1570 {
1571 strings[sac_map.at(name::kf)] = input;
1572}

◆ khole() [1/2]

std::string sacfmt::Trace::khole()const
noexcept
1150 {
1151 return strings[sac_map.at(name::khole)];
1152}
Here is the caller graph for this function:

◆ khole() [2/2]

void sacfmt::Trace::khole(const std::string & input)
noexcept
1531 {
1532 strings[sac_map.at(name::khole)] = input;
1533}

◆ kinst() [1/2]

std::string sacfmt::Trace::kinst()const
noexcept
1204 {
1205 return strings[sac_map.at(name::kinst)];
1206}
Here is the caller graph for this function:

◆ kinst() [2/2]

void sacfmt::Trace::kinst(const std::string & input)
noexcept
1591 {
1592 strings[sac_map.at(name::kinst)] = input;
1593}

◆ knetwk() [1/2]

std::string sacfmt::Trace::knetwk()const
noexcept
1198 {
1199 return strings[sac_map.at(name::knetwk)];
1200}
Here is the caller graph for this function:

◆ knetwk() [2/2]

void sacfmt::Trace::knetwk(const std::string & input)
noexcept
1585 {
1586 strings[sac_map.at(name::knetwk)] = input;
1587}

◆ ko() [1/2]

std::string sacfmt::Trace::ko()const
noexcept
1153{ return strings[sac_map.at(name::ko)]; }
Here is the caller graph for this function:

◆ ko() [2/2]

void sacfmt::Trace::ko(const std::string & input)
noexcept
1534 {
1535 strings[sac_map.at(name::ko)] = input;
1536}

◆ kstnm() [1/2]

std::string sacfmt::Trace::kstnm()const
noexcept
1144 {
1145 return strings[sac_map.at(name::kstnm)];
1146}
Here is the caller graph for this function:

◆ kstnm() [2/2]

void sacfmt::Trace::kstnm(const std::string & input)
noexcept
1525 {
1526 strings[sac_map.at(name::kstnm)] = input;
1527}

◆ kt0() [1/2]

std::string sacfmt::Trace::kt0()const
noexcept
1155 {
1156 return strings[sac_map.at(name::kt0)];
1157}
Here is the caller graph for this function:

◆ kt0() [2/2]

void sacfmt::Trace::kt0(const std::string & input)
noexcept
1540 {
1541 strings[sac_map.at(name::kt0)] = input;
1542}

◆ kt1() [1/2]

std::string sacfmt::Trace::kt1()const
noexcept
1158 {
1159 return strings[sac_map.at(name::kt1)];
1160}
@ kt1
See kt0, pre-data words 124–125.
Here is the caller graph for this function:

◆ kt1() [2/2]

void sacfmt::Trace::kt1(const std::string & input)
noexcept
1543 {
1544 strings[sac_map.at(name::kt1)] = input;
1545}

◆ kt2() [1/2]

std::string sacfmt::Trace::kt2()const
noexcept
1161 {
1162 return strings[sac_map.at(name::kt2)];
1163}
@ kt2
See kt0, pre-data words 126–127.
Here is the caller graph for this function:

◆ kt2() [2/2]

void sacfmt::Trace::kt2(const std::string & input)
noexcept
1546 {
1547 strings[sac_map.at(name::kt2)] = input;
1548}

◆ kt3() [1/2]

std::string sacfmt::Trace::kt3()const
noexcept
1164 {
1165 return strings[sac_map.at(name::kt3)];
1166}
@ kt3
See kt0, pre-data words 128–129.
Here is the caller graph for this function:

◆ kt3() [2/2]

void sacfmt::Trace::kt3(const std::string & input)
noexcept
1549 {
1550 strings[sac_map.at(name::kt3)] = input;
1551}

◆ kt4() [1/2]

std::string sacfmt::Trace::kt4()const
noexcept
1167 {
1168 return strings[sac_map.at(name::kt4)];
1169}
@ kt4
See kt0, pre-data words 130–131.
Here is the caller graph for this function:

◆ kt4() [2/2]

void sacfmt::Trace::kt4(const std::string & input)
noexcept
1552 {
1553 strings[sac_map.at(name::kt4)] = input;
1554}

◆ kt5() [1/2]

std::string sacfmt::Trace::kt5()const
noexcept
1170 {
1171 return strings[sac_map.at(name::kt5)];
1172}
@ kt5
See kt0, pre-data words 132–133.
Here is the caller graph for this function:

◆ kt5() [2/2]

void sacfmt::Trace::kt5(const std::string & input)
noexcept
1555 {
1556 strings[sac_map.at(name::kt5)] = input;
1557}

◆ kt6() [1/2]

std::string sacfmt::Trace::kt6()const
noexcept
1173 {
1174 return strings[sac_map.at(name::kt6)];
1175}
@ kt6
See kt0, pre-data words 134–135.
Here is the caller graph for this function:

◆ kt6() [2/2]

void sacfmt::Trace::kt6(const std::string & input)
noexcept
1558 {
1559 strings[sac_map.at(name::kt6)] = input;
1560}

◆ kt7() [1/2]

std::string sacfmt::Trace::kt7()const
noexcept
1176 {
1177 return strings[sac_map.at(name::kt7)];
1178}
@ kt7
See kt0, pre-data words 136–137.
Here is the caller graph for this function:

◆ kt7() [2/2]

void sacfmt::Trace::kt7(const std::string & input)
noexcept
1561 {
1562 strings[sac_map.at(name::kt7)] = input;
1563}

◆ kt8() [1/2]

std::string sacfmt::Trace::kt8()const
noexcept
1179 {
1180 return strings[sac_map.at(name::kt8)];
1181}
@ kt8
See kt0, pre-data words 138–139.
Here is the caller graph for this function:

◆ kt8() [2/2]

void sacfmt::Trace::kt8(const std::string & input)
noexcept
1564 {
1565 strings[sac_map.at(name::kt8)] = input;
1566}

◆ kt9() [1/2]

std::string sacfmt::Trace::kt9()const
noexcept
1182 {
1183 return strings[sac_map.at(name::kt9)];
1184}
@ kt9
See kt0, pre-data words 140–141.
Here is the caller graph for this function:

◆ kt9() [2/2]

void sacfmt::Trace::kt9(const std::string & input)
noexcept
1567 {
1568 strings[sac_map.at(name::kt9)] = input;
1569}

◆ kuser0() [1/2]

std::string sacfmt::Trace::kuser0()const
noexcept
1186 {
1187 return strings[sac_map.at(name::kuser0)];
1188}
Here is the caller graph for this function:

◆ kuser0() [2/2]

void sacfmt::Trace::kuser0(const std::string & input)
noexcept
1573 {
1574 strings[sac_map.at(name::kuser0)] = input;
1575}

◆ kuser1() [1/2]

std::string sacfmt::Trace::kuser1()const
noexcept
1189 {
1190 return strings[sac_map.at(name::kuser1)];
1191}
@ kuser1
See kuser0, pre-data words 146–147.
Here is the caller graph for this function:

◆ kuser1() [2/2]

void sacfmt::Trace::kuser1(const std::string & input)
noexcept
1576 {
1577 strings[sac_map.at(name::kuser1)] = input;
1578}

◆ kuser2() [1/2]

std::string sacfmt::Trace::kuser2()const
noexcept
1192 {
1193 return strings[sac_map.at(name::kuser2)];
1194}
@ kuser2
See kuser0, pre-data words 148–149.
Here is the caller graph for this function:

◆ kuser2() [2/2]

void sacfmt::Trace::kuser2(const std::string & input)
noexcept
1579 {
1580 strings[sac_map.at(name::kuser2)] = input;
1581}

◆ lcalda() [1/2]

bool sacfmt::Trace::lcalda()const
noexcept
1142{ return bools[sac_map.at(name::lcalda)]; }
Here is the caller graph for this function:

◆ lcalda() [2/2]

void sacfmt::Trace::lcalda(bool input)
noexcept
1521 {
1522 bools[sac_map.at(name::lcalda)] = input;
1523}

◆ legacy_write()

void sacfmt::Trace::legacy_write(const std::filesystem::path & path)const

Binary SAC-file legacy-write convenience function.

Parameters
[in]pathstd::filesystem::path SAC-file to be written.
Exceptions
io_errorIf the file cannot be written (bad path or bad permissions).
std::execptionOther unwritable issues (not enough space, disk failure, etc.).
2718 {
2719 write(path, true);
2720}
void write(const std::filesystem::path &path, bool legacy=false) const
Binary SAC-file writer.
Definition sac_format.cpp:2686
Here is the call graph for this function:

◆ leven() [1/2]

bool sacfmt::Trace::leven()const
noexcept
1139{ return bools[sac_map.at(name::leven)]; }
Here is the caller graph for this function:

◆ leven() [2/2]

void sacfmt::Trace::leven(bool input)
noexcept
1506 {
1507 bools[sac_map.at(name::leven)] = input;
1508 const size_t size{npts() >= 0 ? static_cast<size_t>(npts()) : 0};
1509 // Uneven 2D data not supported since not in specification
1510 if (!input && (iftype() > 1)) {
1512 }
1513 resize_data2(size);
1514}

◆ lovrok() [1/2]

bool sacfmt::Trace::lovrok()const
noexcept
1141{ return bools[sac_map.at(name::lovrok)]; }
Here is the caller graph for this function:

◆ lovrok() [2/2]

void sacfmt::Trace::lovrok(bool input)
noexcept
1518 {
1519 bools[sac_map.at(name::lovrok)] = input;
1520}

◆ lpspol() [1/2]

bool sacfmt::Trace::lpspol()const
noexcept
1140{ return bools[sac_map.at(name::lpspol)]; }
Here is the caller graph for this function:

◆ lpspol() [2/2]

void sacfmt::Trace::lpspol(bool input)
noexcept
1515 {
1516 bools[sac_map.at(name::lpspol)] = input;
1517}

◆ mag() [1/2]

float sacfmt::Trace::mag()const
noexcept
1050{ return floats[sac_map.at(name::mag)]; }
Here is the caller graph for this function:

◆ mag() [2/2]

void sacfmt::Trace::mag(float input)
noexcept
1267 {
1268 floats[sac_map.at(name::mag)] = input;
1269}

◆ nevid() [1/2]

int sacfmt::Trace::nevid()const
noexcept
1120{ return ints[sac_map.at(name::nevid)]; }
Here is the caller graph for this function:

◆ nevid() [2/2]

void sacfmt::Trace::nevid(int input)
noexcept
1441 {
1442 ints[sac_map.at(name::nevid)] = input;
1443}

◆ norid() [1/2]

int sacfmt::Trace::norid()const
noexcept
1119{ return ints[sac_map.at(name::norid)]; }
Here is the caller graph for this function:

◆ norid() [2/2]

void sacfmt::Trace::norid(int input)
noexcept
1438 {
1439 ints[sac_map.at(name::norid)] = input;
1440}

◆ npts() [1/2]

int sacfmt::Trace::npts()const
noexcept
1121{ return ints[sac_map.at(name::npts)]; }
Here is the caller graph for this function:

◆ npts() [2/2]

void sacfmt::Trace::npts(int input)
noexcept
1444 {
1445 if ((input >= 0) || (input == unset_int)) {
1446 ints[sac_map.at(name::npts)] = input;
1447 const size_t size{static_cast<size_t>(input >= 0 ? input : 0)};
1448 resize_data(size);
1449 }
1450}
void resize_data(size_t size) noexcept
Resize data vectors (only if eligible).
Definition sac_format.cpp:1654

◆ nsnpts() [1/2]

int sacfmt::Trace::nsnpts()const
noexcept
1122{ return ints[sac_map.at(name::nsnpts)]; }
Here is the caller graph for this function:

◆ nsnpts() [2/2]

void sacfmt::Trace::nsnpts(int input)
noexcept
1451 {
1452 ints[sac_map.at(name::nsnpts)] = input;
1453}

◆ nvhdr() [1/2]

int sacfmt::Trace::nvhdr()const
noexcept
1118{ return ints[sac_map.at(name::nvhdr)]; }
Here is the caller graph for this function:

◆ nvhdr() [2/2]

void sacfmt::Trace::nvhdr(int input)
noexcept
1435 {
1436 ints[sac_map.at(name::nvhdr)] = input;
1437}

◆ nwfid() [1/2]

int sacfmt::Trace::nwfid()const
noexcept
1123{ return ints[sac_map.at(name::nwfid)]; }
Here is the caller graph for this function:

◆ nwfid() [2/2]

void sacfmt::Trace::nwfid(int input)
noexcept
1454 {
1455 ints[sac_map.at(name::nwfid)] = input;
1456}

◆ nxsize() [1/2]

int sacfmt::Trace::nxsize()const
noexcept
1124{ return ints[sac_map.at(name::nxsize)]; }
Here is the caller graph for this function:

◆ nxsize() [2/2]

void sacfmt::Trace::nxsize(int input)
noexcept
1457 {
1458 ints[sac_map.at(name::nxsize)] = input;
1459}

◆ nysize() [1/2]

int sacfmt::Trace::nysize()const
noexcept
1125{ return ints[sac_map.at(name::nysize)]; }
Here is the caller graph for this function:

◆ nysize() [2/2]

void sacfmt::Trace::nysize(int input)
noexcept
1460 {
1461 ints[sac_map.at(name::nysize)] = input;
1462}

◆ nzhour() [1/2]

int sacfmt::Trace::nzhour()const
noexcept
1114{ return ints[sac_map.at(name::nzhour)]; }
Here is the caller graph for this function:

◆ nzhour() [2/2]

void sacfmt::Trace::nzhour(int input)
noexcept
1423 {
1424 ints[sac_map.at(name::nzhour)] = input;
1425}

◆ nzjday() [1/2]

int sacfmt::Trace::nzjday()const
noexcept
1113{ return ints[sac_map.at(name::nzjday)]; }
Here is the caller graph for this function:

◆ nzjday() [2/2]

void sacfmt::Trace::nzjday(int input)
noexcept
1420 {
1421 ints[sac_map.at(name::nzjday)] = input;
1422}

◆ nzmin() [1/2]

int sacfmt::Trace::nzmin()const
noexcept
1115{ return ints[sac_map.at(name::nzmin)]; }
Here is the caller graph for this function:

◆ nzmin() [2/2]

void sacfmt::Trace::nzmin(int input)
noexcept
1426 {
1427 ints[sac_map.at(name::nzmin)] = input;
1428}

◆ nzmsec() [1/2]

int sacfmt::Trace::nzmsec()const
noexcept
1117{ return ints[sac_map.at(name::nzmsec)]; }
Here is the caller graph for this function:

◆ nzmsec() [2/2]

void sacfmt::Trace::nzmsec(int input)
noexcept
1432 {
1433 ints[sac_map.at(name::nzmsec)] = input;
1434}

◆ nzsec() [1/2]

int sacfmt::Trace::nzsec()const
noexcept
1116{ return ints[sac_map.at(name::nzsec)]; }
Here is the caller graph for this function:

◆ nzsec() [2/2]

void sacfmt::Trace::nzsec(int input)
noexcept
1429 {
1430 ints[sac_map.at(name::nzsec)] = input;
1431}

◆ nzyear() [1/2]

int sacfmt::Trace::nzyear()const
noexcept
1112{ return ints[sac_map.at(name::nzyear)]; }
Here is the caller graph for this function:

◆ nzyear() [2/2]

void sacfmt::Trace::nzyear(int input)
noexcept
1417 {
1418 ints[sac_map.at(name::nzyear)] = input;
1419}

◆ o() [1/2]

double sacfmt::Trace::o()const
noexcept
1090{ return doubles[sac_map.at(name::o)]; }
Here is the caller graph for this function:

◆ o() [2/2]

void sacfmt::Trace::o(double input)
noexcept
1343 {
1344 doubles[sac_map.at(name::o)] = input;
1345}

◆ odelta() [1/2]

float sacfmt::Trace::odelta()const
noexcept
1033 {
1034 return floats[sac_map.at(name::odelta)];
1035}
Here is the caller graph for this function:

◆ odelta() [2/2]

void sacfmt::Trace::odelta(float input)
noexcept
1222 {
1223 floats[sac_map.at(name::odelta)] = input;
1224}

◆ operator==()

bool sacfmt::Trace::operator==(const Traceother)const
noexcept

Trace equality operator.

Parameters
[in]thisFirst Trace in comparison (LHS).
[in]otherSecond Trace in comparison (RHS).
Returns
bool Truth value of equality.
876 {
877 if (floats != other.floats) {
878 return false;
879 }
880 if (doubles != other.doubles) {
881 return false;
882 }
883 if (ints != other.ints) {
884 return false;
885 }
886 if (strings != other.strings) {
887 return false;
888 }
889 if (!equal_within_tolerance(data[0], other.data[0])) {
890 return false;
891 }
892 if (!equal_within_tolerance(data[1], other.data[1])) {
893 return false;
894 }
895 return true;
896}
bool equal_within_tolerance(const std::vector< double > &vector1, const std::vector< double > &vector2, double tolerance=f_eps) noexcept
Check if two std::vector<double> are equal within a tolerance limit.
Definition sac_format.cpp:620
Here is the call graph for this function:

◆ read_bool_headers()

void sacfmt::Trace::read_bool_headers(std::ifstream * sac_file)
private

Reads SAC-headers from words 105–109.

Note that this expects the position of the reader to be the beginning of word 105.

Note that this modifies the position of the reader to the end of word 109.

Loads all boolean headers.

Parameters
[in,out]sac_filestd::ifstream* SAC-file to be read.
2062 {
2063 // Logical headers
2064 leven(binary_to_bool(read_word(sac_file))); // 105
2065 lpspol(binary_to_bool(read_word(sac_file))); // 106
2066 lovrok(binary_to_bool(read_word(sac_file))); // 107
2067 lcalda(binary_to_bool(read_word(sac_file))); // 108
2068 // Skip 'unused'
2069 read_word(sac_file); // 109
2070}
bool lpspol() const noexcept
Definition sac_format.cpp:1140
bool lovrok() const noexcept
Definition sac_format.cpp:1141
bool lcalda() const noexcept
Definition sac_format.cpp:1142
word_one read_word(std::ifstream *sac)
Read one word (32 bits, useful for non-strings) from a binary SAC-File.
Definition sac_format.cpp:407
bool binary_to_bool(const word_one &flag) noexcept
Convert a 32-bit (one word) binary bitset to a boolean.
Definition sac_format.cpp:357
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_datas()

void sacfmt::Trace::read_datas(std::ifstream * sac_file)
private

Reads data vectors.

Note that this modifies the position of the reader to the end of the data section(s).

For data1 reads words 158–(158 + npts).

For data2 reads words (158 + 1 + npts)–(159 + (2 * npts))

Parameters
[in,out]sac_filestd::ifstream* SAC-file to be read.
2125 {
2126 const bool is_data{npts() != unset_int};
2127 // data1
2128 const size_t n_words{static_cast<size_t>(npts())};
2129 if (is_data) {
2130 // false flags for data1
2131 safe_to_read_data(sac_file, n_words, false); // throws io_error if unsafe
2132 const read_spec spec{n_words, data_word};
2133 // Originally floats, read as doubles
2134 data1(read_data(sac_file, spec));
2135 }
2136 // data2 (uneven or spectral data)
2137 if (is_data && (!leven() || (iftype() > 1))) {
2138 // true flags for data2
2139 safe_to_read_data(sac_file, n_words, true); // throws io_error if unsafe
2140 const read_spec spec{n_words, data_word + static_cast<size_t>(npts())};
2141 data2(read_data(sac_file, spec));
2142 }
2143}
std::vector< double > read_data(std::ifstream *sac, const read_spec &spec)
Reader arbitrary number of words (useful for vectors) from a binary SAC-file.
Definition sac_format.cpp:487
constexpr std::streamoff data_word
First word of (first) data-section (stream offset).
Definition sac_format.hpp:68
void safe_to_read_data(std::ifstream *sac, size_t n_words, bool data2=false)
Determines if the SAC-file has enough space remaining to contain a complete data vector.
Definition sac_format.cpp:1729
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_float_headers()

void sacfmt::Trace::read_float_headers(std::ifstream * sac_file)
private

Reads SAC-headers from words 000–069.

Note that this expects the position of the reader to be the beginning of word 000.

Note that this modifies the position of the reader to the end of word 069.

Loads all the float headers.

Parameters
[in,out]sac_filestd::ifstream* SAC-file to be read.
1957 {
1958 read_float_headers_starter(sac_file); // 000-009
1959 read_float_headers_t(sac_file); // 010-020
1960 read_float_headers_resp(sac_file); // 021-030
1961 read_float_headers_station_event(sac_file); // 031-039
1962 read_float_headers_user(sac_file); // 040-049
1963 read_float_headers_geometry(sac_file); // 050-053
1964 read_float_headers_meta(sac_file); // 054-069
1965}
void read_float_headers_meta(std::ifstream *sac_file)
Reads SAC-headers from words 054–069.
Definition sac_format.cpp:1929
void read_float_headers_resp(std::ifstream *sac_file)
Reads SAC-headers from words 021–030.
Definition sac_format.cpp:1832
void read_float_headers_station_event(std::ifstream *sac_file)
Reads SAC-headers from words 031–039.
Definition sac_format.cpp:1857
void read_float_headers_geometry(std::ifstream *sac_file)
Reads SAC-headers from words 050–053.
Definition sac_format.cpp:1909
void read_float_headers_starter(std::ifstream *sac_file)
Reads SAC-headers from words 000–009.
Definition sac_format.cpp:1778
void read_float_headers_user(std::ifstream *sac_file)
Reads SAC-headers from words 040–049.
Definition sac_format.cpp:1884
void read_float_headers_t(std::ifstream *sac_file)
Reads SAC-headers from words 010–020.
Definition sac_format.cpp:1805
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_float_headers_geometry()

void sacfmt::Trace::read_float_headers_geometry(std::ifstream * sac_file)
private

Reads SAC-headers from words 050–053.

Note that this expects the position of the reader to be the beginning of word 050.

Note that this modifies the position of the reader to the end of word 053.

Headers loaded: dist, az, baz, and gcarc.

Parameters
[in,out]sac_filestd::ifstream* SAC-file to be read.
1909 {
1910 dist(binary_to_float(read_word(sac_file))); // 050
1911 az(binary_to_float(read_word(sac_file))); // 051
1912 baz(binary_to_float(read_word(sac_file))); // 052
1913 gcarc(binary_to_float(read_word(sac_file))); // 053
1914}
float binary_to_float(const word_one &bin) noexcept
Convert 32-bit (one word) binary bitset to a floating-point value.
Definition sac_format.cpp:127
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_float_headers_meta()

void sacfmt::Trace::read_float_headers_meta(std::ifstream * sac_file)
private

Reads SAC-headers from words 054–069.

Note that this expects the position of the reader to be the beginning of word 054.

Note that this modifies the position of the reader to the end of word 069.

Headers loaded: sb, sdelta, depmen, cmpaz, cmpinc, xminimum, xmaximum, yminimum, and ymaximum.

Parameters
[in,out]sac_filestd::ifstream* SAC-file to be read.
1929 {
1930 sb(binary_to_float(read_word(sac_file))); // 054
1931 sdelta(binary_to_float(read_word(sac_file))); // 055
1932 depmen(binary_to_float(read_word(sac_file))); // 056
1933 cmpaz(binary_to_float(read_word(sac_file))); // 057
1934 cmpinc(binary_to_float(read_word(sac_file))); // 058
1935 xminimum(binary_to_float(read_word(sac_file))); // 059
1936 xmaximum(binary_to_float(read_word(sac_file))); // 060
1937 yminimum(binary_to_float(read_word(sac_file))); // 061
1938 ymaximum(binary_to_float(read_word(sac_file))); // 062
1939 // Skip 'unused' (xcommon_skip_num)
1940 for (int i{0}; i < common_skip_num; ++i) { // 063--069
1941 read_word(sac_file);
1942 }
1943}
float yminimum() const noexcept
Definition sac_format.cpp:1078
double sdelta() const noexcept
Definition sac_format.cpp:1108
float xminimum() const noexcept
Definition sac_format.cpp:1072
double sb() const noexcept
Definition sac_format.cpp:1107
float cmpaz() const noexcept
Definition sac_format.cpp:1068
float cmpinc() const noexcept
Definition sac_format.cpp:1069
float depmen() const noexcept
Definition sac_format.cpp:1065
float ymaximum() const noexcept
Definition sac_format.cpp:1081
float xmaximum() const noexcept
Definition sac_format.cpp:1075
constexpr int common_skip_num
Extremely common number of 'internal use' headers in SAC format.
Definition sac_format.hpp:110
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_float_headers_resp()

void sacfmt::Trace::read_float_headers_resp(std::ifstream * sac_file)
private

Reads SAC-headers from words 021–030.

Note that this expects the position of the reader to be the beginning of word 021.

Note that this modifies the position of the reader to the end of word 030.

Headers loaded: resp0, resp1, resp2, resp3, resp4, resp5, resp6, resp7, resp8, and resp9.

Parameters
[in,out]sac_filestd::ifstream* SAC-file to be read.
1832 {
1833 resp0(binary_to_float(read_word(sac_file))); // 021
1834 resp1(binary_to_float(read_word(sac_file))); // 022
1835 resp2(binary_to_float(read_word(sac_file))); // 023
1836 resp3(binary_to_float(read_word(sac_file))); // 024
1837 resp4(binary_to_float(read_word(sac_file))); // 025
1838 resp5(binary_to_float(read_word(sac_file))); // 026
1839 resp6(binary_to_float(read_word(sac_file))); // 027
1840 resp7(binary_to_float(read_word(sac_file))); // 028
1841 resp8(binary_to_float(read_word(sac_file))); // 029
1842 resp9(binary_to_float(read_word(sac_file))); // 030
1843}
float resp7() const noexcept
Definition sac_format.cpp:1043
float resp0() const noexcept
Definition sac_format.cpp:1036
float resp5() const noexcept
Definition sac_format.cpp:1041
float resp2() const noexcept
Definition sac_format.cpp:1038
float resp3() const noexcept
Definition sac_format.cpp:1039
float resp1() const noexcept
Definition sac_format.cpp:1037
float resp9() const noexcept
Definition sac_format.cpp:1045
float resp4() const noexcept
Definition sac_format.cpp:1040
float resp6() const noexcept
Definition sac_format.cpp:1042
float resp8() const noexcept
Definition sac_format.cpp:1044
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_float_headers_starter()

void sacfmt::Trace::read_float_headers_starter(std::ifstream * sac_file)
private

Reads SAC-headers from words 000–009.

Note that this expects the position of the reader to be the beginning of word 000.

Note that this modifies the position of the reader to the end of word 009.

Headers loaded: delta, depmin, depmax, odelta, b, e, o, and a.

Parameters
[in,out]sac_filestd::ifstream* SAC-file to be read.
1778 {
1779 delta(binary_to_float(read_word(sac_file))); // 000
1780 depmin(binary_to_float(read_word(sac_file))); // 001
1781 depmax(binary_to_float(read_word(sac_file))); // 002
1782 // Skip 'unused'
1783 read_word(sac_file); // 003
1784 odelta(binary_to_float(read_word(sac_file))); // 004
1785 b(binary_to_float(read_word(sac_file))); // 005
1786 e(binary_to_float(read_word(sac_file))); // 006
1787 o(binary_to_float(read_word(sac_file))); // 007
1788 a(binary_to_float(read_word(sac_file))); // 008
1789 // Skip 'internal'
1790 read_word(sac_file); // 009
1791}
float depmin() const noexcept
Definition sac_format.cpp:1027
float odelta() const noexcept
Definition sac_format.cpp:1033
float depmax() const noexcept
Definition sac_format.cpp:1030
double b() const noexcept
Definition sac_format.cpp:1088
double a() const noexcept
Definition sac_format.cpp:1091
double e() const noexcept
Definition sac_format.cpp:1089
double o() const noexcept
Definition sac_format.cpp:1090
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_float_headers_station_event()

void sacfmt::Trace::read_float_headers_station_event(std::ifstream * sac_file)
private

Reads SAC-headers from words 031–039.

Note that this expects the position of the reader to be the beginning of word 031.

Note that this modifies the position of the reader to the end of word 039.

Headers loaded: stla, stlo, stel, stdp, evla, evlo, evel, evdp, and mag.

Parameters
[in,out]sac_filestd::ifstream* SAC-file to be read.
1857 {
1858 // Station headers
1859 stla(binary_to_float(read_word(sac_file))); // 031
1860 stlo(binary_to_float(read_word(sac_file))); // 032
1861 stel(binary_to_float(read_word(sac_file))); // 033
1862 stdp(binary_to_float(read_word(sac_file))); // 034
1863 // Event headers
1864 evla(binary_to_float(read_word(sac_file))); // 035
1865 evlo(binary_to_float(read_word(sac_file))); // 036
1866 evel(binary_to_float(read_word(sac_file))); // 037
1867 evdp(binary_to_float(read_word(sac_file))); // 038
1868 mag(binary_to_float(read_word(sac_file))); // 039
1869}
float mag() const noexcept
Definition sac_format.cpp:1050
float stel() const noexcept
Definition sac_format.cpp:1046
float evdp() const noexcept
Definition sac_format.cpp:1049
float evel() const noexcept
Definition sac_format.cpp:1048
float stdp() const noexcept
Definition sac_format.cpp:1047
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_float_headers_t()

void sacfmt::Trace::read_float_headers_t(std::ifstream * sac_file)
private

Reads SAC-headers from words 010–020.

Note that this expects the position of the reader to be the beginning of word 010.

Note that this modifies the position of the reader to the end of word 020.

Headers loaded: t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, and f.

Parameters
[in,out]sac_filestd::ifstream* SAC-file to be read.
1805 {
1806 t0(binary_to_float(read_word(sac_file))); // 010
1807 t1(binary_to_float(read_word(sac_file))); // 011
1808 t2(binary_to_float(read_word(sac_file))); // 012
1809 t3(binary_to_float(read_word(sac_file))); // 013
1810 t4(binary_to_float(read_word(sac_file))); // 014
1811 t5(binary_to_float(read_word(sac_file))); // 015
1812 t6(binary_to_float(read_word(sac_file))); // 016
1813 t7(binary_to_float(read_word(sac_file))); // 017
1814 t8(binary_to_float(read_word(sac_file))); // 018
1815 t9(binary_to_float(read_word(sac_file))); // 019
1816 f(binary_to_float(read_word(sac_file))); // 020
1817}
double t2() const noexcept
Definition sac_format.cpp:1094
double t0() const noexcept
Definition sac_format.cpp:1092
double t3() const noexcept
Definition sac_format.cpp:1095
double t4() const noexcept
Definition sac_format.cpp:1096
double t5() const noexcept
Definition sac_format.cpp:1097
double t8() const noexcept
Definition sac_format.cpp:1100
double f() const noexcept
Definition sac_format.cpp:1102
double t1() const noexcept
Definition sac_format.cpp:1093
double t7() const noexcept
Definition sac_format.cpp:1099
double t6() const noexcept
Definition sac_format.cpp:1098
double t9() const noexcept
Definition sac_format.cpp:1101
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_float_headers_user()

void sacfmt::Trace::read_float_headers_user(std::ifstream * sac_file)
private

Reads SAC-headers from words 040–049.

Note that this expects the position of the reader to be the beginning of word 040.

Note that this modifies the position of the reader to the end of word 049.

Headers loaded: user0, user1, user2, user3, user4, user5, user6, user7, user8, and user9.

Parameters
[in,out]sac_filestd::ifstream* SAC-file to be read.
1884 {
1885 user0(binary_to_float(read_word(sac_file))); // 040
1886 user1(binary_to_float(read_word(sac_file))); // 041
1887 user2(binary_to_float(read_word(sac_file))); // 042
1888 user3(binary_to_float(read_word(sac_file))); // 043
1889 user4(binary_to_float(read_word(sac_file))); // 044
1890 user5(binary_to_float(read_word(sac_file))); // 045
1891 user6(binary_to_float(read_word(sac_file))); // 046
1892 user7(binary_to_float(read_word(sac_file))); // 047
1893 user8(binary_to_float(read_word(sac_file))); // 048
1894 user9(binary_to_float(read_word(sac_file))); // 049
1895}
float user2() const noexcept
Definition sac_format.cpp:1053
float user8() const noexcept
Definition sac_format.cpp:1059
float user5() const noexcept
Definition sac_format.cpp:1056
float user0() const noexcept
Definition sac_format.cpp:1051
float user7() const noexcept
Definition sac_format.cpp:1058
float user9() const noexcept
Definition sac_format.cpp:1060
float user1() const noexcept
Definition sac_format.cpp:1052
float user4() const noexcept
Definition sac_format.cpp:1055
float user6() const noexcept
Definition sac_format.cpp:1057
float user3() const noexcept
Definition sac_format.cpp:1054
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_footers()

void sacfmt::Trace::read_footers(std::ifstream * sac_file)
private

Reads SAC-footers (post-data words 00–43).

Note that this modifies the position of the reader to the end of the footer section.

Parameters
[in,out]sac_filestd::ifstream* SAC-file to be read.
2153 {
2154 delta(binary_to_double(read_two_words(sac_file))); // 00-01
2155 b(binary_to_double(read_two_words(sac_file))); // 02-03
2156 e(binary_to_double(read_two_words(sac_file))); // 04-05
2157 o(binary_to_double(read_two_words(sac_file))); // 06-07
2158 a(binary_to_double(read_two_words(sac_file))); // 08-09
2159 t0(binary_to_double(read_two_words(sac_file))); // 10-11
2160 t1(binary_to_double(read_two_words(sac_file))); // 12-13
2161 t2(binary_to_double(read_two_words(sac_file))); // 14-15
2162 t3(binary_to_double(read_two_words(sac_file))); // 16-17
2163 t4(binary_to_double(read_two_words(sac_file))); // 18-19
2164 t5(binary_to_double(read_two_words(sac_file))); // 20-21
2165 t6(binary_to_double(read_two_words(sac_file))); // 22-23
2166 t7(binary_to_double(read_two_words(sac_file))); // 24-25
2167 t8(binary_to_double(read_two_words(sac_file))); // 26-27
2168 t9(binary_to_double(read_two_words(sac_file))); // 28-29
2169 f(binary_to_double(read_two_words(sac_file))); // 30-31
2170 evlo(binary_to_double(read_two_words(sac_file))); // 32-33
2171 evla(binary_to_double(read_two_words(sac_file))); // 34-35
2172 stlo(binary_to_double(read_two_words(sac_file))); // 36-37
2173 stla(binary_to_double(read_two_words(sac_file))); // 38-39
2174 sb(binary_to_double(read_two_words(sac_file))); // 40-41
2175 sdelta(binary_to_double(read_two_words(sac_file))); // 42-43
2176}
word_two read_two_words(std::ifstream *sac)
Read two words (64 bits, useful for most strings) from a binary SAC-file.
Definition sac_format.cpp:439
double binary_to_double(const word_two &bin) noexcept
Convert 64-bit (two words) binary bitset to double-precision value.
Definition sac_format.cpp:159
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_int_headers()

void sacfmt::Trace::read_int_headers(std::ifstream * sac_file)
private

Reads SAC-headers from words 070–104.

Note that this expects the position of the reader to be the beginning of word 070.

Note that this modifies the position of the reader to the end of word 104.

Loads all integer headers.

Parameters
[in,out]sac_filestd::ifstream* SAC-file to be read.
2045 {
2046 read_int_headers_datetime(sac_file); // 070--075
2047 read_int_headers_meta(sac_file); // 076--104
2048}
void read_int_headers_datetime(std::ifstream *sac_file)
Reads SAC-headers from words 070–075.
Definition sac_format.cpp:1979
void read_int_headers_meta(std::ifstream *sac_file)
Reads SAC-headers from words 076–104.
Definition sac_format.cpp:2002
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_int_headers_datetime()

void sacfmt::Trace::read_int_headers_datetime(std::ifstream * sac_file)
private

Reads SAC-headers from words 070–075.

Note that this expects the position of the reader to be the beginning of word 070.

Note that this modifies the position of the reader to the end of word 075.

Headers loaded: nzyear, nzjday, nzhour, nzmin, nzsec, and nzmsec.

Parameters
[in,out]sac_filestd::ifstream* SAC-file to be read.
1979 {
1980 nzyear(binary_to_int(read_word(sac_file))); // 070
1981 nzjday(binary_to_int(read_word(sac_file))); // 071
1982 nzhour(binary_to_int(read_word(sac_file))); // 072
1983 nzmin(binary_to_int(read_word(sac_file))); // 073
1984 nzsec(binary_to_int(read_word(sac_file))); // 074
1985 nzmsec(binary_to_int(read_word(sac_file))); // 075
1986}
int nzsec() const noexcept
Definition sac_format.cpp:1116
int nzhour() const noexcept
Definition sac_format.cpp:1114
int nzmin() const noexcept
Definition sac_format.cpp:1115
int nzmsec() const noexcept
Definition sac_format.cpp:1117
int binary_to_int(word_one bin) noexcept
Convert 32-bit (one word) binary bitset to integer.
Definition sac_format.cpp:88
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_int_headers_meta()

void sacfmt::Trace::read_int_headers_meta(std::ifstream * sac_file)
private

Reads SAC-headers from words 076–104.

Note that this expects the position of the reader to be the beginning of word 076.

Note that this modifies the position of the reader to the end of word 104.

Headers loaded: nvhdr, norid, nevid, npts, nsnpts, nwfid, nxsize, nysize, iftype, idep, iztype, iinst, istreg, ievreg, ievtyp, iqual, isynth, imagtyp, imagsrc, and ibody.

Parameters
[in,out]sac_filestd::ifstream* SAC-file to be read.
2002 {
2003 nvhdr(binary_to_int(read_word(sac_file))); // 076
2004 norid(binary_to_int(read_word(sac_file))); // 077
2005 nevid(binary_to_int(read_word(sac_file))); // 078
2006 npts(binary_to_int(read_word(sac_file))); // 079
2007 nsnpts(binary_to_int(read_word(sac_file))); // 080
2008 nwfid(binary_to_int(read_word(sac_file))); // 081
2009 nxsize(binary_to_int(read_word(sac_file))); // 082
2010 nysize(binary_to_int(read_word(sac_file))); // 083
2011 // Skip 'unused'
2012 read_word(sac_file); // 084
2013 iftype(binary_to_int(read_word(sac_file))); // 085
2014 idep(binary_to_int(read_word(sac_file))); // 086
2015 iztype(binary_to_int(read_word(sac_file))); // 087
2016 // Skip 'unused'
2017 read_word(sac_file); // 088
2018 iinst(binary_to_int(read_word(sac_file))); // 089
2019 istreg(binary_to_int(read_word(sac_file))); // 090
2020 ievreg(binary_to_int(read_word(sac_file))); // 091
2021 ievtyp(binary_to_int(read_word(sac_file))); // 092
2022 iqual(binary_to_int(read_word(sac_file))); // 093
2023 isynth(binary_to_int(read_word(sac_file))); // 094
2024 imagtyp(binary_to_int(read_word(sac_file))); // 095
2025 imagsrc(binary_to_int(read_word(sac_file))); // 096
2026 ibody(binary_to_int(read_word(sac_file))); // 097
2027 // Skip 'unused' (xcommon_skip_num)
2028 for (int i{0}; i < common_skip_num; ++i) { // 098--104
2029 read_word(sac_file);
2030 }
2031}
int ibody() const noexcept
Definition sac_format.cpp:1137
int idep() const noexcept
Definition sac_format.cpp:1127
int imagtyp() const noexcept
Definition sac_format.cpp:1135
int imagsrc() const noexcept
Definition sac_format.cpp:1136
int norid() const noexcept
Definition sac_format.cpp:1119
int iqual() const noexcept
Definition sac_format.cpp:1133
int nysize() const noexcept
Definition sac_format.cpp:1125
int nsnpts() const noexcept
Definition sac_format.cpp:1122
int nxsize() const noexcept
Definition sac_format.cpp:1124
int iztype() const noexcept
Definition sac_format.cpp:1128
int isynth() const noexcept
Definition sac_format.cpp:1134
int iinst() const noexcept
Definition sac_format.cpp:1129
int istreg() const noexcept
Definition sac_format.cpp:1130
int nevid() const noexcept
Definition sac_format.cpp:1120
int ievtyp() const noexcept
Definition sac_format.cpp:1132
int ievreg() const noexcept
Definition sac_format.cpp:1131
int nwfid() const noexcept
Definition sac_format.cpp:1123
Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_string_headers()

void sacfmt::Trace::read_string_headers(std::ifstream * sac_file)
private

Reads SAC-headers from words 110–157.

Note that this expects the position of the reader to be the beginning of word 110.

Note that this modifies the position of the reader to the end of word 157.

Loads all string headers.

Parameters
[in,out]sac_filestd::ifstream* SAC-file to be read.
2084 {
2085 // KSTNM is 2 words (normal)
2086 kstnm(binary_to_string(read_two_words(sac_file))); // 110-111
2087 // KEVNM is 4 words long (unique!)
2088 kevnm(binary_to_long_string(read_four_words(sac_file))); // 112-115
2089 // All other 'K' headers are 2 words
2090 khole(binary_to_string(read_two_words(sac_file))); // 116-117
2091 ko(binary_to_string(read_two_words(sac_file))); // 118-119
2092 ka(binary_to_string(read_two_words(sac_file))); // 120-121
2093 kt0(binary_to_string(read_two_words(sac_file))); // 122-123
2094 kt1(binary_to_string(read_two_words(sac_file))); // 124-125
2095 kt2(binary_to_string(read_two_words(sac_file))); // 126-127
2096 kt3(binary_to_string(read_two_words(sac_file))); // 128-129
2097 kt4(binary_to_string(read_two_words(sac_file))); // 130-131
2098 kt5(binary_to_string(read_two_words(sac_file))); // 132-133
2099 kt6(binary_to_string(read_two_words(sac_file))); // 134-135
2100 kt7(binary_to_string(read_two_words(sac_file))); // 136-137
2101 kt8(binary_to_string(read_two_words(sac_file))); // 138-139
2102 kt9(binary_to_string(read_two_words(sac_file))); // 140-141
2103 kf(binary_to_string(read_two_words(sac_file))); // 142-143
2104 kuser0(binary_to_string(read_two_words(sac_file))); // 144-145
2105 kuser1(binary_to_string(read_two_words(sac_file))); // 146-147
2106 kuser2(binary_to_string(read_two_words(sac_file))); // 148-149
2107 kcmpnm(binary_to_string(read_two_words(sac_file))); // 150-151
2108 knetwk(binary_to_string(read_two_words(sac_file))); // 152-153
2109 kdatrd(binary_to_string(read_two_words(sac_file))); // 154-155
2110 kinst(binary_to_string(read_two_words(sac_file))); // 156-157
2111}
std::string kevnm() const noexcept
Definition sac_format.cpp:1147
std::string kt3() const noexcept
Definition sac_format.cpp:1164
std::string kt0() const noexcept
Definition sac_format.cpp:1155
std::string ko() const noexcept
Definition sac_format.cpp:1153
std::string kstnm() const noexcept
Definition sac_format.cpp:1144
std::string kuser0() const noexcept
Definition sac_format.cpp:1186
std::string kt8() const noexcept
Definition sac_format.cpp:1179
std::string kt4() const noexcept
Definition sac_format.cpp:1167
std::string kt2() const noexcept
Definition sac_format.cpp:1161
std::string khole() const noexcept
Definition sac_format.cpp:1150
std::string kinst() const noexcept
Definition sac_format.cpp:1204
std::string kuser2() const noexcept
Definition sac_format.cpp:1192
std::string kt1() const noexcept
Definition sac_format.cpp:1158
std::string kt5() const noexcept
Definition sac_format.cpp:1170
std::string ka() const noexcept
Definition sac_format.cpp:1154
std::string kt6() const noexcept
Definition sac_format.cpp:1173
std::string knetwk() const noexcept
Definition sac_format.cpp:1198
std::string kf() const noexcept
Definition sac_format.cpp:1185
std::string kt9() const noexcept
Definition sac_format.cpp:1182
std::string kdatrd() const noexcept
Definition sac_format.cpp:1201
std::string kuser1() const noexcept
Definition sac_format.cpp:1189
std::string kcmpnm() const noexcept
Definition sac_format.cpp:1195
std::string kt7() const noexcept
Definition sac_format.cpp:1176
word_four read_four_words(std::ifstream *sac)
Read four words (128 bits, kEvNm only) from a binary SAC-file.
Definition sac_format.cpp:462
std::string binary_to_long_string(const word_four &str) noexcept
Convert a 128-bit (four word) binary bitset to a string.
Definition sac_format.cpp:332
std::string binary_to_string(const word_two &str) noexcept
Convert a 64-bit (two word) binary bitset to a string.
Definition sac_format.cpp:298
Here is the call graph for this function:
Here is the caller graph for this function:

◆ resize_data()

void sacfmt::Trace::resize_data(size_t size)
privatenoexcept

Resize data vectors (only if eligible).

Will always resize data1, data2 only resizes if it can have non-zero size.

1654 {
1655 resize_data1(size);
1656 resize_data2(size);
1657}
void resize_data1(size_t size) noexcept
Definition sac_format.cpp:1625

◆ resize_data1()

void sacfmt::Trace::resize_data1(size_t size)
privatenoexcept
1625 {
1626 if (size != data1().size()) {
1627 std::vector<double> new_data1{data1()};
1628 new_data1.resize(size, 0.0);
1629 data1(new_data1);
1630 }
1631}

◆ resize_data2()

void sacfmt::Trace::resize_data2(size_t size)
privatenoexcept
1633 {
1634 // Data2 is legal
1635 if (!leven() || (iftype() > 1)) {
1636 if (size != data2().size()) {
1637 std::vector<double> new_data2{data2()};
1638 new_data2.resize(size, 0.0);
1639 data2(new_data2);
1640 }
1641 } else {
1642 if (!data2().empty()) {
1643 std::vector<double> new_data2{};
1644 data2(new_data2);
1645 }
1646 }
1647}

◆ resp0() [1/2]

float sacfmt::Trace::resp0()const
noexcept
1036{ return floats[sac_map.at(name::resp0)]; }
Here is the caller graph for this function:

◆ resp0() [2/2]

void sacfmt::Trace::resp0(float input)
noexcept
1225 {
1226 floats[sac_map.at(name::resp0)] = input;
1227}

◆ resp1() [1/2]

float sacfmt::Trace::resp1()const
noexcept
1037{ return floats[sac_map.at(name::resp1)]; }
@ resp1
See resp0, pre-data word 022.
Here is the caller graph for this function:

◆ resp1() [2/2]

void sacfmt::Trace::resp1(float input)
noexcept
1228 {
1229 floats[sac_map.at(name::resp1)] = input;
1230}

◆ resp2() [1/2]

float sacfmt::Trace::resp2()const
noexcept
1038{ return floats[sac_map.at(name::resp2)]; }
@ resp2
See resp0, pre-data word 023.
Here is the caller graph for this function:

◆ resp2() [2/2]

void sacfmt::Trace::resp2(float input)
noexcept
1231 {
1232 floats[sac_map.at(name::resp2)] = input;
1233}

◆ resp3() [1/2]

float sacfmt::Trace::resp3()const
noexcept
1039{ return floats[sac_map.at(name::resp3)]; }
@ resp3
See resp0, pre-data word 024.
Here is the caller graph for this function:

◆ resp3() [2/2]

void sacfmt::Trace::resp3(float input)
noexcept
1234 {
1235 floats[sac_map.at(name::resp3)] = input;
1236}

◆ resp4() [1/2]

float sacfmt::Trace::resp4()const
noexcept
1040{ return floats[sac_map.at(name::resp4)]; }
@ resp4
See resp0, pre-data word 025.
Here is the caller graph for this function:

◆ resp4() [2/2]

void sacfmt::Trace::resp4(float input)
noexcept
1237 {
1238 floats[sac_map.at(name::resp4)] = input;
1239}

◆ resp5() [1/2]

float sacfmt::Trace::resp5()const
noexcept
1041{ return floats[sac_map.at(name::resp5)]; }
@ resp5
See resp0, pre-data word 026.
Here is the caller graph for this function:

◆ resp5() [2/2]

void sacfmt::Trace::resp5(float input)
noexcept
1240 {
1241 floats[sac_map.at(name::resp5)] = input;
1242}

◆ resp6() [1/2]

float sacfmt::Trace::resp6()const
noexcept
1042{ return floats[sac_map.at(name::resp6)]; }
@ resp6
See resp0, pre-data word 027.
Here is the caller graph for this function:

◆ resp6() [2/2]

void sacfmt::Trace::resp6(float input)
noexcept
1243 {
1244 floats[sac_map.at(name::resp6)] = input;
1245}

◆ resp7() [1/2]

float sacfmt::Trace::resp7()const
noexcept
1043{ return floats[sac_map.at(name::resp7)]; }
@ resp7
See resp0, pre-data word 028.
Here is the caller graph for this function:

◆ resp7() [2/2]

void sacfmt::Trace::resp7(float input)
noexcept
1246 {
1247 floats[sac_map.at(name::resp7)] = input;
1248}

◆ resp8() [1/2]

float sacfmt::Trace::resp8()const
noexcept
1044{ return floats[sac_map.at(name::resp8)]; }
@ resp8
See resp0, pre-data word 029.
Here is the caller graph for this function:

◆ resp8() [2/2]

void sacfmt::Trace::resp8(float input)
noexcept
1249 {
1250 floats[sac_map.at(name::resp8)] = input;
1251}

◆ resp9() [1/2]

float sacfmt::Trace::resp9()const
noexcept
1045{ return floats[sac_map.at(name::resp9)]; }
@ resp9
See resp0, pre-data word 030.
Here is the caller graph for this function:

◆ resp9() [2/2]

void sacfmt::Trace::resp9(float input)
noexcept
1252 {
1253 floats[sac_map.at(name::resp9)] = input;
1254}

◆ sb() [1/2]

double sacfmt::Trace::sb()const
noexcept
1107{ return doubles[sac_map.at(name::sb)]; }
Here is the caller graph for this function:

◆ sb() [2/2]

void sacfmt::Trace::sb(double input)
noexcept
1410 {
1411 doubles[sac_map.at(name::sb)] = input;
1412}

◆ sdelta() [1/2]

double sacfmt::Trace::sdelta()const
noexcept
1108 {
1109 return doubles[sac_map.at(name::sdelta)];
1110}
Here is the caller graph for this function:

◆ sdelta() [2/2]

void sacfmt::Trace::sdelta(double input)
noexcept
1413 {
1414 doubles[sac_map.at(name::sdelta)] = input;
1415}

◆ station_location()

point sacfmt::Trace::station_location()const
inlineprivatenoexcept

Return station location as a point.

1388 {
1389 return point{coord{stla(), true}, coord{stlo(), true}};
1390 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stdp() [1/2]

float sacfmt::Trace::stdp()const
noexcept
1047{ return floats[sac_map.at(name::stdp)]; }
Here is the caller graph for this function:

◆ stdp() [2/2]

void sacfmt::Trace::stdp(float input)
noexcept
1258 {
1259 floats[sac_map.at(name::stdp)] = input;
1260}

◆ stel() [1/2]

float sacfmt::Trace::stel()const
noexcept
1046{ return floats[sac_map.at(name::stel)]; }
Here is the caller graph for this function:

◆ stel() [2/2]

void sacfmt::Trace::stel(float input)
noexcept
1255 {
1256 floats[sac_map.at(name::stel)] = input;
1257}

◆ stla() [1/2]

double sacfmt::Trace::stla()const
noexcept
1103{ return doubles[sac_map.at(name::stla)]; }
Here is the caller graph for this function:

◆ stla() [2/2]

void sacfmt::Trace::stla(double input)
noexcept
1382 {
1383 double clean_input{input};
1384 if (clean_input != unset_double) {
1385 clean_input = limit_90(clean_input);
1386 }
1387 doubles[sac_map.at(name::stla)] = clean_input;
1388}
Here is the call graph for this function:

◆ stlo() [1/2]

double sacfmt::Trace::stlo()const
noexcept
1104{ return doubles[sac_map.at(name::stlo)]; }
Here is the caller graph for this function:

◆ stlo() [2/2]

void sacfmt::Trace::stlo(double input)
noexcept
1389 {
1390 double clean_input{input};
1391 if (clean_input != unset_double) {
1392 clean_input = limit_180(clean_input);
1393 }
1394 doubles[sac_map.at(name::stlo)] = clean_input;
1395}
Here is the call graph for this function:

◆ t0() [1/2]

double sacfmt::Trace::t0()const
noexcept
1092{ return doubles[sac_map.at(name::t0)]; }
Here is the caller graph for this function:

◆ t0() [2/2]

void sacfmt::Trace::t0(double input)
noexcept
1349 {
1350 doubles[sac_map.at(name::t0)] = input;
1351}

◆ t1() [1/2]

double sacfmt::Trace::t1()const
noexcept
1093{ return doubles[sac_map.at(name::t1)]; }
@ t1
See t0, pre-data word 011; post-data words 12-13.
Here is the caller graph for this function:

◆ t1() [2/2]

void sacfmt::Trace::t1(double input)
noexcept
1352 {
1353 doubles[sac_map.at(name::t1)] = input;
1354}

◆ t2() [1/2]

double sacfmt::Trace::t2()const
noexcept
1094{ return doubles[sac_map.at(name::t2)]; }
@ t2
See t0, pre-data word 012; post-data words 14-15.
Here is the caller graph for this function:

◆ t2() [2/2]

void sacfmt::Trace::t2(double input)
noexcept
1355 {
1356 doubles[sac_map.at(name::t2)] = input;
1357}

◆ t3() [1/2]

double sacfmt::Trace::t3()const
noexcept
1095{ return doubles[sac_map.at(name::t3)]; }
@ t3
See t0, pre-data word 013; post-data words 16-17.
Here is the caller graph for this function:

◆ t3() [2/2]

void sacfmt::Trace::t3(double input)
noexcept
1358 {
1359 doubles[sac_map.at(name::t3)] = input;
1360}

◆ t4() [1/2]

double sacfmt::Trace::t4()const
noexcept
1096{ return doubles[sac_map.at(name::t4)]; }
@ t4
See t0, pre-data word 014; post-data words 18-19.
Here is the caller graph for this function:

◆ t4() [2/2]

void sacfmt::Trace::t4(double input)
noexcept
1361 {
1362 doubles[sac_map.at(name::t4)] = input;
1363}

◆ t5() [1/2]

double sacfmt::Trace::t5()const
noexcept
1097{ return doubles[sac_map.at(name::t5)]; }
@ t5
See t0, pre-data word 015; post-data words 20-21.
Here is the caller graph for this function:

◆ t5() [2/2]

void sacfmt::Trace::t5(double input)
noexcept
1364 {
1365 doubles[sac_map.at(name::t5)] = input;
1366}

◆ t6() [1/2]

double sacfmt::Trace::t6()const
noexcept
1098{ return doubles[sac_map.at(name::t6)]; }
@ t6
See t0, pre-data word 016; post-data words 22-23.
Here is the caller graph for this function:

◆ t6() [2/2]

void sacfmt::Trace::t6(double input)
noexcept
1367 {
1368 doubles[sac_map.at(name::t6)] = input;
1369}

◆ t7() [1/2]

double sacfmt::Trace::t7()const
noexcept
1099{ return doubles[sac_map.at(name::t7)]; }
@ t7
See t0, pre-data word 017; post-data words 24-25.
Here is the caller graph for this function:

◆ t7() [2/2]

void sacfmt::Trace::t7(double input)
noexcept
1370 {
1371 doubles[sac_map.at(name::t7)] = input;
1372}

◆ t8() [1/2]

double sacfmt::Trace::t8()const
noexcept
1100{ return doubles[sac_map.at(name::t8)]; }
@ t8
See t0, pre-data word 018; post-data words 26-27.
Here is the caller graph for this function:

◆ t8() [2/2]

void sacfmt::Trace::t8(double input)
noexcept
1373 {
1374 doubles[sac_map.at(name::t8)] = input;
1375}

◆ t9() [1/2]

double sacfmt::Trace::t9()const
noexcept
1101{ return doubles[sac_map.at(name::t9)]; }
@ t9
See t0, pre-data word 019; post-data words 28-29.
Here is the caller graph for this function:

◆ t9() [2/2]

void sacfmt::Trace::t9(double input)
noexcept
1376 {
1377 doubles[sac_map.at(name::t9)] = input;
1378}

◆ time()

std::string sacfmt::Trace::time()const
noexcept

Get time string.

Returns
sstd::string Time (HH::MM:SS.sss).
1008 {
1009 // Require all to be set
1010 if ((nzhour() == unset_int) || (nzmin() == unset_int) ||
1011 (nzsec() == unset_int) || (nzmsec() == unset_int)) {
1012 return unset_word;
1013 }
1014 std::ostringstream oss{};
1015 oss << nzhour();
1016 oss << ':';
1017 oss << nzmin();
1018 oss << ':';
1019 oss << nzsec();
1020 oss << '.';
1021 oss << nzmsec();
1022 return oss.str();
1023}
Here is the call graph for this function:

◆ user0() [1/2]

float sacfmt::Trace::user0()const
noexcept
1051{ return floats[sac_map.at(name::user0)]; }
Here is the caller graph for this function:

◆ user0() [2/2]

void sacfmt::Trace::user0(float input)
noexcept
1270 {
1271 floats[sac_map.at(name::user0)] = input;
1272}

◆ user1() [1/2]

float sacfmt::Trace::user1()const
noexcept
1052{ return floats[sac_map.at(name::user1)]; }
@ user1
See user0, pre-data word 041.
Here is the caller graph for this function:

◆ user1() [2/2]

void sacfmt::Trace::user1(float input)
noexcept
1273 {
1274 floats[sac_map.at(name::user1)] = input;
1275}

◆ user2() [1/2]

float sacfmt::Trace::user2()const
noexcept
1053{ return floats[sac_map.at(name::user2)]; }
@ user2
See user0, pre-data word 042.
Here is the caller graph for this function:

◆ user2() [2/2]

void sacfmt::Trace::user2(float input)
noexcept
1276 {
1277 floats[sac_map.at(name::user2)] = input;
1278}

◆ user3() [1/2]

float sacfmt::Trace::user3()const
noexcept
1054{ return floats[sac_map.at(name::user3)]; }
@ user3
See user0, pre-data word 043.
Here is the caller graph for this function:

◆ user3() [2/2]

void sacfmt::Trace::user3(float input)
noexcept
1279 {
1280 floats[sac_map.at(name::user3)] = input;
1281}

◆ user4() [1/2]

float sacfmt::Trace::user4()const
noexcept
1055{ return floats[sac_map.at(name::user4)]; }
@ user4
See user0, pre-data word 044.
Here is the caller graph for this function:

◆ user4() [2/2]

void sacfmt::Trace::user4(float input)
noexcept
1282 {
1283 floats[sac_map.at(name::user4)] = input;
1284}

◆ user5() [1/2]

float sacfmt::Trace::user5()const
noexcept
1056{ return floats[sac_map.at(name::user5)]; }
@ user5
See user0, pre-data word 045.
Here is the caller graph for this function:

◆ user5() [2/2]

void sacfmt::Trace::user5(float input)
noexcept
1285 {
1286 floats[sac_map.at(name::user5)] = input;
1287}

◆ user6() [1/2]

float sacfmt::Trace::user6()const
noexcept
1057{ return floats[sac_map.at(name::user6)]; }
@ user6
See user0, pre-data word 046.
Here is the caller graph for this function:

◆ user6() [2/2]

void sacfmt::Trace::user6(float input)
noexcept
1288 {
1289 floats[sac_map.at(name::user6)] = input;
1290}

◆ user7() [1/2]

float sacfmt::Trace::user7()const
noexcept
1058{ return floats[sac_map.at(name::user7)]; }
@ user7
See user0, pre-data word 047.
Here is the caller graph for this function:

◆ user7() [2/2]

void sacfmt::Trace::user7(float input)
noexcept
1291 {
1292 floats[sac_map.at(name::user7)] = input;
1293}

◆ user8() [1/2]

float sacfmt::Trace::user8()const
noexcept
1059{ return floats[sac_map.at(name::user8)]; }
@ user8
See user0, pre-data word 048.
Here is the caller graph for this function:

◆ user8() [2/2]

void sacfmt::Trace::user8(float input)
noexcept
1294 {
1295 floats[sac_map.at(name::user8)] = input;
1296}

◆ user9() [1/2]

float sacfmt::Trace::user9()const
noexcept
1060{ return floats[sac_map.at(name::user9)]; }
@ user9
See user0, pre-data word 049.
Here is the caller graph for this function:

◆ user9() [2/2]

void sacfmt::Trace::user9(float input)
noexcept
1297 {
1298 floats[sac_map.at(name::user9)] = input;
1299}

◆ write()

void sacfmt::Trace::write(const std::filesystem::path & path,
bool legacy = false 
)const

Binary SAC-file writer.

Parameters
[in]pathstd::filesystem::path SAC-file to write.
[in]legacybool Legacy-write flag (default false = v7, true = v6).
Exceptions
io_errorIf the file cannot be written (bad path or bad permissions).
std::exceptionOther unwritable issues (not enough space, disk failure, etc.).
2686 {
2687 std::ofstream file(path, std::ios::binary | std::ios::out | std::ios::trunc);
2688 if (!file) {
2689 throw io_error(path.string() + " cannot be opened to write.");
2690 }
2691 const int header_version{legacy ? old_hdr_version : modern_hdr_version};
2692 write_float_headers(&file);
2693 write_int_headers(&file, header_version);
2694 write_bool_headers(&file);
2696 // Data
2697 std::vector<double> tmp{data1()};
2698 write_data(&file, tmp);
2699 if (!leven() || (iftype() > 1)) {
2700 tmp = data2();
2701 write_data(&file, tmp);
2702 }
2703 if (header_version == modern_hdr_version) {
2704 // Write footer
2705 write_footers(&file);
2706 }
2707 file.close();
2708}
void write_footers(std::ofstream *sac_file) const
Writes SAC-footers (post-data words 00–43).
Definition sac_format.cpp:2652
static void write_data(std::ofstream *sac_file, const std::vector< double > &data_vec)
Writes data vectors.
Definition sac_format.cpp:2220
void write_int_headers(std::ofstream *sac_file, int hdr_ver) const
Writes SAC-headers from words 070–104.
Definition sac_format.cpp:2508
void write_string_headers(std::ofstream *sac_file) const
Writes SAC-headers from words 110–157.
Definition sac_format.cpp:2547
void write_float_headers(std::ofstream *sac_file) const
Writes SAC-headers from words 000–069.
Definition sac_format.cpp:2417
void write_bool_headers(std::ofstream *sac_file) const
Writes SAC-headers from words 105–109.
Definition sac_format.cpp:2526
constexpr int old_hdr_version
nVHdr value for historic SAC format (pre-2020).
Definition sac_format.hpp:108
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_bool_headers()

void sacfmt::Trace::write_bool_headers(std::ofstream * sac_file)const
private

Writes SAC-headers from words 105–109.

Note that this expects the position of the writer to be the beginning of word 105.

Note that this modifies the position of the writer to the end of word 109.

Writes all boolean headers.

Parameters
[in,out]sac_filestd::ofstream* SAC-file to be written.
2526 {
2527 write_words(sac_file, bool_to_word(leven())); // 105
2528 write_words(sac_file, bool_to_word(lpspol())); // 106
2529 write_words(sac_file, bool_to_word(lovrok())); // 107
2530 write_words(sac_file, bool_to_word(lcalda())); // 108
2531 // Fill 'unused'
2532 write_words(sac_file, bool_to_word(lcalda())); // 109
2533}
std::vector< char > bool_to_word(bool flag) noexcept
Convert boolean to a word for writing.
Definition sac_format.cpp:598
void write_words(std::ofstream *sac_file, const std::vector< char > &input)
Write arbitrary number of words (useful for vectors) to a binary SAC-file.
Definition sac_format.cpp:510
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_data()

void sacfmt::Trace::write_data(std::ofstream * sac_file,
const std::vector< double > & data_vec 
)
static

Writes data vectors.

Note that this modifies the position of the writer to the end of the data section wriitten.

For data1 writes words 158–(158 + npts).

For data2 writess words (158 + 1 + npts)–(159 + (2 * npts))

Parameters
[in,out]sac_filestd::ofstream* SAC-file to be written.
[in]data_vecstd::vector<double> Data-vector to write.
2221 {
2222 std::for_each(
2223 data_vec.begin(), data_vec.end(), [&sac_file](const auto &value) {
2224 write_words(sac_file, convert_to_word(static_cast<float>(value)));
2225 });
2226}
Here is the caller graph for this function:

◆ write_float_headers()

void sacfmt::Trace::write_float_headers(std::ofstream * sac_file)const
private

Writes SAC-headers from words 000–069.

Note that this expects the position of the writer to be the beginning of word 000.

Note that this modifies the position of the writer to the end of word 069.

Writes all the float headers.

Parameters
[in,out]sac_filestd::ofstream* SAC-file to be written.
2417 {
2418 write_float_headers_starter(sac_file); // 000-009
2419 write_float_headers_t(sac_file); // 010-020
2420 write_float_headers_resp(sac_file); // 031-030
2421 write_float_headers_station_event(sac_file); // 031-039
2422 write_float_headers_user(sac_file); // 040-049
2423 write_float_headers_geometry(sac_file); // 050-053
2424 write_float_headers_meta(sac_file); // 054-069
2425}
void write_float_headers_t(std::ofstream *sac_file) const
Writes SAC-headers from words 010–020.
Definition sac_format.cpp:2267
void write_float_headers_geometry(std::ofstream *sac_file) const
Writes SAC-headers from words 050–053.
Definition sac_format.cpp:2369
void write_float_headers_meta(std::ofstream *sac_file) const
Writes SAC-headers from words 054–069.
Definition sac_format.cpp:2389
void write_float_headers_station_event(std::ofstream *sac_file) const
Writes SAC-headers from words 031–039.
Definition sac_format.cpp:2319
void write_float_headers_starter(std::ofstream *sac_file) const
Writes SAC-headers from words 000–009.
Definition sac_format.cpp:2240
void write_float_headers_resp(std::ofstream *sac_file) const
Writes SAC-headers from words 021–030.
Definition sac_format.cpp:2294
void write_float_headers_user(std::ofstream *sac_file) const
Writes SAC-headers from words 040–049.
Definition sac_format.cpp:2344
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_float_headers_geometry()

void sacfmt::Trace::write_float_headers_geometry(std::ofstream * sac_file)const
private

Writes SAC-headers from words 050–053.

Note that this expects the position of the writer to be the beginning of word 050.

Note that this modifies the position of the writer to the end of word 053.

Headers written: dist, az, baz, and gcarc.

Parameters
[in,out]sac_filestd::ofstream* SAC-file to be written.
2369 {
2370 write_words(sac_file, convert_to_word(dist())); // 050
2371 write_words(sac_file, convert_to_word(az())); // 051
2372 write_words(sac_file, convert_to_word(baz())); // 052
2373 write_words(sac_file, convert_to_word(gcarc())); // 053
2374}
std::vector< char > convert_to_word(T input) noexcept
Template function to convert input value into a std::vector<char> for writing.
Definition sac_format.cpp:527
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_float_headers_meta()

void sacfmt::Trace::write_float_headers_meta(std::ofstream * sac_file)const
private

Writes SAC-headers from words 054–069.

Note that this expects the position of the writer to be the beginning of word 054.

Note that this modifies the position of the writer to the end of word 069.

Headers written: sb, sdelta, depmen, cmpaz, cmpinc, xminimum, xmaximum, yminimum, and ymaximum.

Parameters
[in,out]sac_filestd::ofstream* SAC-file to be written.
2389 {
2390 write_words(sac_file, convert_to_word(static_cast<float>(sb()))); // 054
2391 write_words(sac_file, convert_to_word(static_cast<float>(sdelta()))); // 055
2392 write_words(sac_file, convert_to_word(depmen())); // 056
2393 write_words(sac_file, convert_to_word(cmpaz())); // 057
2394 write_words(sac_file, convert_to_word(cmpinc())); // 058
2395 write_words(sac_file, convert_to_word(xminimum())); // 059
2396 write_words(sac_file, convert_to_word(xmaximum())); // 060
2397 write_words(sac_file, convert_to_word(yminimum())); // 061
2398 write_words(sac_file, convert_to_word(ymaximum())); // 062
2399 // Fill 'unused' (xcommon_skip_num)
2400 for (int i{0}; i < common_skip_num; ++i) { // 063-069
2401 write_words(sac_file, convert_to_word(az()));
2402 }
2403}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_float_headers_resp()

void sacfmt::Trace::write_float_headers_resp(std::ofstream * sac_file)const
private

Writes SAC-headers from words 021–030.

Note that this expects the position of the writer to be the beginning of word 021.

Note that this modifies the position of the writer to the end of word 030.

Headers written: resp0, resp1, resp2, resp3, resp4, resp5, resp6, resp7, resp8, and resp9.

Parameters
[in,out]sac_filestd::ofstream* SAC-file to be written.
2294 {
2295 write_words(sac_file, convert_to_word(resp0())); // 021
2296 write_words(sac_file, convert_to_word(resp1())); // 022
2297 write_words(sac_file, convert_to_word(resp2())); // 023
2298 write_words(sac_file, convert_to_word(resp3())); // 024
2299 write_words(sac_file, convert_to_word(resp4())); // 025
2300 write_words(sac_file, convert_to_word(resp5())); // 026
2301 write_words(sac_file, convert_to_word(resp6())); // 027
2302 write_words(sac_file, convert_to_word(resp7())); // 028
2303 write_words(sac_file, convert_to_word(resp8())); // 029
2304 write_words(sac_file, convert_to_word(resp9())); // 030
2305}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_float_headers_starter()

void sacfmt::Trace::write_float_headers_starter(std::ofstream * sac_file)const
private

Writes SAC-headers from words 000–009.

Note that this expects the position of the writer to be the beginning of word 000.

Note that this modifies the position of the writer to the end of word 009.

Headers written: delta, depmin, depmax, odelta, b, e, o, and a.

Parameters
[in,out]sac_filestd::ofstream* SAC-file to be written.
2240 {
2241 write_words(sac_file, convert_to_word(static_cast<float>(delta()))); // 000
2242 write_words(sac_file, convert_to_word(depmin())); // 001
2243 write_words(sac_file, convert_to_word(depmax())); // 002
2244 // Fill 'unused'
2245 write_words(sac_file, convert_to_word(depmax())); // 003
2246 write_words(sac_file, convert_to_word(odelta())); // 004
2247 write_words(sac_file, convert_to_word(static_cast<float>(b()))); // 005
2248 write_words(sac_file, convert_to_word(static_cast<float>(e()))); // 006
2249 write_words(sac_file, convert_to_word(static_cast<float>(o()))); // 007
2250 write_words(sac_file, convert_to_word(static_cast<float>(a()))); // 008
2251 // Fill 'internal'
2252 write_words(sac_file, convert_to_word(depmin())); // 009
2253}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_float_headers_station_event()

void sacfmt::Trace::write_float_headers_station_event(std::ofstream * sac_file)const
private

Writes SAC-headers from words 031–039.

Note that this expects the position of the writer to be the beginning of word 031.

Note that this modifies the position of the writer to the end of word 039.

Headers written: stla, stlo, stel, stdp, evla, evlo, evel, evdp, and mag.

Parameters
[in,out]sac_filestd::ofstream* SAC-file to be written.
2319 {
2320 write_words(sac_file, convert_to_word(static_cast<float>(stla()))); // 031
2321 write_words(sac_file, convert_to_word(static_cast<float>(stlo()))); // 032
2322 write_words(sac_file, convert_to_word(stel())); // 033
2323 write_words(sac_file, convert_to_word(stdp())); // 034
2324 write_words(sac_file, convert_to_word(static_cast<float>(evla()))); // 035
2325 write_words(sac_file, convert_to_word(static_cast<float>(evlo()))); // 036
2326 write_words(sac_file, convert_to_word(evel())); // 037
2327 write_words(sac_file, convert_to_word(evdp())); // 038
2328 write_words(sac_file, convert_to_word(mag())); // 039
2329}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_float_headers_t()

void sacfmt::Trace::write_float_headers_t(std::ofstream * sac_file)const
private

Writes SAC-headers from words 010–020.

Note that this expects the position of the writer to be the beginning of word 010.

Note that this modifies the position of the writer to the end of word 020.

Headers written: t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, and f.

Parameters
[in,out]sac_filestd::ofstream* SAC-file to be written.
2267 {
2268 write_words(sac_file, convert_to_word(static_cast<float>(t0()))); // 010
2269 write_words(sac_file, convert_to_word(static_cast<float>(t1()))); // 011
2270 write_words(sac_file, convert_to_word(static_cast<float>(t2()))); // 012
2271 write_words(sac_file, convert_to_word(static_cast<float>(t3()))); // 013
2272 write_words(sac_file, convert_to_word(static_cast<float>(t4()))); // 014
2273 write_words(sac_file, convert_to_word(static_cast<float>(t5()))); // 015
2274 write_words(sac_file, convert_to_word(static_cast<float>(t6()))); // 016
2275 write_words(sac_file, convert_to_word(static_cast<float>(t7()))); // 017
2276 write_words(sac_file, convert_to_word(static_cast<float>(t8()))); // 018
2277 write_words(sac_file, convert_to_word(static_cast<float>(t9()))); // 019
2278 write_words(sac_file, convert_to_word(static_cast<float>(f()))); // 020
2279}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_float_headers_user()

void sacfmt::Trace::write_float_headers_user(std::ofstream * sac_file)const
private

Writes SAC-headers from words 040–049.

Note that this expects the position of the writer to be the beginning of word 040.

Note that this modifies the position of the writer to the end of word 049.

Headers written: user0, user1, user2, user3, user4, user5, user6, user7, user8, and user9.

Parameters
[in,out]sac_filestd::ofstream* SAC-file to be written.
2344 {
2345 write_words(sac_file, convert_to_word(user0())); // 040
2346 write_words(sac_file, convert_to_word(user1())); // 041
2347 write_words(sac_file, convert_to_word(user2())); // 042
2348 write_words(sac_file, convert_to_word(user3())); // 043
2349 write_words(sac_file, convert_to_word(user4())); // 044
2350 write_words(sac_file, convert_to_word(user5())); // 045
2351 write_words(sac_file, convert_to_word(user6())); // 046
2352 write_words(sac_file, convert_to_word(user7())); // 047
2353 write_words(sac_file, convert_to_word(user8())); // 048
2354 write_words(sac_file, convert_to_word(user9())); // 049
2355}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_footers()

void sacfmt::Trace::write_footers(std::ofstream * sac_file)const
private

Writes SAC-footers (post-data words 00–43).

Note that this modifies the position of the writer to the end of the footer section.

Parameters
[in,out]sac_filestd::ofstream* SAC-file to be written.
2652 {
2653 write_words(sac_file, convert_to_word(delta())); // 00-01
2654 write_words(sac_file, convert_to_word(b())); // 02-03
2655 write_words(sac_file, convert_to_word(e())); // 04-05
2656 write_words(sac_file, convert_to_word(o())); // 06-07
2657 write_words(sac_file, convert_to_word(a())); // 08-09
2658 write_words(sac_file, convert_to_word(t0())); // 10-11
2659 write_words(sac_file, convert_to_word(t1())); // 12-13
2660 write_words(sac_file, convert_to_word(t2())); // 14-15
2661 write_words(sac_file, convert_to_word(t3())); // 16-17
2662 write_words(sac_file, convert_to_word(t4())); // 18-19
2663 write_words(sac_file, convert_to_word(t5())); // 20-21
2664 write_words(sac_file, convert_to_word(t6())); // 22-23
2665 write_words(sac_file, convert_to_word(t7())); // 24-25
2666 write_words(sac_file, convert_to_word(t8())); // 26-27
2667 write_words(sac_file, convert_to_word(t9())); // 28-29
2668 write_words(sac_file, convert_to_word(f())); // 30-31
2669 write_words(sac_file, convert_to_word(evlo())); // 32-33
2670 write_words(sac_file, convert_to_word(evla())); // 34-35
2671 write_words(sac_file, convert_to_word(stlo())); // 36-37
2672 write_words(sac_file, convert_to_word(stla())); // 38-39
2673 write_words(sac_file, convert_to_word(sb())); // 40-41
2674 write_words(sac_file, convert_to_word(sdelta())); // 42-43
2675}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_int_headers()

void sacfmt::Trace::write_int_headers(std::ofstream * sac_file,
int hdr_ver 
)const
private

Writes SAC-headers from words 070–104.

Note that this expects the position of the writer to be the beginning of word 070.

Note that this modifies the position of the writer to the end of word 104.

Writes all integer headers.

Parameters
[in,out]sac_filestd::ofstream* SAC-file to be written.
[in]hdr_verInteger header version to be written.
2509 {
2510 write_int_headers_datetime(sac_file); // 070-075
2511 write_int_headers_meta(sac_file, hdr_ver); // 076-104
2512}
void write_int_headers_datetime(std::ofstream *sac_file) const
Writes SAC-headers from words 070–075.
Definition sac_format.cpp:2439
void write_int_headers_meta(std::ofstream *sac_file, int hdr_ver) const
Writes SAC-headers from words 076–104.
Definition sac_format.cpp:2463
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_int_headers_datetime()

void sacfmt::Trace::write_int_headers_datetime(std::ofstream * sac_file)const
private

Writes SAC-headers from words 070–075.

Note that this expects the position of the writer to be the beginning of word 070.

Note that this modifies the position of the writer to the end of word 075.

Headers written: nzyear, nzjday, nzhour, nzmin, nzsec, and nzmsec.

Parameters
[in,out]sac_filestd::ofstream* SAC-file to be written.
2439 {
2440 write_words(sac_file, convert_to_word(nzyear())); // 070
2441 write_words(sac_file, convert_to_word(nzjday())); // 071
2442 write_words(sac_file, convert_to_word(nzhour())); // 072
2443 write_words(sac_file, convert_to_word(nzmin())); // 073
2444 write_words(sac_file, convert_to_word(nzsec())); // 074
2445 write_words(sac_file, convert_to_word(nzmsec())); // 075
2446}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_int_headers_meta()

void sacfmt::Trace::write_int_headers_meta(std::ofstream * sac_file,
int hdr_ver 
)const
private

Writes SAC-headers from words 076–104.

Note that this expects the position of the writer to be the beginning of word 076.

Note that this modifies the position of the writer to the end of word 104.

Headers written: nvhdr, norid, nevid, npts, nsnpts, nwfid, nxsize, nysize, iftype, idep, iztype, iinst, istreg, ievreg, ievtyp, iqual, isynth, imagtyp, imagsrc, and ibody.

Parameters
[in,out]sac_filestd::ofstream* SAC-file to be written.
[in]hdr_verInteger header version to be written.
2464 {
2465 write_words(sac_file, convert_to_word(hdr_ver)); // 076
2466 write_words(sac_file, convert_to_word(norid())); // 077
2467 write_words(sac_file, convert_to_word(nevid())); // 078
2468 write_words(sac_file, convert_to_word(npts())); // 079
2469 write_words(sac_file, convert_to_word(nsnpts())); // 080
2470 write_words(sac_file, convert_to_word(nwfid())); // 081
2471 write_words(sac_file, convert_to_word(nxsize())); // 082
2472 write_words(sac_file, convert_to_word(nysize())); // 083
2473 // Fill 'unused'
2474 write_words(sac_file, convert_to_word(nysize())); // 084
2475 write_words(sac_file, convert_to_word(iftype())); // 085
2476 write_words(sac_file, convert_to_word(idep())); // 086
2477 write_words(sac_file, convert_to_word(iztype())); // 087
2478 // Fill 'unused'
2479 write_words(sac_file, convert_to_word(iztype())); // 088
2480 write_words(sac_file, convert_to_word(iinst())); // 089
2481 write_words(sac_file, convert_to_word(istreg())); // 090
2482 write_words(sac_file, convert_to_word(ievreg())); // 091
2483 write_words(sac_file, convert_to_word(ievtyp())); // 092
2484 write_words(sac_file, convert_to_word(iqual())); // 093
2485 write_words(sac_file, convert_to_word(isynth())); // 094
2486 write_words(sac_file, convert_to_word(imagtyp())); // 095
2487 write_words(sac_file, convert_to_word(imagsrc())); // 096
2488 write_words(sac_file, convert_to_word(ibody())); // 097
2489 // Fill 'unused' (xcommon_skip_num)
2490 for (int i{0}; i < common_skip_num; ++i) { // 098-104
2491 write_words(sac_file, convert_to_word(ibody()));
2492 }
2493}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_string_headers()

void sacfmt::Trace::write_string_headers(std::ofstream * sac_file)const
private

Writes SAC-headers from words 110–157.

Note that this expects the position of the writer to be the beginning of word 110.

Note that this modifies the position of the writer to the end of word 157.

Writes all string headers.

Parameters
[in,out]sac_filestd::ofstream* SAC-file to be written.
2547 {
2548 // Strings are special
2549 std::array<char, static_cast<size_t>(2) * word_length> two_words{
2550 convert_to_words<sizeof(two_words)>(kstnm(), 2)};
2551 write_words(sac_file, std::vector<char>(two_words.begin(),
2552 two_words.end())); // 110-111
2553
2554 std::array<char, static_cast<size_t>(4) * word_length> four_words{
2555 convert_to_words<sizeof(four_words)>(kevnm(), 4)};
2556 write_words(sac_file, std::vector<char>(four_words.begin(),
2557 four_words.end())); // 112-115
2558
2559 two_words = convert_to_words<sizeof(two_words)>(khole(), 2);
2560 write_words(sac_file, std::vector<char>(two_words.begin(),
2561 two_words.end())); // 116-117
2562
2563 two_words = convert_to_words<sizeof(two_words)>(ko(), 2);
2564 write_words(sac_file, std::vector<char>(two_words.begin(),
2565 two_words.end())); // 118-119
2566
2567 two_words = convert_to_words<sizeof(two_words)>(ka(), 2);
2568 write_words(sac_file, std::vector<char>(two_words.begin(),
2569 two_words.end())); // 120-121
2570
2571 two_words = convert_to_words<sizeof(two_words)>(kt0(), 2);
2572 write_words(sac_file, std::vector<char>(two_words.begin(),
2573 two_words.end())); // 122-123
2574
2575 two_words = convert_to_words<sizeof(two_words)>(kt1(), 2);
2576 write_words(sac_file, std::vector<char>(two_words.begin(),
2577 two_words.end())); // 124-125
2578
2579 two_words = convert_to_words<sizeof(two_words)>(kt2(), 2);
2580 write_words(sac_file, std::vector<char>(two_words.begin(),
2581 two_words.end())); // 126-127
2582
2583 two_words = convert_to_words<sizeof(two_words)>(kt3(), 2);
2584 write_words(sac_file, std::vector<char>(two_words.begin(),
2585 two_words.end())); // 128-129
2586
2587 two_words = convert_to_words<sizeof(two_words)>(kt4(), 2);
2588 write_words(sac_file, std::vector<char>(two_words.begin(),
2589 two_words.end())); // 130-131
2590
2591 two_words = convert_to_words<sizeof(two_words)>(kt5(), 2);
2592 write_words(sac_file, std::vector<char>(two_words.begin(),
2593 two_words.end())); // 132-133
2594
2595 two_words = convert_to_words<sizeof(two_words)>(kt6(), 2);
2596 write_words(sac_file, std::vector<char>(two_words.begin(),
2597 two_words.end())); // 134-135
2598
2599 two_words = convert_to_words<sizeof(two_words)>(kt7(), 2);
2600 write_words(sac_file, std::vector<char>(two_words.begin(),
2601 two_words.end())); // 136-137
2602
2603 two_words = convert_to_words<sizeof(two_words)>(kt8(), 2);
2604 write_words(sac_file, std::vector<char>(two_words.begin(),
2605 two_words.end())); // 138-139
2606
2607 two_words = convert_to_words<sizeof(two_words)>(kt9(), 2);
2608 write_words(sac_file, std::vector<char>(two_words.begin(),
2609 two_words.end())); // 140-141
2610
2611 two_words = convert_to_words<sizeof(two_words)>(kf(), 2);
2612 write_words(sac_file, std::vector<char>(two_words.begin(),
2613 two_words.end())); // 142-143
2614
2615 two_words = convert_to_words<sizeof(two_words)>(kuser0(), 2);
2616 write_words(sac_file, std::vector<char>(two_words.begin(),
2617 two_words.end())); // 144-145
2618
2619 two_words = convert_to_words<sizeof(two_words)>(kuser1(), 2);
2620 write_words(sac_file, std::vector<char>(two_words.begin(),
2621 two_words.end())); // 146-147
2622
2623 two_words = convert_to_words<sizeof(two_words)>(kuser2(), 2);
2624 write_words(sac_file, std::vector<char>(two_words.begin(),
2625 two_words.end())); // 148-149
2626
2627 two_words = convert_to_words<sizeof(two_words)>(kcmpnm(), 2);
2628 write_words(sac_file, std::vector<char>(two_words.begin(),
2629 two_words.end())); // 150-151
2630
2631 two_words = convert_to_words<sizeof(two_words)>(knetwk(), 2);
2632 write_words(sac_file, std::vector<char>(two_words.begin(),
2633 two_words.end())); // 152-153
2634
2635 two_words = convert_to_words<sizeof(two_words)>(kdatrd(), 2);
2636 write_words(sac_file, std::vector<char>(two_words.begin(),
2637 two_words.end())); // 154-155
2638
2639 two_words = convert_to_words<sizeof(two_words)>(kinst(), 2);
2640 write_words(sac_file, std::vector<char>(two_words.begin(),
2641 two_words.end())); // 156-157
2642}
constexpr size_t word_length
Size (bytes) of fundamental data-chunk.
Definition sac_format.hpp:62
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xmaximum() [1/2]

float sacfmt::Trace::xmaximum()const
noexcept
1075 {
1076 return floats[sac_map.at(name::xmaximum)];
1077}
Here is the caller graph for this function:

◆ xmaximum() [2/2]

void sacfmt::Trace::xmaximum(float input)
noexcept
1324 {
1325 floats[sac_map.at(name::xmaximum)] = input;
1326}

◆ xminimum() [1/2]

float sacfmt::Trace::xminimum()const
noexcept
1072 {
1073 return floats[sac_map.at(name::xminimum)];
1074}
Here is the caller graph for this function:

◆ xminimum() [2/2]

void sacfmt::Trace::xminimum(float input)
noexcept
1321 {
1322 floats[sac_map.at(name::xminimum)] = input;
1323}

◆ ymaximum() [1/2]

float sacfmt::Trace::ymaximum()const
noexcept
1081 {
1082 return floats[sac_map.at(name::ymaximum)];
1083}
Here is the caller graph for this function:

◆ ymaximum() [2/2]

void sacfmt::Trace::ymaximum(float input)
noexcept
1330 {
1331 floats[sac_map.at(name::ymaximum)] = input;
1332}

◆ yminimum() [1/2]

float sacfmt::Trace::yminimum()const
noexcept
1078 {
1079 return floats[sac_map.at(name::yminimum)];
1080}
Here is the caller graph for this function:

◆ yminimum() [2/2]

void sacfmt::Trace::yminimum(float input)
noexcept
1327 {
1328 floats[sac_map.at(name::yminimum)] = input;
1329}

Member Data Documentation

◆ bools

std::array<bool, num_bool> sacfmt::Trace::bools {}
private

Boolean storage array.

1406{};

◆ data

std::array<std::vector<double>, num_data> sacfmt::Trace::data {}
private

std::vector<double> storage array.

1411{};

◆ doubles

std::array<double, num_double> sacfmt::Trace::doubles {}
private

Double storage array.

1402{};

◆ floats

std::array<float, num_float> sacfmt::Trace::floats {}
private

Float storage array.

1400{};

◆ ints

std::array<int, num_int> sacfmt::Trace::ints {}
private

Integer storage array.

1404{};

◆ strings

std::array<std::string, num_string> sacfmt::Trace::strings {}
private

String storage array.

1408{};

The documentation for this class was generated from the following files: