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 #30 from jpatton-USGS/remove-props
Browse files Browse the repository at this point in the history
removed property files
  • Loading branch information
jmfee-usgs authored Mar 26, 2019
2 parents 86f9406 + ace0320 commit 5b4e60b
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 230 deletions.
10 changes: 6 additions & 4 deletions src/gov/usgs/traveltime/AuxTtRef.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,13 @@ public class AuxTtRef {
* @param readStats If true, read the phase statistics
* @param readEllip If true, read the ellipticity corrections
* @param readTopo If true, read the topography file
* @param modelPath If not null, path to model files
* @throws IOException If opens fail
* @throws ClassNotFoundException Serialization input fails
*/
@SuppressWarnings("unchecked")
public AuxTtRef(boolean readStats, boolean readEllip, boolean readTopo)
public AuxTtRef(boolean readStats, boolean readEllip, boolean readTopo,
String modelPath)
throws IOException, ClassNotFoundException {
String[] absNames;
BufferedInputStream inGroup, inStats, inEllip;
Expand All @@ -83,10 +85,10 @@ public AuxTtRef(boolean readStats, boolean readEllip, boolean readTopo)
FileLock lock;
EllipDeps eDepth;

// Set up the properties.
if(TauUtil.modelPath == null) {
TauUtil.getProperties();
if (modelPath != null) {
TauUtil.modelPath = modelPath;
}

// Create absolute path names.
absNames = new String[fileNames.length];
for(int j=0; j<fileNames.length; j++) {
Expand Down
200 changes: 0 additions & 200 deletions src/gov/usgs/traveltime/CWBProperties.java

This file was deleted.

6 changes: 4 additions & 2 deletions src/gov/usgs/traveltime/TTSessionLocal.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@ public class TTSessionLocal{
* @param readStats If true, read the phase statistics
* @param readEllip If true, read the ellipticity corrections
* @param readTopo If true, read the topography file
* @param modelPath If not null, path to model files
* @throws IOException If the auxiliary data reads fail
*/
public TTSessionLocal(boolean readStats, boolean readEllip, boolean readTopo)
public TTSessionLocal(boolean readStats, boolean readEllip, boolean readTopo,
String modelPath)
throws IOException {
// Read in data common to all models.
try {
auxTT = new AuxTtRef(readStats, readEllip, readTopo);
auxTT = new AuxTtRef(readStats, readEllip, readTopo, modelPath);
} catch (IOException | ClassNotFoundException e1) {
System.out.println("Unable to read auxiliary data.");
e1.printStackTrace();
Expand Down
18 changes: 2 additions & 16 deletions src/gov/usgs/traveltime/TauUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -180,23 +180,9 @@ public class TauUtil {
private static TreeMap<String, Integer> unique;

/**
* Path of the travel time/locator properties file.
* Paths for model files.
*/
private static String propFile = "Properties"+CWBProperties.FS+"traveltime.prop";
/**
* Paths for model and event files set in getProperties.
*/
public static String modelPath;

/**
* Read the travel time properties file and set up paths to the model
* and event files.
*/
public static void getProperties() {
CWBProperties.loadProperties(propFile);
modelPath = CWBProperties.getProperty("modelPath");
// CWBProperties.prtProperties();
}
public static String modelPath = "./models/";

/**
* Build a path to a model file.
Expand Down
4 changes: 3 additions & 1 deletion src/gov/usgs/traveltime/TtMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ public static void main(String[] args) throws Exception {

if(local) {
// Initialize the local travel-time manager.
ttLocal = new TTSessionLocal(true, true, true);
// NOTE assumes default model path for now, need to figure out
// where to get this path. Cmd line arg?
ttLocal = new TTSessionLocal(true, true, true, null);
// Generate a list of available Earth models.
String[] models = TauUtil.availableModels();
if(models.length > 0) {
Expand Down
4 changes: 3 additions & 1 deletion src/gov/usgs/traveltime/session/TTSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,9 @@ private void makeTTSession(String earthModel, double sourceDepth, String[] phase
// Read in data common to all models.
if (auxtt == null) {
prta(ttag+" create AuxTtRef ");
auxtt = new AuxTtRef(true, true, true);
// NOTE assumes default model path for now, need to figure out
// where to get this path. Cmd line arg?
auxtt = new AuxTtRef(true, true, true, null);
}

// See if we know this model.
Expand Down
5 changes: 0 additions & 5 deletions src/gov/usgs/traveltime/tables/EarthModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,6 @@ public EarthModel(String earthModel, boolean isCubic) {
model = new ArrayList<ModelSample>();
shells = new ArrayList<ModelShell>();
interp = new ModelInterp(model, shells, isCubic);
// Set up the properties.
if(TauUtil.modelPath == null) {
TauUtil.getProperties();

}
}

/**
Expand Down
4 changes: 3 additions & 1 deletion src/gov/usgs/traveltime/tables/ReModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ public static void main(String[] args) throws Exception {
TauUtil.model("phases.txt"));
if(status == TtStatus.SUCCESS) {
// Build the branch reference classes.
auxTT = new AuxTtRef(true, false, false);
// NOTE assumes default model path for now, need to figure out
// where to get this path. Cmd line arg?
auxTT = new AuxTtRef(true, false, false, null);
allRef = make.fillAllBrnRef(null, auxTT);
System.out.format("\n***** Table generation time: %5.3f *****\n",
0.001*(System.currentTimeMillis()-sysTime));
Expand Down

0 comments on commit 5b4e60b

Please sign in to comment.