diff --git a/edexOsgi/com.raytheon.uf.edex.ndm.dataplugin/res/spring/ndm-dataplugin-ingest.xml b/edexOsgi/com.raytheon.uf.edex.ndm.dataplugin/res/spring/ndm-dataplugin-ingest.xml
index cc11e27750..e7771c8956 100644
--- a/edexOsgi/com.raytheon.uf.edex.ndm.dataplugin/res/spring/ndm-dataplugin-ingest.xml
+++ b/edexOsgi/com.raytheon.uf.edex.ndm.dataplugin/res/spring/ndm-dataplugin-ingest.xml
@@ -59,22 +59,6 @@
- * - * SOFTWARE HISTORY - * - * Date Ticket# Engineer Description - * ------------- -------- ----------- -------------------------- - * Jan 29, 2011 bfarmer Initial creation - * Dec 02, 2013 2537 bsteffen Ensure streams are closed. - * Mar 06, 2014 2876 mpduff New NDM plugin. - * Mar 02, 2016 5434 bkowal Relocated to ndm dataplugin. - * Jul 11, 2016 5744 mapeters Save to common_static (not edex_static) - * - *- * - * @author bfarmer - */ - -public class ModelBufrSubscriber implements INationalDatasetSubscriber { - - private static final String MODEL_STATION_LIST = ModelSoundingDataAdapter.MODEL_STATION_LIST; - - private static final String MODEL_STATION_INFO = "modelBufrStationInfo.txt"; - - private static final String MODEL_GOODNESS = "modelBufr.goodness"; - - private static final IUFStatusHandler statusHandler = UFStatus - .getHandler(ModelBufrSubscriber.class); - - @Override - public void notify(String fileName, File file) { - - statusHandler.handle(Priority.EVENTA, - "modelBufr:Processing input file [" + fileName + "]"); - - if ("modelBufr.spi".equals(fileName)) { - IPathManager pathMgr = PathManagerFactory.getPathManager(); - LocalizationContext lc = pathMgr.getContext( - LocalizationType.COMMON_STATIC, LocalizationLevel.SITE); - ILocalizationFile outLocFile = pathMgr.getLocalizationFile(lc, - ModelSoundingDataAdapter.SPI_FILE); - saveFile(file, outLocFile); - ModelSoundingDataAdapter.updateSPIData(); - } else if (MODEL_STATION_LIST.equals(fileName) - || MODEL_STATION_INFO.equals(fileName)) { - // Both are saved as MODEL_STATION_LIST in localization - processModelStationTxtFile(file); - } - } - - private void processModelStationTxtFile(File file) { - IPathManager pathMgr = PathManagerFactory.getPathManager(); - LocalizationContext lc = pathMgr.getContext( - LocalizationType.COMMON_STATIC, LocalizationLevel.SITE); - ILocalizationFile outLocFile = pathMgr.getLocalizationFile(lc, - MODEL_STATION_LIST); - File goodnessFile = pathMgr.getFile(lc, MODEL_GOODNESS); - saveFile(file, outLocFile); - generateSPI(file, goodnessFile); - - File spiFile = pathMgr.getFile(lc, ModelSoundingDataAdapter.SPI_FILE); - if (!spiFile.exists()) { - try { - spiFile.createNewFile(); - } catch (IOException e) { - statusHandler.handle( - Priority.SIGNIFICANT, - "modelBufr:Could not create spiFile file: " - + spiFile.getName(), e); - } - } - - VA_Driver driver = new VA_Driver(); - driver.setWeight(0.5f); - driver.vaStationsFile(goodnessFile, null, spiFile); - // updateStationList will reload spi files also - ModelSoundingDataAdapter.update(); - } - - /** - * - * @param file - * @param goodnessFile - */ - private void generateSPI(File file, File goodnessFile) { - String line; - String[] splitLine; - try { - try (BufferedReader fis = new BufferedReader(new FileReader(file)); - BufferedWriter fos = new BufferedWriter(new FileWriter( - goodnessFile))) { - while ((line = fis.readLine()) != null) { - if (line.length() > 0) { - // check for commented lines - if ('#' != line.charAt(0)) { - try { - splitLine = line.split("\\|"); - Integer elevation; - Double latitude; - Double longitude; - String cause = "elevation"; - try { - elevation = Integer.parseInt(splitLine[4] - .trim()); - cause = "latitude"; - latitude = Double.parseDouble(splitLine[2] - .trim()); - cause = "longitude"; - longitude = Double.parseDouble(splitLine[3] - .trim()); - } catch (NumberFormatException nfe) { - String err = String - .format("modelBufr:Invalid %s in data line [%s]", - cause, line); - statusHandler.handle(Priority.PROBLEM, err); - continue; - } - String stationName = splitLine[1].trim(); - fos.write("0 "); - fos.write(stationName); - fos.write(String.format(" %8.4f %9.4f %5d %9d", - latitude, longitude, elevation, 0)); - fos.newLine(); - } catch (Exception e) { - String err = String.format( - "modelBufr:Error in data line [%s]", - line); - statusHandler.handle(Priority.PROBLEM, err, e); - continue; - } - } - } - } - } - } catch (IOException e) { - statusHandler.handle(Priority.SIGNIFICANT, - "modelBufr:Could not read File ", e); - } - } - - /** - * Save the contents of the given File to the given ILocalizationFile - * - * @param file - * @param outFile - */ - private void saveFile(File file, ILocalizationFile outFile) { - if ((file != null) && file.exists()) { - try (BufferedReader fis = new BufferedReader(new FileReader(file)); - BufferedWriter fos = new BufferedWriter( - new OutputStreamWriter(outFile.openOutputStream()))) { - String line = null; - try { - while ((line = fis.readLine()) != null) { - fos.write(line); - fos.newLine(); - } - } catch (IOException e) { - statusHandler.handle(Priority.PROBLEM, - "Could not read file: " + file.getName(), e); - - } - } catch (FileNotFoundException e) { - statusHandler.handle(Priority.PROBLEM, "Failed to find file: " - + file.getName(), e); - } catch (LocalizationException e) { - statusHandler.handle( - Priority.PROBLEM, - "Failed to open output stream for file: " - + outFile.getPath(), e); - } catch (IOException e) { - // Error occurred closing fis/fos, ignore - } - } - } -} diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.modelsounding/src/com/raytheon/uf/edex/plugin/modelsounding/ModelSoundingDecoder.java b/edexOsgi/com.raytheon.uf.edex.plugin.modelsounding/src/com/raytheon/uf/edex/plugin/modelsounding/ModelSoundingDecoder.java index 11424449a1..bc98073e98 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.modelsounding/src/com/raytheon/uf/edex/plugin/modelsounding/ModelSoundingDecoder.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.modelsounding/src/com/raytheon/uf/edex/plugin/modelsounding/ModelSoundingDecoder.java @@ -85,8 +85,6 @@ import com.raytheon.uf.edex.plugin.modelsounding.decoder.ModelSoundingDataAdapte */ public class ModelSoundingDecoder implements IDescriptorFactorySelector { - public static final String SPI_FILE = "basemaps/modelBufr.spi"; - // Name of the plugin controlling this decoder. public static final String PLUGIN_NAME = "modelsounding"; diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.modelsounding/src/com/raytheon/uf/edex/plugin/modelsounding/decoder/ModelSoundingDataAdapter.java b/edexOsgi/com.raytheon.uf.edex.plugin.modelsounding/src/com/raytheon/uf/edex/plugin/modelsounding/decoder/ModelSoundingDataAdapter.java index 348eab8a48..b546591f3b 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.modelsounding/src/com/raytheon/uf/edex/plugin/modelsounding/decoder/ModelSoundingDataAdapter.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.modelsounding/src/com/raytheon/uf/edex/plugin/modelsounding/decoder/ModelSoundingDataAdapter.java @@ -68,6 +68,7 @@ import com.raytheon.uf.edex.plugin.modelsounding.common.SoundingModels; * Sep 16, 2014 3628 mapeters Replaced static imports. * Jul 12, 2016 5744 mapeters SoundingStations constructor no longer takes * path parameter + * Sep 05, 2018 mjames@ucar Remove modelBufr filter. * * @@ -81,42 +82,10 @@ public class ModelSoundingDataAdapter { private static final Object LOCK = new Object(); - public static final String SPI_FILE = "basemaps" + IPathManager.SEPARATOR - + "modelBufr.spi"; - public static final String MODEL_STATION_LIST = "modelBufrStationList.txt"; private static SoundingStations stationsList = new SoundingStations(); - private static SPIContainer SPI_DATA = populateSPIData(); - - public static void updateSPIData() { - SPIContainer spi = populateSPIData(); - synchronized (LOCK) { - if ((spi != null) && (spi.isLoaded())) { - SPI_DATA = spi; - } - } - } - - public static void updateStationList() { - SoundingStations ss = new SoundingStations(); - synchronized (LOCK) { - stationsList = ss; - } - } - - public static void update() { - SoundingStations ss = new SoundingStations(); - SPIContainer spi = populateSPIData(); - synchronized (LOCK) { - stationsList = ss; - if ((spi != null) && (spi.isLoaded())) { - SPI_DATA = spi; - } - } - } - /** * Get the temporal and model information. * @@ -249,41 +218,35 @@ public class ModelSoundingDataAdapter { String stationId = stationsList.mapId(String.format("%010d", wmoStaNum)); // Now determine if the station Id is in this localization list. - SPIEntry s = SPI_DATA.getEntryById(stationId); - if (s != null) { - if (stationId != null) { - location.setStationId(stationId); - obsData.setSiteId(String.format("%06d", wmoStaNum)); - } - if (model.equals(SoundingModels.MODEL_ETA)) { - index++; - } - Double lat = null; - dp = dataList.get(index++); - int d = dp.getReferencingDescriptor().getDescriptor(); - if (d == BUFRDescriptor.createDescriptor(0, 5, 2)) { - lat = (Double) dp.getValue(); - } - Double lon = null; - dp = dataList.get(index++); - d = dp.getReferencingDescriptor().getDescriptor(); - if (d == BUFRDescriptor.createDescriptor(0, 6, 2)) { - lon = (Double) dp.getValue(); - } - location.assignLocation(lat.floatValue(), lon.floatValue()); - dp = dataList.get(index); - d = dp.getReferencingDescriptor().getDescriptor(); - if (d == BUFRDescriptor.createDescriptor(0, 10, 194)) { - stationHeight = (dp.getValue() != null) ? ((Double) dp - .getValue()).intValue() : null; - location.setElevation(stationHeight); - } - obsData.setLocation(location); - - obsData.setPointDataView(view); - } else { - obsData = null; + if (stationId != null) { + location.setStationId(stationId); + obsData.setSiteId(String.format("%06d", wmoStaNum)); } + if (model.equals(SoundingModels.MODEL_ETA)) { + index++; + } + Double lat = null; + dp = dataList.get(index++); + int d = dp.getReferencingDescriptor().getDescriptor(); + if (d == BUFRDescriptor.createDescriptor(0, 5, 2)) { + lat = (Double) dp.getValue(); + } + Double lon = null; + dp = dataList.get(index++); + d = dp.getReferencingDescriptor().getDescriptor(); + if (d == BUFRDescriptor.createDescriptor(0, 6, 2)) { + lon = (Double) dp.getValue(); + } + location.assignLocation(lat.floatValue(), lon.floatValue()); + dp = dataList.get(index); + d = dp.getReferencingDescriptor().getDescriptor(); + if (d == BUFRDescriptor.createDescriptor(0, 10, 194)) { + stationHeight = (dp.getValue() != null) ? ((Double) dp + .getValue()).intValue() : null; + location.setElevation(stationHeight); + } + obsData.setLocation(location); + obsData.setPointDataView(view); } return obsData; @@ -518,29 +481,4 @@ public class ModelSoundingDataAdapter { return retValue; } - private static SPIContainer populateSPIData() { - SPIContainer container = null; - - PathManager pathMgr = (PathManager) PathManagerFactory.getPathManager(); - - LocalizationContext ctx = pathMgr.getContext( - LocalizationType.COMMON_STATIC, LocalizationLevel.SITE); - String site = ctx.getContextName(); - - logger.info("Loading " + SPI_FILE + " for site [" + site + "]"); - - File srcFile = pathMgr.getFile(ctx, SPI_FILE); - - container = new SPIContainer(srcFile); - if (container.isLoaded()) { - logger.info("Loading " + SPI_FILE + " for site [" + site - + "] Successful"); - } else { - logger.error("Loading " + SPI_FILE + " for site [" + site - + "] failed"); - } - - return container; - } - } diff --git a/localization/localization.OAX/utility/common_static/site/OAX/basemaps/modelBufr.spi b/localization/localization.OAX/utility/common_static/site/OAX/basemaps/modelBufr.spi deleted file mode 100644 index 6439caa982..0000000000 --- a/localization/localization.OAX/utility/common_static/site/OAX/basemaps/modelBufr.spi +++ /dev/null @@ -1,35 +0,0 @@ - 0 CHE 43.5000 -95.6000 9999 0.000 - 0 CRL 42.0000 -95.0000 9999 0.000 - 0 RDD 40.6900 -94.4700 9999 0.000 - 0 WSC 44.1000 -93.5000 9999 0.000 - 0 HNR 41.5900 -95.3400 375 0.000 - 0 CNN 38.3700 -93.7900 9999 0.000 - 0 EAX 38.8100 -94.2600 333 0.000 - 0 HSI 40.3200 -98.4400 626 0.000 - 0 KMCI 39.3200 -94.7200 312 0.000 - 0 KMKC 39.1200 -94.6000 231 0.000 - 0 KSTJ 39.7700 -94.9200 249 0.000 - 0 KMHK 39.1300 -96.6700 322 0.000 - 0 KTOP 39.0700 -95.6200 270 0.000 - 0 KFOE 38.9500 -95.6700 329 0.000 - 0 KRSL 38.8700 -98.8200 568 0.000 - 0 KSLN 38.8000 -97.6500 388 0.000 - 0 KDSM 41.5300 -93.6500 294 0.000 - 0 KMCW 43.1500 -93.3300 370 0.000 - 0 SLB 42.6000 -95.2300 454 0.000 - 0 KOMA 41.3000 -95.9000 299 0.000 - 0 KLNK 40.8400 -96.7500 362 0.000 - 0 KGRI 40.9700 -98.3200 566 0.000 - 0 FNB 40.0800 -95.6000 300 0.000 - 0 KOFK 41.9800 -97.4300 473 0.000 - 0 KSUX 42.4000 -96.3800 336 0.000 - 0 OAX 41.3200 -96.3700 350 0.000 - 0 KFSD 43.5800 -96.7300 435 0.000 - 0 KYKN 42.9200 -97.3800 398 0.000 - 0 KMHE 43.7700 -98.0300 397 0.000 - 0 KFRM 43.6500 -94.4200 354 0.000 - 0 P#8 40.1000 -97.3400 433 0.000 - 0 P#9 42.2100 -97.7900 524 0.000 - 0 P#A 41.9000 -93.7000 315 0.000 - 0 P#G 38.3100 -97.3000 447 0.000 - 0 P#I 39.5800 -94.1900 297 0.000