From 2e33bbf045b7dce2c028a45d25ef76275453e1d0 Mon Sep 17 00:00:00 2001 From: Justin Barno Date: Thu, 22 Aug 2019 10:01:40 -0700 Subject: [PATCH] CCT 1.0.6 Bugfixes and stability release. Site calibration incorrectly handled weighting when three conditions are met on loaded data, see SiteCalibrationServiceImplTest.java for details. Envelope tool was not blocking correctly while file IO was finishing which could lead to dropped channels during stacking under certain circumstances. Envelope tool was interpolating too early in the processing chain and producing oversmoothing if using the default configuration. Fixed a series of unnecessary overhead objects being created during signal processing which was using more RAM than needed (especially noticable while making envelopes). Fixed a very rare synchronization bug with map icon painting. Fixed a path optimization dimension mismatch introduced by parallelizing code that was incorrectly caching a shared variable. --- README.md | 6 +- calibration-gui/pom.xml | 2 +- .../gui/plotting/CodaWaveformPlot.java | 4 +- .../calibration-application/pom.xml | 2 +- .../calibration-integration/pom.xml | 2 +- calibration-service/calibration-model/pom.xml | 2 +- .../calibration-repository/pom.xml | 2 +- .../calibration-service-api/pom.xml | 2 +- .../calibration-service-impl/pom.xml | 2 +- .../service/impl/Joint1DPathCorrection.java | 8 +- .../impl/SiteCalibrationServiceImpl.java | 48 +++- .../impl/SiteCalibrationServiceImplTest.java | 216 ++++++++++++++++++ calibration-service/pom.xml | 2 +- calibration-standalone/pom.xml | 2 +- common-gui/pom.xml | 2 +- .../AbstractSeismogramSaveLoadController.java | 15 +- common-service/common-application/pom.xml | 2 +- common-service/common-model/pom.xml | 2 +- .../common/model/domain/SyntheticCoda.java | 37 ++- .../coda/common/model/domain/Waveform.java | 37 ++- common-service/common-repository/pom.xml | 2 +- common-service/common-service-api/pom.xml | 2 +- common-service/common-service-impl/pom.xml | 2 +- common-service/pom.xml | 2 +- envelope-gui/pom.xml | 2 +- .../WaveformLoadingController.java | 43 ++-- envelope-service/envelope-application/pom.xml | 2 +- envelope-service/envelope-model/pom.xml | 2 +- envelope-service/envelope-repository/pom.xml | 2 +- envelope-service/envelope-service-api/pom.xml | 2 +- .../envelope-service-impl/pom.xml | 2 +- .../impl/EnvelopeCreationServiceImpl.java | 3 +- .../service/impl/EnvelopeStacker.java | 2 +- envelope-service/pom.xml | 2 +- envelope-standalone/pom.xml | 2 +- externals/pom.xml | 2 +- .../core/waveform/seismogram/TimeSeries.java | 19 +- mapping/pom.xml | 2 +- .../apps/coda/common/mapping/LeafletMap.java | 8 +- pom.xml | 2 +- 40 files changed, 408 insertions(+), 92 deletions(-) create mode 100644 calibration-service/calibration-service-impl/src/test/java/gov/llnl/gnem/apps/coda/calibration/service/impl/SiteCalibrationServiceImplTest.java diff --git a/README.md b/README.md index 2b855069..7c1500fc 100644 --- a/README.md +++ b/README.md @@ -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.5-runnable.jar +java -jar coda-calibration/calibration-standalone/target/calibration-standalone-1.0.6-runnable.jar ``` #### **GUI alone** ```shell -java -jar coda-calibration/calibration-gui/target/calibration-gui-1.0.5-runnable.jar +java -jar coda-calibration/calibration-gui/target/calibration-gui-1.0.6-runnable.jar ``` #### **Calibration REST service alone** ```shell -java -jar coda-calibration/calibration-service/application/target/application-1.0.5-runnable.jar +java -jar coda-calibration/calibration-service/application/target/application-1.0.6-runnable.jar ``` #### A note about HTTPS diff --git a/calibration-gui/pom.xml b/calibration-gui/pom.xml index bc74794c..f35aa982 100644 --- a/calibration-gui/pom.xml +++ b/calibration-gui/pom.xml @@ -7,7 +7,7 @@ gov.llnl.gnem.apps.coda.calibration coda-calibration - 1.0.5 + 1.0.6 calibration-gui diff --git a/calibration-gui/src/main/java/gov/llnl/gnem/apps/coda/calibration/gui/plotting/CodaWaveformPlot.java b/calibration-gui/src/main/java/gov/llnl/gnem/apps/coda/calibration/gui/plotting/CodaWaveformPlot.java index a3a30cb5..ded9322b 100644 --- a/calibration-gui/src/main/java/gov/llnl/gnem/apps/coda/calibration/gui/plotting/CodaWaveformPlot.java +++ b/calibration-gui/src/main/java/gov/llnl/gnem/apps/coda/calibration/gui/plotting/CodaWaveformPlot.java @@ -114,7 +114,7 @@ public void setWaveform(Waveform waveform, SyntheticCoda synth) { this.clear(); pickLineMap.clear(); - if (waveform != null && waveform.getSegment() != null && waveform.getBeginTime() != null) { + if (waveform != null && waveform.hasData() && waveform.getBeginTime() != null) { final TimeT beginTime = new TimeT(waveform.getBeginTime()); final float[] waveformSegment = doublesToFloats(waveform.getSegment()); final TimeSeries rawSeries = new TimeSeries(waveformSegment, waveform.getSampleRate(), beginTime); @@ -200,7 +200,7 @@ public void setWaveform(Waveform waveform, SyntheticCoda synth) { try { velocityClient.getNoiseForWaveform(waveform.getId()).subscribe(measurement -> { if (measurement != null && measurement.getNoiseEndSecondsFromOrigin() != 0.0) { - int lineLength = (int) (waveform.getSegment().length / waveform.getSampleRate()) + 10; + int lineLength = (int) (waveform.getSegmentLength() / waveform.getSampleRate()) + 10; subplot.AddPlotObject(createFixedLine(measurement.getNoiseLevel(), lineLength, Color.BLACK, PenStyle.DASH), PLOT_ORDERING.NOISE_LINE.getZOrder()); subplot.AddPlotObject(createFixedLine(measurement.getNoiseLevel() + params.getMinSnr(), lineLength, Color.BLACK, PenStyle.SOLID), PLOT_ORDERING.NOISE_LINE.getZOrder()); repaint(); diff --git a/calibration-service/calibration-application/pom.xml b/calibration-service/calibration-application/pom.xml index 5b7cbf57..0dd3d805 100644 --- a/calibration-service/calibration-application/pom.xml +++ b/calibration-service/calibration-application/pom.xml @@ -5,7 +5,7 @@ gov.llnl.gnem.apps.coda.calibration calibration-service - 1.0.5 + 1.0.6 4.0.0 diff --git a/calibration-service/calibration-integration/pom.xml b/calibration-service/calibration-integration/pom.xml index 91c47cc0..2bc2f5f4 100644 --- a/calibration-service/calibration-integration/pom.xml +++ b/calibration-service/calibration-integration/pom.xml @@ -4,7 +4,7 @@ gov.llnl.gnem.apps.coda.calibration calibration-service - 1.0.5 + 1.0.6 4.0.0 diff --git a/calibration-service/calibration-model/pom.xml b/calibration-service/calibration-model/pom.xml index c3b28761..e24fec06 100644 --- a/calibration-service/calibration-model/pom.xml +++ b/calibration-service/calibration-model/pom.xml @@ -5,7 +5,7 @@ gov.llnl.gnem.apps.coda.calibration calibration-service - 1.0.5 + 1.0.6 4.0.0 diff --git a/calibration-service/calibration-repository/pom.xml b/calibration-service/calibration-repository/pom.xml index 394535ce..29fc4c70 100644 --- a/calibration-service/calibration-repository/pom.xml +++ b/calibration-service/calibration-repository/pom.xml @@ -5,7 +5,7 @@ gov.llnl.gnem.apps.coda.calibration calibration-service - 1.0.5 + 1.0.6 4.0.0 diff --git a/calibration-service/calibration-service-api/pom.xml b/calibration-service/calibration-service-api/pom.xml index c1cff6a2..23235dfc 100644 --- a/calibration-service/calibration-service-api/pom.xml +++ b/calibration-service/calibration-service-api/pom.xml @@ -4,7 +4,7 @@ gov.llnl.gnem.apps.coda.calibration calibration-service - 1.0.5 + 1.0.6 4.0.0 diff --git a/calibration-service/calibration-service-impl/pom.xml b/calibration-service/calibration-service-impl/pom.xml index 6cc6bae5..ac56c9f9 100644 --- a/calibration-service/calibration-service-impl/pom.xml +++ b/calibration-service/calibration-service-impl/pom.xml @@ -5,7 +5,7 @@ gov.llnl.gnem.apps.coda.calibration calibration-service - 1.0.5 + 1.0.6 4.0.0 diff --git a/calibration-service/calibration-service-impl/src/main/java/gov/llnl/gnem/apps/coda/calibration/service/impl/Joint1DPathCorrection.java b/calibration-service/calibration-service-impl/src/main/java/gov/llnl/gnem/apps/coda/calibration/service/impl/Joint1DPathCorrection.java index d1be3b10..f17067ef 100644 --- a/calibration-service/calibration-service-impl/src/main/java/gov/llnl/gnem/apps/coda/calibration/service/impl/Joint1DPathCorrection.java +++ b/calibration-service/calibration-service-impl/src/main/java/gov/llnl/gnem/apps/coda/calibration/service/impl/Joint1DPathCorrection.java @@ -99,7 +99,7 @@ public class Joint1DPathCorrection implements PathCalibrationService { private static final double efact = Math.log10(Math.E); private PathCalibrationMeasurementService pathCalibrationMeasurementService; - private List paramPoints; + @Value(value = "${path.use-aggressive-opt:true}") private boolean agressiveOptimization; @@ -387,9 +387,6 @@ public double costFunction(Map> evidStaD * if optimizationBounds.length < 2 */ private List makeParamPoints(int numberOfTerms, boolean agressiveOptimization, double[]... optimizationBounds) { - if (paramPoints != null && !paramPoints.isEmpty() && paramPoints.get(0).length == numberOfTerms) { - return paramPoints; - } if (optimizationBounds.length < 2) { throw new IllegalStateException("Optmization bounds needs at least two entries for the low and high boundary conditions. Got: " + optimizationBounds.length); } @@ -421,8 +418,7 @@ private List makeParamPoints(int numberOfTerms, boolean agressiveOptim params.add(param); } - paramPoints = params; - return paramPoints; + return params; } private int[] nextIndex(int[] selectionIndex, int base) { diff --git a/calibration-service/calibration-service-impl/src/main/java/gov/llnl/gnem/apps/coda/calibration/service/impl/SiteCalibrationServiceImpl.java b/calibration-service/calibration-service-impl/src/main/java/gov/llnl/gnem/apps/coda/calibration/service/impl/SiteCalibrationServiceImpl.java index b480fe87..cce37835 100644 --- a/calibration-service/calibration-service-impl/src/main/java/gov/llnl/gnem/apps/coda/calibration/service/impl/SiteCalibrationServiceImpl.java +++ b/calibration-service/calibration-service-impl/src/main/java/gov/llnl/gnem/apps/coda/calibration/service/impl/SiteCalibrationServiceImpl.java @@ -24,6 +24,8 @@ import java.util.stream.Collectors; import org.apache.commons.math3.stat.descriptive.SummaryStatistics; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -48,6 +50,8 @@ @Service public class SiteCalibrationServiceImpl implements SiteCalibrationService { + private static final Logger log = LoggerFactory.getLogger(SiteCalibrationServiceImpl.class); + private static final double UNUSED_DISTANCE = -1d; private static final double DYNE_LOG10_ADJUSTMENT = 7d; private MdacCalculatorService mdac; @@ -131,7 +135,7 @@ public Map> measureSite double centerFreq = (highFreq + lowFreq) / 2; for (Entry> staMwMap : evidStaMap.getValue().entrySet()) { Event evid = staMwMap.getKey(); - if (refMws.containsKey(evid.getEventId())) { + if (refMws != null && refMws.containsKey(evid.getEventId())) { List refMwsParams = refMws.get(evid.getEventId()); ReferenceMwParameters refMw = refMwsParams.stream().findFirst().orElse(null); if (refMw != null) { @@ -163,6 +167,7 @@ public Map> measureSite } } } + weightFunctionMapByEvent.putIfAbsent(evid, this::lowerFreqHigherWeights); } } @@ -195,9 +200,6 @@ public Map> measureSite Event evid = evidStaEntry.getKey(); if (averageMapByEvent.containsKey(evid) && averageMapByEvent.get(evid).containsKey(freqBand)) { for (Entry staMwEntry : evidStaEntry.getValue().entrySet()) { - if (!weightFunctionMapByEvent.containsKey(evid)) { - weightFunctionMapByEvent.put(evid, this::lowerFreqHigherWeights); - } double amp = staMwEntry.getValue().getPathCorrected(); if (!staFreqBandSiteCorrectionMapAverage.containsKey(staMwEntry.getKey())) { staFreqBandSiteCorrectionMapAverage.put(staMwEntry.getKey(), new HashMap()); @@ -315,10 +317,48 @@ public static Map>> m } Map stationMap = eventMap.get(event); stationMap.put(station, entry); + } else { + log.debug("No valid waveform for {}", entry); } } } } return data; } + + public MdacCalculatorService getMdac() { + return mdac; + } + + public SiteCalibrationServiceImpl setMdac(MdacCalculatorService mdac) { + this.mdac = mdac; + return this; + } + + public SiteFrequencyBandParametersService getSiteParamsService() { + return siteParamsService; + } + + public SiteCalibrationServiceImpl setSiteParamsService(SiteFrequencyBandParametersService siteParamsService) { + this.siteParamsService = siteParamsService; + return this; + } + + public MeasuredMwsService getMeasuredMwsService() { + return measuredMwsService; + } + + public SiteCalibrationServiceImpl setMeasuredMwsService(MeasuredMwsService measuredMwsService) { + this.measuredMwsService = measuredMwsService; + return this; + } + + public SpectraCalculator getSpectraCalc() { + return spectraCalc; + } + + public SiteCalibrationServiceImpl setSpectraCalc(SpectraCalculator spectraCalc) { + this.spectraCalc = spectraCalc; + return this; + } } diff --git a/calibration-service/calibration-service-impl/src/test/java/gov/llnl/gnem/apps/coda/calibration/service/impl/SiteCalibrationServiceImplTest.java b/calibration-service/calibration-service-impl/src/test/java/gov/llnl/gnem/apps/coda/calibration/service/impl/SiteCalibrationServiceImplTest.java new file mode 100644 index 00000000..67ef2d78 --- /dev/null +++ b/calibration-service/calibration-service-impl/src/test/java/gov/llnl/gnem/apps/coda/calibration/service/impl/SiteCalibrationServiceImplTest.java @@ -0,0 +1,216 @@ +/* +* Copyright (c) 2019, 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.service.impl; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.time.Instant; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.junit.jupiter.MockitoExtension; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import gov.llnl.gnem.apps.coda.calibration.model.domain.MdacParametersFI; +import gov.llnl.gnem.apps.coda.calibration.model.domain.MdacParametersPS; +import gov.llnl.gnem.apps.coda.calibration.model.domain.ReferenceMwParameters; +import gov.llnl.gnem.apps.coda.calibration.model.domain.SiteFrequencyBandParameters; +import gov.llnl.gnem.apps.coda.calibration.model.domain.SpectraMeasurement; +import gov.llnl.gnem.apps.coda.calibration.model.domain.VelocityConfiguration; +import gov.llnl.gnem.apps.coda.calibration.service.api.MdacParametersFiService; +import gov.llnl.gnem.apps.coda.calibration.service.api.MdacParametersPsService; +import gov.llnl.gnem.apps.coda.calibration.service.api.MeasuredMwsService; +import gov.llnl.gnem.apps.coda.calibration.service.api.SiteFrequencyBandParametersService; +import gov.llnl.gnem.apps.coda.calibration.service.impl.processing.MdacCalculatorService; +import gov.llnl.gnem.apps.coda.calibration.service.impl.processing.SpectraCalculator; +import gov.llnl.gnem.apps.coda.calibration.service.impl.processing.SyntheticCodaModel; +import gov.llnl.gnem.apps.coda.common.model.domain.Event; +import gov.llnl.gnem.apps.coda.common.model.domain.FrequencyBand; +import gov.llnl.gnem.apps.coda.common.model.domain.SharedFrequencyBandParameters; +import gov.llnl.gnem.apps.coda.common.model.domain.Station; +import gov.llnl.gnem.apps.coda.common.model.domain.Stream; +import gov.llnl.gnem.apps.coda.common.model.domain.Waveform; +import gov.llnl.gnem.apps.coda.common.model.util.PICK_TYPES; +import gov.llnl.gnem.apps.coda.common.service.util.WaveformToTimeSeriesConverter; + +@ExtendWith(MockitoExtension.class) +public class SiteCalibrationServiceImplTest { + + private final Logger log = LoggerFactory.getLogger(this.getClass()); + + @Mock + private MdacCalculatorService mdac; + + @Mock + private MeasuredMwsService measuredMwsService; + + @Mock + private SiteFrequencyBandParametersService siteParamsService; + + private WaveformToTimeSeriesConverter converter = new WaveformToTimeSeriesConverter(); + + @Mock + private SyntheticCodaModel syntheticCodaModel; + + @Mock + private MdacParametersFiService mdacFiService; + + @Mock + private MdacParametersPsService mdacPsService; + + @Mock + private VelocityConfiguration velConf; + + @InjectMocks + private SiteCalibrationServiceImpl siteCalibrationServiceImpl; + + @BeforeEach + protected void setUp() throws Exception { + Mockito.when(mdac.calculateMdacSourceSpectra(Mockito.any(), Mockito.any(), Mockito.anyDouble(), Mockito.anyDouble(), Mockito.anyDouble())).thenReturn(new double[] { 1.0, 1.0, 1.0 }); + + SpectraCalculator spectraCalc = new SpectraCalculator(converter, syntheticCodaModel, mdac, mdacFiService, mdacPsService, velConf); + siteCalibrationServiceImpl.setSpectraCalc(spectraCalc); + } + + @AfterEach + protected void tearDown() throws Exception { + } + + @Test + public void testSiteCorrectionsOneStationEvent() throws Exception { + + //Testing a fix for a NPE caused when the following three statements are true. + //1) You have a station that saw no calibration events ("InvalidEventStation") + //2) That station shares a non-calibration event with a station that DID see a calibration event ("TEST" in this case) + //3) The station with no calibration event ALSO has an event that no other station saw ("3456"). + + Waveform w1 = createWaveform(); + + Waveform w2 = createWaveform(); + w2.getEvent().setEventId("2345"); + + Waveform w3 = createWaveform(); + w3.getEvent().setEventId("2345"); + w3.getStream().getStation().setStationName("InvalidEventStation"); + + Waveform w4 = createWaveform(); + w4.getEvent().setEventId("3456"); + w4.getStream().getStation().setStationName("InvalidEventStation"); + + SpectraMeasurement sm = new SpectraMeasurement(); + sm.setWaveform(w1); + sm.setPathCorrected(1d); + sm.setRawAtMeasurementTime(1d); + sm.setRawAtStart(1d); + + SpectraMeasurement sm2 = new SpectraMeasurement(); + sm2.setWaveform(w2); + sm2.setPathCorrected(1d); + sm2.setRawAtMeasurementTime(1d); + sm2.setRawAtStart(1d); + + SpectraMeasurement sm3 = new SpectraMeasurement(); + sm3.setWaveform(w3); + sm3.setPathCorrected(1d); + sm3.setRawAtMeasurementTime(1d); + sm3.setRawAtStart(1d); + + SpectraMeasurement sm4 = new SpectraMeasurement(); + sm4.setWaveform(w4); + sm4.setPathCorrected(1d); + sm4.setRawAtMeasurementTime(1d); + sm4.setRawAtStart(1d); + + List spectra = new ArrayList<>(1); + spectra.add(sm); + spectra.add(sm2); + spectra.add(sm3); + spectra.add(sm4); + + Map> spectraMap = new HashMap<>(); + spectraMap.put(new FrequencyBand(0d, 1d), spectra); + + Map mdacPsMap = new HashMap<>(); + mdacPsMap.put(PICK_TYPES.LG, new MdacParametersPS()); + + Map frequencyBandParameterMap = new HashMap<>(); + frequencyBandParameterMap.put(new FrequencyBand(0d, 1d), new SharedFrequencyBandParameters()); + + Map> refEventMap = new HashMap<>(); + refEventMap.put("1234", Collections.singletonList(new ReferenceMwParameters().setRefMw(5d).setEventId("1234"))); + + Map> results = siteCalibrationServiceImpl.measureSiteCorrections( + spectraMap, + new MdacParametersFI(), + mdacPsMap, + refEventMap, + frequencyBandParameterMap, + PICK_TYPES.LG); + + assertEquals(1, results.size(), "Should have one frequency band"); + Map stations = results.values().stream().findFirst().get(); + assertEquals(2, stations.size(), "Should have two stations"); + assertTrue(stations.values().stream().allMatch(sfb -> sfb.getSiteTerm() == 6.0), "Both stations should have the same site term"); + } + + private Waveform createWaveform() { + Date startTime = Date.from(Instant.now()); + Date endTime = Date.from(startTime.toInstant().plusSeconds(1l)); + + Event event = new Event(); + event.setEventId("1234"); + event.setLatitude(1.0); + event.setLongitude(1.0); + + Station station = new Station(); + station.setLatitude(1.0); + station.setLongitude(1.0); + station.setStationName("TEST"); + station.setNetworkName(null); + + Stream s1 = new Stream(); + s1.setChannelName("BHE"); + s1.setStation(station); + + double[] data = new double[400]; + Arrays.fill(data, 0, 200, 1000.0); + Arrays.fill(data, 2, 400, 2000.0); + Waveform w1 = new Waveform(); + w1.setEvent(event); + w1.setStream(s1); + w1.setSegment(data); + w1.setBeginTime(startTime); + w1.setEndTime(endTime); + w1.setSampleRate(16d); + w1.setLowFrequency(0d); + w1.setHighFrequency(1d); + return w1; + } + +} diff --git a/calibration-service/pom.xml b/calibration-service/pom.xml index cae26073..28c82d56 100644 --- a/calibration-service/pom.xml +++ b/calibration-service/pom.xml @@ -5,7 +5,7 @@ gov.llnl.gnem.apps.coda.calibration coda-calibration - 1.0.5 + 1.0.6 4.0.0 diff --git a/calibration-standalone/pom.xml b/calibration-standalone/pom.xml index 8cea825a..6cd6621c 100644 --- a/calibration-standalone/pom.xml +++ b/calibration-standalone/pom.xml @@ -6,7 +6,7 @@ gov.llnl.gnem.apps.coda.calibration coda-calibration - 1.0.5 + 1.0.6 4.0.0 diff --git a/common-gui/pom.xml b/common-gui/pom.xml index a8e2a5f4..363725ee 100644 --- a/common-gui/pom.xml +++ b/common-gui/pom.xml @@ -7,7 +7,7 @@ gov.llnl.gnem.apps.coda.calibration coda-calibration - 1.0.5 + 1.0.6 gov.llnl.gnem.apps.coda.common diff --git a/common-gui/src/main/java/gov/llnl/gnem/apps/coda/common/gui/controllers/AbstractSeismogramSaveLoadController.java b/common-gui/src/main/java/gov/llnl/gnem/apps/coda/common/gui/controllers/AbstractSeismogramSaveLoadController.java index 3f6f8a11..fc0d510f 100644 --- a/common-gui/src/main/java/gov/llnl/gnem/apps/coda/common/gui/controllers/AbstractSeismogramSaveLoadController.java +++ b/common-gui/src/main/java/gov/llnl/gnem/apps/coda/common/gui/controllers/AbstractSeismogramSaveLoadController.java @@ -2,11 +2,11 @@ * 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. -* +* 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. +* 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 @@ -18,6 +18,7 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; +import java.time.Duration; import java.util.ArrayList; import java.util.List; import java.util.Optional; @@ -46,7 +47,6 @@ import javafx.application.Platform; import javafx.scene.input.MouseEvent; import reactor.core.publisher.Flux; -import reactor.core.scheduler.Schedulers; public abstract class AbstractSeismogramSaveLoadController { @@ -159,13 +159,12 @@ public void loadFiles(List inputFiles, Runnable completionCallback, Progre fileFailedProgress.setTotal(0l); bus.post(processingFailedProgressEvent); - fileConverters.stream().forEach(fileConverter -> fileConverter.convertFiles(files).buffer(maxBatching, ArrayList::new).subscribe(results -> { + fileConverters.parallelStream().forEach(fileConverter -> fileConverter.convertFiles(files).buffer(maxBatching, ArrayList::new).doOnNext(results -> { try { - List successfulResults = results.parallelStream().filter(Result::isSuccess).map(result -> result.getResultPayload().get()).collect(Collectors.toList()); List> failedResults = results.parallelStream().filter(r -> !r.isSuccess()).collect(Collectors.toList()); - loadClient.apply(idCounter.getAndIncrement(), successfulResults).retry(3).parallel().runOn(Schedulers.parallel()).subscribe(); + loadClient.apply(idCounter.getAndIncrement(), successfulResults).retry(3).blockLast(Duration.ofHours(1l)); fileProcessingProgress.setCurrent(fileProcessingProgress.getCurrent() + successfulResults.size()); @@ -180,7 +179,7 @@ public void loadFiles(List inputFiles, Runnable completionCallback, Progre } catch (RuntimeException ex) { log.trace(ex.getMessage(), ex); } - })); + }).blockLast(Duration.ofHours(1l))); if (completionCallback != null) { completionCallback.run(); diff --git a/common-service/common-application/pom.xml b/common-service/common-application/pom.xml index c342d9f6..ebcbed40 100644 --- a/common-service/common-application/pom.xml +++ b/common-service/common-application/pom.xml @@ -5,7 +5,7 @@ gov.llnl.gnem.apps.coda.common common-service - 1.0.5 + 1.0.6 4.0.0 diff --git a/common-service/common-model/pom.xml b/common-service/common-model/pom.xml index a3f4c3a4..b7b1c099 100644 --- a/common-service/common-model/pom.xml +++ b/common-service/common-model/pom.xml @@ -5,7 +5,7 @@ gov.llnl.gnem.apps.coda.common common-service - 1.0.5 + 1.0.6 4.0.0 diff --git a/common-service/common-model/src/main/java/gov/llnl/gnem/apps/coda/common/model/domain/SyntheticCoda.java b/common-service/common-model/src/main/java/gov/llnl/gnem/apps/coda/common/model/domain/SyntheticCoda.java index f3a03746..8bea6a40 100644 --- a/common-service/common-model/src/main/java/gov/llnl/gnem/apps/coda/common/model/domain/SyntheticCoda.java +++ b/common-service/common-model/src/main/java/gov/llnl/gnem/apps/coda/common/model/domain/SyntheticCoda.java @@ -2,11 +2,11 @@ * 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. -* +* 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. +* 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 @@ -38,6 +38,8 @@ import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.NumberFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; + @Entity @Table(name = "Synthetic_Coda", indexes = { @Index(columnList = "source_waveform_id", name = "source_waveform_id_index") }) public class SyntheticCoda implements Serializable { @@ -127,6 +129,31 @@ public SyntheticCoda setSegment(double[] segment) { return this; } + @JsonIgnore + public int getSegmentLength() { + int len = 0; + if (hasData()) { + len = segment.size(); + } + return len; + } + + @JsonIgnore + public boolean hasData() { + return segment != null; + } + + @JsonIgnore + public DoubleArrayList getData() { + return segment; + } + + @JsonIgnore + public SyntheticCoda setData(DoubleArrayList segment) { + this.segment = segment; + return this; + } + public Date getBeginTime() { return beginTime; } @@ -325,8 +352,8 @@ public SyntheticCoda mergeNonNullOrEmptyFields(SyntheticCoda overlay) { this.setEndTime(overlay.getEndTime()); } - if (overlay.getSegment() != null) { - this.setSegment(overlay.getSegment()); + if (overlay.hasData()) { + this.setData(overlay.getData()); } if (overlay.getSampleRate() != null) { diff --git a/common-service/common-model/src/main/java/gov/llnl/gnem/apps/coda/common/model/domain/Waveform.java b/common-service/common-model/src/main/java/gov/llnl/gnem/apps/coda/common/model/domain/Waveform.java index e84eeb56..fca8a662 100644 --- a/common-service/common-model/src/main/java/gov/llnl/gnem/apps/coda/common/model/domain/Waveform.java +++ b/common-service/common-model/src/main/java/gov/llnl/gnem/apps/coda/common/model/domain/Waveform.java @@ -2,11 +2,11 @@ * 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. -* +* 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. +* 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 @@ -42,6 +42,7 @@ import org.springframework.format.annotation.NumberFormat; import org.springframework.util.StringUtils; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonManagedReference; @Entity @@ -229,6 +230,31 @@ public Waveform setSegment(double[] segment) { return this; } + @JsonIgnore + public int getSegmentLength() { + int len = 0; + if (hasData()) { + len = segment.size(); + } + return len; + } + + @JsonIgnore + public boolean hasData() { + return segment != null; + } + + @JsonIgnore + public DoubleArrayList getData() { + return segment; + } + + @JsonIgnore + public Waveform setData(DoubleArrayList segment) { + this.segment = segment; + return this; + } + public Stream getStream() { return stream; } @@ -303,8 +329,8 @@ public Waveform mergeNonNullOrEmptyFields(Waveform waveformOverlay) { this.setHighFrequency(waveformOverlay.getHighFrequency()); } - if (waveformOverlay.getSegment() != null) { - this.setSegment(waveformOverlay.getSegment()); + if (waveformOverlay.hasData()) { + this.setData(waveformOverlay.getData()); } if (!StringUtils.isEmpty(waveformOverlay.getSegmentType())) { this.setSegmentType(waveformOverlay.getSegmentType()); @@ -462,4 +488,5 @@ public String toString() { .append(']'); return builder.toString(); } + } diff --git a/common-service/common-repository/pom.xml b/common-service/common-repository/pom.xml index f357fb15..32b15132 100644 --- a/common-service/common-repository/pom.xml +++ b/common-service/common-repository/pom.xml @@ -4,7 +4,7 @@ gov.llnl.gnem.apps.coda.common common-service - 1.0.5 + 1.0.6 4.0.0 diff --git a/common-service/common-service-api/pom.xml b/common-service/common-service-api/pom.xml index 7789385b..5f7a0438 100644 --- a/common-service/common-service-api/pom.xml +++ b/common-service/common-service-api/pom.xml @@ -4,7 +4,7 @@ gov.llnl.gnem.apps.coda.common common-service - 1.0.5 + 1.0.6 4.0.0 diff --git a/common-service/common-service-impl/pom.xml b/common-service/common-service-impl/pom.xml index 4a4dc903..46b4185e 100644 --- a/common-service/common-service-impl/pom.xml +++ b/common-service/common-service-impl/pom.xml @@ -5,7 +5,7 @@ gov.llnl.gnem.apps.coda.common common-service - 1.0.5 + 1.0.6 4.0.0 diff --git a/common-service/pom.xml b/common-service/pom.xml index 9203f8f1..035fd24e 100644 --- a/common-service/pom.xml +++ b/common-service/pom.xml @@ -5,7 +5,7 @@ gov.llnl.gnem.apps.coda.calibration coda-calibration - 1.0.5 + 1.0.6 gov.llnl.gnem.apps.coda.common diff --git a/envelope-gui/pom.xml b/envelope-gui/pom.xml index 0dd9da2f..499c43a0 100644 --- a/envelope-gui/pom.xml +++ b/envelope-gui/pom.xml @@ -7,7 +7,7 @@ gov.llnl.gnem.apps.coda.calibration coda-calibration - 1.0.5 + 1.0.6 envelope-gui diff --git a/envelope-gui/src/main/java/gov/llnl/gnem/apps/coda/envelope/gui/controllers/WaveformLoadingController.java b/envelope-gui/src/main/java/gov/llnl/gnem/apps/coda/envelope/gui/controllers/WaveformLoadingController.java index 81c19f51..091fb69c 100644 --- a/envelope-gui/src/main/java/gov/llnl/gnem/apps/coda/envelope/gui/controllers/WaveformLoadingController.java +++ b/envelope-gui/src/main/java/gov/llnl/gnem/apps/coda/envelope/gui/controllers/WaveformLoadingController.java @@ -26,14 +26,16 @@ import java.util.Map; import java.util.Optional; import java.util.TreeMap; -import java.util.concurrent.CompletableFuture; import java.util.concurrent.atomic.AtomicLong; import java.util.stream.Collectors; import java.util.stream.Stream; +import javax.annotation.PostConstruct; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import com.google.common.eventbus.EventBus; @@ -74,6 +76,9 @@ public class WaveformLoadingController extends AbstractSeismogramSaveLoadControl private Progress progress; + @Value(value = "${envelope-app.max-batching:50}") + private int batchSize; + @Autowired public WaveformLoadingController(List fileConverters, EnvelopeClient client, EnvelopeParamsController params, EventBus bus, SacExporter sacExporter, SacLoader sacLoader, CodaFilenameParser filenameParser) { @@ -81,16 +86,20 @@ public WaveformLoadingController(List fileConverters, E this.sacLoader = sacLoader; this.filenameParser = filenameParser; this.loadClient = (id, waveforms) -> client.postEnvelopes(id, waveforms).doOnNext(w -> { - CompletableFuture.runAsync(() -> this.sacExporter.writeWaveformToDirectory(getExportPath(w).toFile(), w)); + this.sacExporter.writeWaveformToDirectory(getExportPath(w).toFile(), w); }); this.setCompletionCallback(() -> { stackEnvelopes(createEnvelopeMapping(getSacFiles(getExportPath()))); }); - this.setMaxBatching(50); + } - progress = new Progress(-1l, 0l); - progressEvent = new ProgressEvent(idCounter.getAndIncrement(), progress); - progressMonitor = new ProgressMonitor("Saving Event-Sta-Freq pairs", new ProgressEventProgressListener(bus, progressEvent)); + @PostConstruct + private void setup() { + if (batchSize > 0) { + this.setMaxBatching(batchSize); + } else { + log.warn("Invalid batch size {} defined. Defaulting to {} instead.", batchSize, maxBatching); + } } private List getSacFiles(Path path) { @@ -108,6 +117,9 @@ private List getSacFiles(Path path) { @Override public void loadFiles(List inputFiles) { try { + progress = new Progress(-1l, 0l); + progressEvent = new ProgressEvent(idCounter.getAndIncrement(), progress); + progressMonitor = new ProgressMonitor("Saving Event-Sta-Freq pairs", new ProgressEventProgressListener(bus, progressEvent)); Files.createDirectories(getExportPath()); super.loadFiles(inputFiles, this.getCompletionCallback(), progressMonitor); } catch (IOException ex) { @@ -181,11 +193,7 @@ public void stackEnvelopes(TreeMap> evidStaFreqMap) { Waveform rawWaveform = result.getResultPayload().get(); rawWaveform.setLowFrequency(stackInfo.getLowFrequency()); rawWaveform.setHighFrequency(stackInfo.getHighFrequency()); - if (rawWaveform != null - && rawWaveform.getSegment() != null - && rawWaveform.getSegment().length > 0 - && rawWaveform.getStream() != null - && rawWaveform.getStream().getStation() != null) { + if (rawWaveform != null && rawWaveform.hasData() && rawWaveform.getSegmentLength() > 0 && rawWaveform.getStream() != null && rawWaveform.getStream().getStation() != null) { waveformsByFreqAndSta.computeIfAbsent(entry.getKey() + " " + rawWaveform.getStream().getStation().hashCode(), k -> new ArrayList<>()).add(rawWaveform); } else { log.warn("No data or bad station specification for waveform {}.", rawWaveform); @@ -229,19 +237,19 @@ private Waveform stackEnvelopes(List waves) { base = waves.get(0); TimeSeries seis = convertToTimeSeries(base); - // int nseismograms = 0; + float[] seisData = seis.getData(); for (int i = 1; i < waves.size(); i++) { TimeSeries seis2 = convertToTimeSeries(waves.get(i)); seis = seis.add(seis2); } seis.MultiplyScalar(1d / waves.size()); - double[] data = new double[seis.getData().length]; + double[] data = new double[seisData.length]; for (int j = 0; j < data.length; ++j) { - data[j] = seis.getData()[j]; + data[j] = seisData[j]; } base.setSegment(data); - if (base.getSegment() == null || base.getSegment().length == 0) { + if (!base.hasData() || base.getSegmentLength() == 0) { return null; } @@ -261,9 +269,10 @@ private Waveform stackEnvelopes(List waves) { } private TimeSeries convertToTimeSeries(Waveform base) { - float[] fData = new float[base.getSegment().length]; + double[] segment = base.getSegment(); + float[] fData = new float[segment.length]; for (int j = 0; j < fData.length; ++j) { - fData[j] = (float) base.getSegment()[j]; + fData[j] = (float) segment[j]; } TimeSeries seis = new TimeSeries(fData, base.getSampleRate(), new TimeT(base.getBeginTime())); return seis; diff --git a/envelope-service/envelope-application/pom.xml b/envelope-service/envelope-application/pom.xml index 1997d774..67df81a1 100644 --- a/envelope-service/envelope-application/pom.xml +++ b/envelope-service/envelope-application/pom.xml @@ -5,7 +5,7 @@ gov.llnl.gnem.apps.coda.envelope envelope-service - 1.0.5 + 1.0.6 4.0.0 diff --git a/envelope-service/envelope-model/pom.xml b/envelope-service/envelope-model/pom.xml index fa70beab..a226cdeb 100644 --- a/envelope-service/envelope-model/pom.xml +++ b/envelope-service/envelope-model/pom.xml @@ -4,7 +4,7 @@ gov.llnl.gnem.apps.coda.envelope envelope-service - 1.0.5 + 1.0.6 4.0.0 diff --git a/envelope-service/envelope-repository/pom.xml b/envelope-service/envelope-repository/pom.xml index 3b906548..394d88fe 100644 --- a/envelope-service/envelope-repository/pom.xml +++ b/envelope-service/envelope-repository/pom.xml @@ -4,7 +4,7 @@ gov.llnl.gnem.apps.coda.envelope envelope-service - 1.0.5 + 1.0.6 4.0.0 diff --git a/envelope-service/envelope-service-api/pom.xml b/envelope-service/envelope-service-api/pom.xml index 12810d14..0b6888e5 100644 --- a/envelope-service/envelope-service-api/pom.xml +++ b/envelope-service/envelope-service-api/pom.xml @@ -5,7 +5,7 @@ gov.llnl.gnem.apps.coda.envelope envelope-service - 1.0.5 + 1.0.6 4.0.0 diff --git a/envelope-service/envelope-service-impl/pom.xml b/envelope-service/envelope-service-impl/pom.xml index abd813e2..51e5d234 100644 --- a/envelope-service/envelope-service-impl/pom.xml +++ b/envelope-service/envelope-service-impl/pom.xml @@ -6,7 +6,7 @@ gov.llnl.gnem.apps.coda.envelope envelope-service - 1.0.5 + 1.0.6 4.0.0 diff --git a/envelope-service/envelope-service-impl/src/main/java/gov/llnl/gnem/apps/coda/envelope/service/impl/EnvelopeCreationServiceImpl.java b/envelope-service/envelope-service-impl/src/main/java/gov/llnl/gnem/apps/coda/envelope/service/impl/EnvelopeCreationServiceImpl.java index 223e52c8..632b1678 100644 --- a/envelope-service/envelope-service-impl/src/main/java/gov/llnl/gnem/apps/coda/envelope/service/impl/EnvelopeCreationServiceImpl.java +++ b/envelope-service/envelope-service-impl/src/main/java/gov/llnl/gnem/apps/coda/envelope/service/impl/EnvelopeCreationServiceImpl.java @@ -124,7 +124,6 @@ private Waveform createEnvelopeForBand(Waveform wave, EnvelopeBandParameters ban if (maxNeededRate < bandConfig.getInterpolation()) { maxNeededRate = bandConfig.getInterpolation(); } - seis.interpolate(maxNeededRate); seis.RemoveMean(); seis.removeTrend(); @@ -145,6 +144,8 @@ private Waveform createEnvelopeForBand(Waveform wave, EnvelopeBandParameters ban double trimlength = 2 * smoothing / seis.getSamprate(); seis.cut(seis.getTime().add(trimlength), seis.getEndtime().add(-1 * trimlength)); + seis.interpolate(maxNeededRate); + seisWave.setSampleRate(seis.getSamprate()); seisWave.setSegment(WaveformUtils.floatsToDoubles(seis.getData())); seisWave.setLowFrequency(bandConfig.getLowFrequency()); diff --git a/envelope-service/envelope-service-impl/src/main/java/gov/llnl/gnem/apps/coda/envelope/service/impl/EnvelopeStacker.java b/envelope-service/envelope-service-impl/src/main/java/gov/llnl/gnem/apps/coda/envelope/service/impl/EnvelopeStacker.java index 438c977c..a62d4803 100644 --- a/envelope-service/envelope-service-impl/src/main/java/gov/llnl/gnem/apps/coda/envelope/service/impl/EnvelopeStacker.java +++ b/envelope-service/envelope-service-impl/src/main/java/gov/llnl/gnem/apps/coda/envelope/service/impl/EnvelopeStacker.java @@ -69,7 +69,7 @@ public Waveform stackEnvelopes(List waves) { seis.MultiplyScalar(1d / (waves.size())); base.setSegment(WaveformUtils.floatsToDoubles(seis.getData())); - if (base.getSegment() == null || base.getSegment().length == 0) { + if (!base.hasData() || base.getSegmentLength() == 0) { return null; } diff --git a/envelope-service/pom.xml b/envelope-service/pom.xml index 9a15b512..7fecbfc5 100644 --- a/envelope-service/pom.xml +++ b/envelope-service/pom.xml @@ -5,7 +5,7 @@ gov.llnl.gnem.apps.coda.calibration coda-calibration - 1.0.5 + 1.0.6 gov.llnl.gnem.apps.coda.envelope diff --git a/envelope-standalone/pom.xml b/envelope-standalone/pom.xml index 00ccc054..66a15955 100644 --- a/envelope-standalone/pom.xml +++ b/envelope-standalone/pom.xml @@ -6,7 +6,7 @@ gov.llnl.gnem.apps.coda.calibration coda-calibration - 1.0.5 + 1.0.6 4.0.0 diff --git a/externals/pom.xml b/externals/pom.xml index eadbf070..e4eec56f 100644 --- a/externals/pom.xml +++ b/externals/pom.xml @@ -7,7 +7,7 @@ gov.llnl.gnem.apps.coda.calibration coda-calibration - 1.0.5 + 1.0.6 externals diff --git a/externals/src/main/java/llnl/gnem/core/waveform/seismogram/TimeSeries.java b/externals/src/main/java/llnl/gnem/core/waveform/seismogram/TimeSeries.java index 8d2b993f..92dc72c0 100755 --- a/externals/src/main/java/llnl/gnem/core/waveform/seismogram/TimeSeries.java +++ b/externals/src/main/java/llnl/gnem/core/waveform/seismogram/TimeSeries.java @@ -2,11 +2,11 @@ * 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. -* +* 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. +* 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 @@ -521,7 +521,7 @@ public void addListener(TimeSeries.SeriesListener listener) { public TimeSeries append(TimeSeries other) { if (!rateIsComparable(other)) { - log.warn("Seismograms have different sample rates! {} - {}", this.toString(), other.toString()); + log.warn("Seismograms have different sample rates! {} - {}", this, other); } double expectedAppendeeStart = this.getEndtime().getEpochTime() + getDelta(); double actualAppendeeStart = other.getTimeAsDouble(); @@ -641,11 +641,12 @@ public TimeSeries crop(int start, int end) { * thrown. */ public void cut(TimeT start, TimeT end) { - log.trace("Trying to cut seismogram, startcut {}, endcut {}, starttime {}, endtime {}", - start.getMilliseconds(), - end.getMilliseconds(), - getTime().getMilliseconds(), - getEndtime().getMilliseconds()); + log.trace( + "Trying to cut seismogram, startcut {}, endcut {}, starttime {}, endtime {}", + start.getMilliseconds(), + end.getMilliseconds(), + getTime().getMilliseconds(), + getEndtime().getMilliseconds()); if (start.ge(end)) { throw new IllegalArgumentException("Start time of cut is >= end time of cut."); } diff --git a/mapping/pom.xml b/mapping/pom.xml index ae0a590b..a56d8a53 100644 --- a/mapping/pom.xml +++ b/mapping/pom.xml @@ -7,7 +7,7 @@ gov.llnl.gnem.apps.coda.calibration coda-calibration - 1.0.5 + 1.0.6 gov.llnl.gnem.apps.coda.common diff --git a/mapping/src/main/java/gov/llnl/gnem/apps/coda/common/mapping/LeafletMap.java b/mapping/src/main/java/gov/llnl/gnem/apps/coda/common/mapping/LeafletMap.java index 476a35a9..e7cf8505 100644 --- a/mapping/src/main/java/gov/llnl/gnem/apps/coda/common/mapping/LeafletMap.java +++ b/mapping/src/main/java/gov/llnl/gnem/apps/coda/common/mapping/LeafletMap.java @@ -2,11 +2,11 @@ * 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. -* +* 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. +* 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 @@ -46,7 +46,7 @@ public class LeafletMap { private WebView webView; - private ObservableSet icons = FXCollections.observableSet(new HashSet<>()); + private ObservableSet icons = FXCollections.synchronizedObservableSet(FXCollections.observableSet(new HashSet<>())); private ObservableSet shapes = FXCollections.observableSet(new HashSet<>()); private Pane parent; private Set layers = new HashSet<>(); diff --git a/pom.xml b/pom.xml index 8fe65d16..20404f1c 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ 4.0.0 gov.llnl.gnem.apps.coda.calibration coda-calibration - 1.0.5 + 1.0.6 coda-calibration pom