Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

Commit

Permalink
Merge pull request #24 from jpatton-USGS/working
Browse files Browse the repository at this point in the history
V.0.5.1 release candidate
  • Loading branch information
wyeck-usgs authored Apr 25, 2018
2 parents 1a8eeb9 + 0c6a35f commit 69ae3aa
Show file tree
Hide file tree
Showing 10 changed files with 96 additions and 26 deletions.
2 changes: 1 addition & 1 deletion glass-app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
2 changes: 1 addition & 1 deletion glass-broker-app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
2 changes: 1 addition & 1 deletion glasscore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
5 changes: 5 additions & 0 deletions glasscore/glasslib/include/Hypo.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
62 changes: 46 additions & 16 deletions glasscore/glasslib/src/Hypo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -1028,10 +1029,10 @@ void CHypo::clear() {
// lock mutex for this scope
std::lock_guard<std::recursive_mutex> 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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -2895,6 +2896,35 @@ void CHypo::setGlass(CGlass* glass) {
pGlass = glass;
}

void CHypo::setLat(double lat) {
std::lock_guard<std::recursive_mutex> hypoGuard(hypoMutex);
dLat = lat;
}

void CHypo::setLon(double lon) {
std::lock_guard<std::recursive_mutex> 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<std::recursive_mutex> hypoGuard(hypoMutex);
dZ = z;
}

void CHypo::setTOrg(double newTOrg) {
std::lock_guard<std::recursive_mutex> hypoGuard(hypoMutex);
tOrg = newTOrg;
}

void CHypo::setThresh(double thresh) {
std::lock_guard<std::recursive_mutex> hypoGuard(hypoMutex);
dThresh = thresh;
Expand Down
6 changes: 3 additions & 3 deletions glasscore/glasslib/src/HypoList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,7 @@ bool CHypoList::mergeCloseEvents(std::shared_ptr<CHypo> 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
Expand Down Expand Up @@ -1190,9 +1190,9 @@ bool CHypoList::mergeCloseEvents(std::shared_ptr<CHypo> 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),
Expand Down
1 change: 1 addition & 0 deletions glasscore/glasslib/src/Site.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <vector>
#include <algorithm>
#include <mutex>
#include <ctime>
#include "Glass.h"
#include "Pick.h"
#include "Site.h"
Expand Down
1 change: 1 addition & 0 deletions glasscore/glasslib/src/SiteList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <memory>
#include <mutex>
#include <vector>
#include <ctime>
#include "Glass.h"
#include "Site.h"
#include "WebList.h"
Expand Down
39 changes: 36 additions & 3 deletions glasscore/glassutil/src/Geo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion output/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 ----- #
Expand Down

0 comments on commit 69ae3aa

Please sign in to comment.