diff --git a/glass-app/CMakeLists.txt b/glass-app/CMakeLists.txt index c2978e2c..a5ecaa8c 100644 --- a/glass-app/CMakeLists.txt +++ b/glass-app/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required (VERSION 3.4) # ----- PROJECT VERSION NUMBER ----- # set (glass-app_VERSION_MAJOR 0) set (glass-app_VERSION_MINOR 5) -set (glass-app_VERSION_PATCH 0) +set (glass-app_VERSION_PATCH 1) # ----- PROJECT ----- # project (glass-app VERSION ${glass-app_VERSION_MAJOR}.${glass-app_VERSION_MINOR}.${glass-app_VERSION_PATCH}) diff --git a/glass-broker-app/CMakeLists.txt b/glass-broker-app/CMakeLists.txt index fa8cd68a..ddc1ee18 100644 --- a/glass-broker-app/CMakeLists.txt +++ b/glass-broker-app/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required (VERSION 3.4) # ----- PROJECT VERSION NUMBER ----- # set (glass-broker-app_VERSION_MAJOR 0) set (glass-broker-app_VERSION_MINOR 5) -set (glass-broker-app_VERSION_PATCH 0) +set (glass-broker-app_VERSION_PATCH 1) # ----- PROJECT ----- # project (glass-broker-app VERSION ${glass-broker-app_VERSION_MAJOR}.${glass-broker-app_VERSION_MINOR}.${glass-broker-app_VERSION_PATCH}) diff --git a/glasscore/CMakeLists.txt b/glasscore/CMakeLists.txt index 04a1fe19..48e18eea 100644 --- a/glasscore/CMakeLists.txt +++ b/glasscore/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required (VERSION 3.4) # ----- PROJECT VERSION NUMBER ----- # set (glasscore_VERSION_MAJOR 0) set (glasscore_VERSION_MINOR 5) -set (glasscore_VERSION_PATCH 0) +set (glasscore_VERSION_PATCH 1) # ----- PROJECT ----- # project (glasscore VERSION ${glasscore_VERSION_MAJOR}.${glasscore_VERSION_MINOR}.${glasscore_VERSION_PATCH}) diff --git a/glasscore/glasslib/include/Hypo.h b/glasscore/glasslib/include/Hypo.h index 396166d9..d9aad97d 100644 --- a/glasscore/glasslib/include/Hypo.h +++ b/glasscore/glasslib/include/Hypo.h @@ -817,6 +817,11 @@ class CHypo { void lockForProcessing(); void unlockAfterProcessing(); + void setLat(double lat); + void setLon(double lon); + void setZ(double z); + void setTOrg(double newTOrg); + private: /** * \brief A pointer to the main CGlass class, used to send output, diff --git a/glasscore/glasslib/src/Hypo.cpp b/glasscore/glasslib/src/Hypo.cpp index dc310708..35e77bf4 100644 --- a/glasscore/glasslib/src/Hypo.cpp +++ b/glasscore/glasslib/src/Hypo.cpp @@ -505,10 +505,11 @@ void CHypo::annealingLocate(int nIter, double dStart, double dStop, valBest = val; // set the hypo location/depth/time from the new best // locaton/depth/time - dLat = xlat; - dLon = xlon; - dZ = xz; - tOrg = oT; + setLat(xlat); + setLon(xlon); + setZ(xz); + setTOrg(oT); + // save this perturbation to the overall change ddx += dx; ddy += dy; @@ -640,10 +641,10 @@ void CHypo::annealingLocateResidual(int nIter, double dStart, double dStop, valBest = val; // set the hypo location/depth/time from the new best // locaton/depth/time - dLat = xlat; - dLon = xlon; - dZ = xz; - tOrg = oT; + setLat(xlat); + setLon(xlon); + setZ(xz); + setTOrg(oT); ddx += dx; ddy += dy; ddz += dz; @@ -1028,10 +1029,10 @@ void CHypo::clear() { // lock mutex for this scope std::lock_guard guard(hypoMutex); - dLat = 0.0; - dLon = 0.0; - dZ = 0.0; - tOrg = 0.0; + setLat(0.0); + setLon(0.0); + setZ(0.0); + setTOrg(0.0); sPid = ""; nCut = 0; dThresh = 0.0; @@ -1908,10 +1909,10 @@ bool CHypo::initialize(double lat, double lon, double z, double time, clear(); - dLat = lat; - dLon = lon; - dZ = z; - tOrg = time; + setLat(lat); + setLon(lon); + setZ(z); + setTOrg(time); sPid = pid; sWebName = web; dBayes = bayes; @@ -2895,6 +2896,35 @@ void CHypo::setGlass(CGlass* glass) { pGlass = glass; } +void CHypo::setLat(double lat) { + std::lock_guard hypoGuard(hypoMutex); + dLat = lat; +} + +void CHypo::setLon(double lon) { + std::lock_guard hypoGuard(hypoMutex); + // longitude wrap check + if (lon > 180.0) { + // lon is greater than 180 + dLon = lon - 360.0; + } else if (lon < -180.0) { + // lon is less than -180 + dLon = lon + 360.0; + } else { + dLon = lon; + } +} + +void CHypo::setZ(double z) { + std::lock_guard hypoGuard(hypoMutex); + dZ = z; +} + +void CHypo::setTOrg(double newTOrg) { + std::lock_guard hypoGuard(hypoMutex); + tOrg = newTOrg; +} + void CHypo::setThresh(double thresh) { std::lock_guard hypoGuard(hypoMutex); dThresh = thresh; diff --git a/glasscore/glasslib/src/HypoList.cpp b/glasscore/glasslib/src/HypoList.cpp index 79343ac5..99a00c99 100644 --- a/glasscore/glasslib/src/HypoList.cpp +++ b/glasscore/glasslib/src/HypoList.cpp @@ -1045,7 +1045,7 @@ bool CHypoList::mergeCloseEvents(std::shared_ptr hypo) { } char sLog[1024]; // logging string - double distanceCut = 1.5; // distance difference to try merging events + double distanceCut = 2.0; // distance difference to try merging events // in degrees double timeCut = 30.; // origin time difference to merge events double delta; // this holds delta distance @@ -1190,9 +1190,9 @@ bool CHypoList::mergeCloseEvents(std::shared_ptr hypo) { glassutil::CLogit::log(sLog); - // check that bayestack is at least 85% of sum of others + // check that bayestack is at least 70% of sum of others if (hypo3->getBayes() - > (.85 * (hypo->getBayes() + hypo2->getBayes()))) { + > (.70 * (hypo->getBayes() + hypo2->getBayes()))) { snprintf( sLog, sizeof(sLog), diff --git a/glasscore/glasslib/src/Site.cpp b/glasscore/glasslib/src/Site.cpp index 9231a7df..6c960368 100644 --- a/glasscore/glasslib/src/Site.cpp +++ b/glasscore/glasslib/src/Site.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include "Glass.h" #include "Pick.h" #include "Site.h" diff --git a/glasscore/glasslib/src/SiteList.cpp b/glasscore/glasslib/src/SiteList.cpp index 438c6f41..c5e9c1bd 100644 --- a/glasscore/glasslib/src/SiteList.cpp +++ b/glasscore/glasslib/src/SiteList.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include "Glass.h" #include "Site.h" #include "WebList.h" diff --git a/glasscore/glassutil/src/Geo.cpp b/glasscore/glassutil/src/Geo.cpp index ecf53465..0e35b824 100644 --- a/glasscore/glassutil/src/Geo.cpp +++ b/glasscore/glassutil/src/Geo.cpp @@ -62,7 +62,18 @@ void CGeo::initialize(double lat, double lon, double rad, double cartX, void CGeo::setGeographic(double lat, double lon, double r) { // convert latitude dLat = RAD2DEG * atan(0.993277 * tan(DEG2RAD * lat)); - dLon = lon; + + // longitude wrap check + if (lon > 180.0) { + // dLon is greater than 180 + dLon = lon - 360.0; + } else if (lon < -180.0) { + // dLon is less than -180 + dLon = lon + 360.0; + } else { + dLon = lon; + } + dRad = r; // compute Cartesian coordinates @@ -81,7 +92,18 @@ void CGeo::setGeographic(double lat, double lon, double r) { // Initialize geocentric coordinates void CGeo::setGeocentric(double lat, double lon, double r) { dLat = lat; - dLon = lon; + + // longitude wrap check + if (lon > 180.0) { + // dLon is greater than 180 + dLon = lon - 360.0; + } else if (lon < -180.0) { + // dLon is less than -180 + dLon = lon + 360.0; + } else { + dLon = lon; + } + dRad = r; // compute Cartesian coordinates @@ -136,7 +158,18 @@ void CGeo::getGeographic(double *lat, double *lon, double *r) { void CGeo::getGeocentric(double *lat, double *lon, double *r) { *lat = dLat; - *lon = dLon; + + // longitude wrap check + if (dLon > 180.0) { + // dLon is greater than 180 + *lon = dLon - 360.0; + } else if (dLon < -180.0) { + // dLon is less than -180 + *lon = dLon + 360.0; + } else { + *lon = dLon; + } + *r = dRad; } diff --git a/output/CMakeLists.txt b/output/CMakeLists.txt index 626b7774..c9c1b363 100644 --- a/output/CMakeLists.txt +++ b/output/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required (VERSION 3.4) # ----- PROJECT VERSION NUMBER ----- # set (output_VERSION_MAJOR 0) -set (output_VERSION_MINOR 1) +set (output_VERSION_MINOR 3) set (output_VERSION_PATCH 0) # ----- PROJECT ----- #