Skip to content

Commit

Permalink
#1 - add corner pixel historical radar flag
Browse files Browse the repository at this point in the history
  • Loading branch information
obriensystems committed Sep 28, 2020
1 parent 0049f39 commit 149accc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -536,8 +536,7 @@ public void reduceRadarImages(String site, String anInputDir, String anOutputDir
aRadarView = null;
}
}
}

}*/

public ForkJoinPool getPool() {
return pool;
Expand Down
13 changes: 10 additions & 3 deletions radar.se/src/main/java/org/obrienscience/radar/PreProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
}
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 149accc

Please sign in to comment.