From 149accc675de253669c16431ca296fe21575195d Mon Sep 17 00:00:00 2001 From: michaelobrien Date: Sun, 27 Sep 2020 21:15:42 -0400 Subject: [PATCH] #1 - add corner pixel historical radar flag --- .../org/obrienscience/radar/ImageProcessor.java | 11 +++++------ .../java/org/obrienscience/radar/PreProcessor.java | 13 ++++++++++--- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/radar.se/src/main/java/org/obrienscience/radar/ImageProcessor.java b/radar.se/src/main/java/org/obrienscience/radar/ImageProcessor.java index 2d7e1a5..bf56ded 100755 --- a/radar.se/src/main/java/org/obrienscience/radar/ImageProcessor.java +++ b/radar.se/src/main/java/org/obrienscience/radar/ImageProcessor.java @@ -446,9 +446,9 @@ public void writeImage(Image anImage, String filename, String format) { } } - public void reduceRadarImages(String site, String anInputDir, String anOutputDir) { + /*public void reduceRadarImages(String site, String anInputDir, String anOutputDir) { reduceRadarImages(site, anInputDir, anOutputDir, true, true, true); - } + }*/ protected int updateCounterPrivate(String site, int counter, int count) { // file exists @@ -460,7 +460,7 @@ protected int updateCounterPrivate(String site, int counter, int count) { return counter; } - public void reduceRadarImages(String site, String anInputDir, String anOutputDir, boolean display, boolean persist, boolean file) { + /*public void reduceRadarImages(String site, String anInputDir, String anOutputDir, boolean display, boolean persist, boolean file) { // Setup View with a dummy image String filename = null; BufferedImage image = null; @@ -505,7 +505,7 @@ public void reduceRadarImages(String site, String anInputDir, String anOutputDir reducedImage = doFilter(0, input, RadarSite.PRECIP_INTENSITY_COLOR_CODES_SIZE - 1); writeImage(reducedImage, outputPath, "gif"); // check performance - //writeImage(input, outputPath, "gif"); + writeImage(input, outputPath, "gif"); if(display) { aRadarView.setBufferedImage(reducedImage); } @@ -536,8 +536,7 @@ public void reduceRadarImages(String site, String anInputDir, String anOutputDir aRadarView = null; } } - } - + }*/ public ForkJoinPool getPool() { return pool; diff --git a/radar.se/src/main/java/org/obrienscience/radar/PreProcessor.java b/radar.se/src/main/java/org/obrienscience/radar/PreProcessor.java index d028ac1..048a263 100755 --- a/radar.se/src/main/java/org/obrienscience/radar/PreProcessor.java +++ b/radar.se/src/main/java/org/obrienscience/radar/PreProcessor.java @@ -129,11 +129,12 @@ private void doFilterType(BufferedImage input, int x, int y, int pColor) { } public BufferedImage doFilter(int filter, BufferedImage input, int layer) { - return doFilter(new Sweep(), filter,input, layer); + return doFilter(null /*new Sweep()*/, filter,input, layer); } public BufferedImage doFilter(Sweep sweep, int filter, BufferedImage input, int layer) { + boolean isHistorical = false; int height = input.getHeight(); - BufferedImage croppedImage = new BufferedImage (height, height, BufferedImage.TYPE_INT_RGB); + BufferedImage croppedImage = new BufferedImage(height, height, BufferedImage.TYPE_INT_RGB); // get the historical status of the image - whether it has destructive range and overlay data // Look for at least 2 white pixels in any direction from the center int h = height >> 1 - 10; // there is always a + in the center @@ -146,8 +147,11 @@ public BufferedImage doFilter(Sweep sweep, int filter, BufferedImage input, int } if(rangeRingCount > 4) { y = height; - sweep.setIsHistorical(true); + //sweep.setIsHistorical(true); System.out.print("H");//istorical Image: " + sweep.getTimestamp()); + // set corner pixel + isHistorical = true; + } //System.out.println(h + "," + y + " = " + pColor); } @@ -182,6 +186,9 @@ public BufferedImage doFilter(Sweep sweep, int filter, BufferedImage input, int g.drawLine(0,height-1, height-1, height -1); g.drawLine(height-1,0, height-1, height - 1); // set historical flag + if(isHistorical) { + croppedImage.setRGB(0, 0, RadarSite.PRECIP_INTENSITY_COLOR_CODES[1]); + } return croppedImage; }