Skip to content

Commit

Permalink
Removed outdated leaflet-lite.js dependency.
Browse files Browse the repository at this point in the history
Added a zero intercept line for the path plot and made the inital progress bar for calibration indeterminate.
Generate Evids in YYJJJHHmm (from YYJJJHH) format to maintain compatability with SWFT.
Force UTC everywhere, including on insert into the DB.
Added a little mouse click handler to the load failure progress bar as a shortcut to the error report.
Report the full file path on a failed conversion.
Initial implementation of better error reporting during loads.
Updated the data example in the README to be less ambiguous w.r.t. literals vs. regex captures.
Some spring abstract classes are now deprecated due to default methods; updated.
Bumping up to the GA release of Spring Boot 2.0.2 for bugfixes and improvements.
  • Loading branch information
justinbarno committed May 16, 2018
1 parent 11633d6 commit 47aede4
Show file tree
Hide file tree
Showing 54 changed files with 2,055 additions and 1,447 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,18 @@ We don't presently deploy versioned artifacts into a public repository like the
#### **As a single runnable JAR**

```shell
java -jar coda-calibration/calibration-standalone/target/calibration-standalone-1.0.1-runnable.jar
java -jar coda-calibration/calibration-standalone/target/calibration-standalone-1.0.2-runnable.jar
```

#### **GUI alone**

```shell
java -jar coda-calibration/calibration-gui/target/calibration-gui-1.0.1-runnable.jar
java -jar coda-calibration/calibration-gui/target/calibration-gui-1.0.2-runnable.jar
```
#### **Calibration REST service alone**

```shell
java -jar coda-calibration/calibration-service/application/target/application-1.0.1-runnable.jar
java -jar coda-calibration/calibration-service/application/target/application-1.0.2-runnable.jar
```

#### A note about HTTPS
Expand Down Expand Up @@ -89,7 +89,7 @@ As of 1.0, CCT is capable of loading four basic file types

```text
STATION_CHANNEL_EVENTID_LOWFREQ_HIGHFREQ_UNITS_.*.env
(e.g. ANMO.STACK.999999_1.0_1.5_VEL_.env)
(e.g. ANMO_STACK_999999_1.0_1.5_VEL_.env)
```

2. Reference events
Expand Down
10 changes: 5 additions & 5 deletions calibration-gui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>gov.llnl.gnem.apps.coda.calibration</groupId>
<artifactId>calibration-gui</artifactId>
<version>1.0.1</version>
<version>1.0.2</version>
<packaging>jar</packaging>

<name>calibration-gui</name>
Expand Down Expand Up @@ -54,7 +54,7 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.RC2</version>
<version>2.0.2.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand All @@ -65,12 +65,12 @@
<dependency>
<groupId>gov.llnl.gnem.apps.coda.calibration</groupId>
<artifactId>externals</artifactId>
<version>1.0.1</version>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>gov.llnl.gnem.apps.coda.calibration</groupId>
<artifactId>model</artifactId>
<version>1.0.1</version>
<version>1.0.2</version>
<exclusions>
<exclusion>
<groupId>org.eclipse.persistence</groupId>
Expand Down Expand Up @@ -202,7 +202,7 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.0.0.RC2</version>
<version>2.0.2.RELEASE</version>
<configuration>
<executable>true</executable>
<mainClass>${start-class}</mainClass>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import gov.llnl.gnem.apps.coda.calibration.gui.controllers.ReferenceEventLoadingController;
import gov.llnl.gnem.apps.coda.calibration.gui.controllers.WaveformLoadingController;
import gov.llnl.gnem.apps.coda.calibration.gui.data.client.api.CalibrationClient;
import gov.llnl.gnem.apps.coda.calibration.gui.plotting.WaveformGui;
import gov.llnl.gnem.apps.coda.calibration.gui.events.ShowFailureReportEvent;
import gov.llnl.gnem.apps.coda.calibration.gui.util.CalibrationProgressListener;
import gov.llnl.gnem.apps.coda.calibration.gui.util.ProgressMonitor;
import gov.llnl.gnem.apps.coda.calibration.model.domain.messaging.CalibrationStatusEvent;
Expand Down Expand Up @@ -76,7 +76,6 @@ public class CodaGuiController {
private EventBus bus;

private ProgressGui loadingGui;
private WaveformGui waveformGui;

private Map<Long, ProgressMonitor> monitors = new HashMap<>();

Expand All @@ -88,13 +87,12 @@ public class CodaGuiController {

@Autowired
public CodaGuiController(WaveformLoadingController waveformLoadingController, CodaParamLoadingController codaParamLoadingController, ReferenceEventLoadingController refEventLoadingController,
CalibrationClient calibrationClient, WaveformGui waveformGui, EventBus bus) throws IOException {
CalibrationClient calibrationClient, EventBus bus) throws IOException {
super();
this.waveformLoadingController = waveformLoadingController;
this.codaParamLoadingController = codaParamLoadingController;
this.refEventLoadingController = refEventLoadingController;
this.calibrationClient = calibrationClient;
this.waveformGui = waveformGui;
this.bus = bus;
sacDirFileChooser.setTitle("Coda STACK File Directory");
sacFileChooser.getExtensionFilters().add(new ExtensionFilter("Coda STACK Files (.sac,.env)", "*.sac", "*.env"));
Expand All @@ -118,8 +116,8 @@ private void openWaveformLoadingWindow() {
}

@FXML
private void openWaveformDisplay() {
waveformGui.show();
private void openFailureReportDisplay() {
bus.post(new ShowFailureReportEvent());
}

@FXML
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@
import java.io.IOException;
import java.lang.reflect.Method;
import java.net.URL;
import java.util.TimeZone;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import java.util.jar.Attributes;
import java.util.jar.Manifest;

import javax.annotation.PostConstruct;
import javax.swing.SwingUtilities;

import org.slf4j.Logger;
Expand Down Expand Up @@ -52,6 +54,11 @@ public class GuiApplication extends Application {

private Stage primaryStage;

@PostConstruct
void started() {
TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
}

public GuiApplication() {
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
/*
* Copyright (c) 2018, Lawrence Livermore National Security, LLC. Produced at the Lawrence Livermore National Laboratory
* CODE-743439.
* All rights reserved.
* This file is part of CCT. For details, see https://github.com/LLNL/coda-calibration-tool.
*
* Licensed under the Apache License, Version 2.0 (the “Licensee”); you may not use this file except in compliance with the License. You may obtain a copy of the License at:
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and limitations under the license.
*
* This work was performed under the auspices of the U.S. Department of Energy
* by Lawrence Livermore National Laboratory under Contract DE-AC52-07NA27344.
*/
package gov.llnl.gnem.apps.coda.calibration.gui.controllers;

import java.io.IOException;
import java.util.function.Function;
import java.util.stream.Collectors;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.google.common.eventbus.EventBus;
import com.google.common.eventbus.Subscribe;

import gov.llnl.gnem.apps.coda.calibration.gui.events.LoadStartingEvent;
import gov.llnl.gnem.apps.coda.calibration.gui.events.ShowFailureReportEvent;
import gov.llnl.gnem.apps.coda.calibration.gui.util.CellBindingUtils;
import gov.llnl.gnem.apps.coda.calibration.model.domain.messaging.PassFailEvent;
import javafx.application.Platform;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.text.Font;
import javafx.stage.Stage;
import javafx.stage.StageStyle;

@Component
public class FailureReportController {

private final Logger log = LoggerFactory.getLogger(this.getClass());

private Parent root;
private Scene scene;
private Stage stage;

@FXML
TableView<String> tableView;

@FXML
TableColumn<String, String> errorCol;

private ObservableList<String> errors = FXCollections.observableArrayList();

private EventBus bus;

@Autowired
public FailureReportController(EventBus bus) {
this.bus = bus;
bus.register(this);
Platform.runLater(() -> {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/fxml/FailureReport.fxml"));
fxmlLoader.setController(this);
stage = new Stage(StageStyle.DECORATED);
Font.loadFont(getClass().getResource("/fxml/MaterialIcons-Regular.ttf").toExternalForm(), 18);
try {
root = fxmlLoader.load();
scene = new Scene(root);
stage.setScene(scene);
} catch (IOException e) {
throw new IllegalStateException(e);
}
});
}

@Subscribe
private void listener(LoadStartingEvent event) {
errors.clear();
}

@Subscribe
private void listener(ShowFailureReportEvent event) {
Platform.runLater(() -> {
stage.show();
stage.toFront();
});
}

@Subscribe
private void listener(PassFailEvent event) {
if (event.getResult() != null && !event.getResult().isSuccess()) {
errors.addAll(event.getResult().getErrors().stream().map(e -> e.getMessage()).collect(Collectors.toList()));
}
}

@FXML
public void initialize() {
CellBindingUtils.attachTextCellFactoriesString(errorCol, Function.identity());
tableView.setItems(errors);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,18 @@
import javafx.scene.control.Tooltip;
import javafx.scene.layout.StackPane;
import llnl.gnem.core.gui.plotting.MouseOverPlotObject;
import llnl.gnem.core.gui.plotting.PaintMode;
import llnl.gnem.core.gui.plotting.PenStyle;
import llnl.gnem.core.gui.plotting.jmultiaxisplot.JMultiAxisPlot;
import llnl.gnem.core.gui.plotting.jmultiaxisplot.JSubplot;
import llnl.gnem.core.gui.plotting.plotobject.Circle;
import llnl.gnem.core.gui.plotting.plotobject.Line;
import llnl.gnem.core.gui.plotting.plotobject.PlotObject;
import llnl.gnem.core.gui.plotting.plotobject.Square;
import llnl.gnem.core.gui.plotting.plotobject.Symbol;
import llnl.gnem.core.gui.plotting.plotobject.TriangleDn;
import llnl.gnem.core.gui.plotting.plotobject.TriangleUp;
import llnl.gnem.core.util.SeriesMath;
import llnl.gnem.core.util.Geometry.EModel;

@Component
Expand Down Expand Up @@ -382,7 +386,7 @@ private void plotSd() {
if (plotObj.getYcenter() < ymin) {
ymin = plotObj.getYcenter();
}
plot.AddPlotObject(plotObj);
plot.AddPlotObject(plotObj, 9);

if (plotObj2.getXcenter() > xmax) {
xmax = plotObj2.getXcenter();
Expand Down Expand Up @@ -483,7 +487,7 @@ private void plotBeforeAfter() {
if (plotObj.getYcenter() < xmin) {
xmin = plotObj.getYcenter();
}
plot.AddPlotObject(plotObj);
plot.AddPlotObject(plotObj, 9);

if (plotObj2.getXcenter() > xmax) {
xmax = plotObj2.getXcenter();
Expand All @@ -503,9 +507,22 @@ private void plotBeforeAfter() {
}
}


double paddedXmin = xmin - (xmin * .1);
double paddedXmax = xmax + (xmax * .1);
if (xmax != null) {
plot.SetAxisLimits(xmin - (xmin * .1), xmax + (xmax * .1), xmin - (xmin * .1), xmax + (xmax * .1));
plot.SetAxisLimits(paddedXmin, paddedXmax, paddedXmin, paddedXmax);
}
int points = 50;
double dx = (plot.getXaxis().getMax()) / (points - 1);
float[] xy = new float[points];
for (int i = 0; i < points; i++) {
xy[i] = (float) (0 + (dx * i));
}
Line line = new Line(xy, xy, Color.black, PaintMode.COPY, PenStyle.DASH, 2);

plot.AddPlotObject(line, 1);

if (stationDistance == null) {
stationDistance = 0.0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import java.io.IOException;

import gov.llnl.gnem.apps.coda.calibration.gui.util.ClickUtils;
import gov.llnl.gnem.apps.coda.calibration.gui.util.ProgressMonitor;
import javafx.application.Platform;
import javafx.beans.binding.Bindings;
Expand Down Expand Up @@ -74,8 +75,9 @@ public TableCell<ProgressMonitor, Node> call(TableColumn<ProgressMonitor, Node>
return new TableCell<ProgressMonitor, Node>() {
@Override
protected void updateItem(Node item, boolean empty) {
if (item == getItem())
if (item == getItem()) {
return;
}
super.updateItem(item, empty);

if (item == null) {
Expand All @@ -90,6 +92,11 @@ protected void updateItem(Node item, boolean empty) {
}
});
progressTable.setItems(monitors);
progressTable.getSelectionModel().selectedItemProperty().addListener((obs, prevSelection, newSelection) -> {
if (newSelection != null) {
ClickUtils.clickNode(newSelection);
}
});
} catch (IOException e) {
throw new IllegalStateException(e);
}
Expand Down
Loading

0 comments on commit 47aede4

Please sign in to comment.