Skip to content

Commit

Permalink
Added observational radiosonde soundings and ILCAPE.
Browse files Browse the repository at this point in the history
  • Loading branch information
a-urq committed Sep 13, 2023
1 parent df00d97 commit c7dd492
Show file tree
Hide file tree
Showing 45 changed files with 333 additions and 36 deletions.
Binary file modified bin/com/ameliaWx/radarView/RadarData$1.class
Binary file not shown.
Binary file modified bin/com/ameliaWx/radarView/RadarData$2.class
Binary file not shown.
Binary file modified bin/com/ameliaWx/radarView/RadarData$3.class
Binary file not shown.
Binary file modified bin/com/ameliaWx/radarView/RadarData$4.class
Binary file not shown.
Binary file modified bin/com/ameliaWx/radarView/RadarData$5.class
Binary file not shown.
Binary file modified bin/com/ameliaWx/radarView/RadarData$6.class
Binary file not shown.
Binary file modified bin/com/ameliaWx/radarView/RadarData$7.class
Binary file not shown.
Binary file modified bin/com/ameliaWx/radarView/RadarData$8.class
Binary file not shown.
Binary file modified bin/com/ameliaWx/radarView/RadarData.class
Binary file not shown.
Binary file modified bin/com/ameliaWx/radarView/RadarPanel.class
Binary file not shown.
Binary file modified bin/com/ameliaWx/radarView/RadarView$1.class
Binary file not shown.
Binary file modified bin/com/ameliaWx/radarView/RadarView$2.class
Binary file not shown.
Binary file modified bin/com/ameliaWx/radarView/RadarView$3.class
Binary file not shown.
Binary file modified bin/com/ameliaWx/radarView/RadarView$4.class
Binary file not shown.
Binary file modified bin/com/ameliaWx/radarView/RadarView$AnimateThread$1.class
Binary file not shown.
Binary file modified bin/com/ameliaWx/radarView/RadarView$AnimateThread.class
Binary file not shown.
Binary file modified bin/com/ameliaWx/radarView/RadarView$CheckOnlineThread$1.class
Binary file not shown.
Binary file modified bin/com/ameliaWx/radarView/RadarView$CheckOnlineThread.class
Binary file not shown.
Binary file modified bin/com/ameliaWx/radarView/RadarView$RVGraphics.class
Binary file not shown.
Binary file modified bin/com/ameliaWx/radarView/RadarView$RVKeyListener$1.class
Binary file not shown.
Binary file modified bin/com/ameliaWx/radarView/RadarView$RVKeyListener$2.class
Binary file not shown.
Binary file modified bin/com/ameliaWx/radarView/RadarView$RVKeyListener$3.class
Binary file not shown.
Binary file modified bin/com/ameliaWx/radarView/RadarView$RVKeyListener.class
Binary file not shown.
Binary file modified bin/com/ameliaWx/radarView/RadarView$RVMouseListener$1.class
Binary file not shown.
Binary file modified bin/com/ameliaWx/radarView/RadarView$RVMouseListener$2.class
Binary file not shown.
Binary file modified bin/com/ameliaWx/radarView/RadarView$RVMouseListener.class
Binary file not shown.
Binary file modified bin/com/ameliaWx/radarView/RadarView$RVMouseMotionListener.class
Binary file not shown.
Binary file modified bin/com/ameliaWx/radarView/RadarView$RVMouseWheelListener.class
Binary file not shown.
Binary file modified bin/com/ameliaWx/radarView/RadarView$RefreshTimerThread$1.class
Binary file not shown.
Binary file not shown.
Binary file modified bin/com/ameliaWx/radarView/RadarView$RefreshTimerThread.class
Binary file not shown.
Binary file modified bin/com/ameliaWx/radarView/RadarView.class
Binary file not shown.
Binary file not shown.
Binary file modified bin/com/ameliaWx/radarView/nwpModel/RapInterpModel.class
Binary file not shown.
Binary file modified bin/com/ameliaWx/radarView/nwpModel/RapModel.class
Binary file not shown.
2 changes: 1 addition & 1 deletion bin/com/ameliaWx/radarView/res/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</head>
<body>
<h1>About the Creator</h1>
<p class="version"><i>RadarView Beta Version 4 - Released August 6, 2023</i></p>
<p class="version"><i>RadarView Beta Version 5 - Released September 13, 2023</i></p>
<p>Amelia Urquhart (born 2004) is a weather photographer and a meteorology student at the University of Oklahoma. She has been interested in meteorology as long as she can remember, and she has early memories of watching The Weather Channel's secondary cable station on which they played the radar loop and forecast for the Dallas-Fort Worth area on repeat. She has sheltered several times from severe storms and tornadoes, including the Rowlett, TX EF-4 of 2015; the Wylie, TX Hailstorm of 2016; and the North Dallas EF-3 of 2019. She has experienced a heat index of 115 °F and a wind chill of −22 °F.</p>
<p>She started to learn to program in Java in 2016, and began her journey in meteorological programming by making a program that displayed current GFS model data. This later evolved into a project which uploaded images of current model data from the HRRR, HRDPS, HRRR-AK, HRDPS-NORTH, and GFS for areas across the world. RadarView is her current primary project, and she later plans to make an open-source model data viewer that functions in a similar way.</p>
<p>Her scientific interests include tornadogenesis (an extremely common interest among meteorologists), RFD formation, giant hail formation, winter weather precipitation type nowcasting, and mesoscale weather modeling. She is still an underclassman in the undergraduate meteorology program, and her interests are likely to evolve and expand.</p>
Expand Down
16 changes: 14 additions & 2 deletions bin/com/ameliaWx/radarView/res/helpPage.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</head>
<body>
<h1>RadarView Help Page</h1>
<p class="version"><i>Beta Version 4 - Released August 6, 2023<br>Made by <a href="about.html">Amelia Urquhart</a></i></p>
<p class="version"><i>Beta Version 5 - Released September 13, 2023<br>Made by <a href="about.html">Amelia Urquhart</a></i></p>
<a href="https://docs.google.com/forms/d/e/1FAIpQLScJ_znAk9eXMFkPeXFscD6WDZAvThl3yZHq1_kdk6m0l59I9A/viewform?usp=sf_link">Click here to report a bug</a>
<br>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSdteKWtiyNbjerKJ60fR7MtbUqR4ig4x7Yw0VKbO6yetnwsRQ/viewform?usp=sf_link">Click here to request a feature</a>
Expand All @@ -25,7 +25,7 @@ <h2>Source Code Availability</h2>
<p>Source code is available at <a href = "https://github.com/a-urq/radarview">https://github.com/a-urq/radarview</a>.</p>

<h2>Acknowledgements</h2>
<p><i>Special thanks to Rylan Lopez and Richie Cross for helping me test this program on MacOS and Morgan J. Fuld for helping me test on Windows.</i></p>
<p><i>Special thanks to Rylan Lopez and Richie Cross for helping me test this program on MacOS, Morgan J. Fuld for helping me test on Windows, and William Thiesing for telling me that there are extra reflectivity scans in the NEXRAD data files. I'm still figuring out how to access that extra data as of writing.</i></p>

<h2>City Data Attribution</h2>
<p>The city data used in RadarView is a modified version of the data provided by <a href = "https://simplemaps.com/data/us-cities">Simplemaps</a> under the Creative Commons Attribution 4.0 license.</p>
Expand All @@ -41,6 +41,14 @@ <h2>Contents</h2>
<li><a href="#future">Future Features</a></li>
</ul>


<h2 id="whatsnew">What's New in Beta Version 5</h2>
<ul>
<li>Observational Soundings! Press B and select a station to view weather balloon data from anywhere in the US.</li>
<li>50 mb Mixed Layer CAPE removed, replaced with Inflow Layer CAPE (ILCAPE).</li>
<li>Skew-Ts made to be more skewed.</li>
</ul>

<h2 id="whatsnew">What's New in Beta Version 4</h2>
<ul>
<li>RAP Soundings! Right-click anywhere to get a sense of the meteorological environment with a vertical temperature and wind profile, as well as a set of readouts for both severe thunderstorms and winter weather.</li>
Expand Down Expand Up @@ -185,6 +193,10 @@ <h2 id="controls">Controls</h2>
<td>A</td>
<td>Changes the length of the radar animation. Has no immediate effect if animation mode is turned off.</td>
</tr>
<tr>
<td>B</td>
<td>Displays a dialog box to select a station for which to view radiosonde (weather balloon) data.</td>
</tr>
<tr>
<td>C</td>
<td>Toggles the visibility of cities.</td>
Expand Down
20 changes: 17 additions & 3 deletions src/com/ameliaWx/radarView/RadarData.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;

import com.ameliaWx.radarView.nwpModel.PtypeAlgorithm;
import com.ameliaWx.radarView.nwpModel.RapInterpModel;
import com.ameliaWx.radarView.nwpModel.RapModel;

import ucar.ma2.Array;
import ucar.ma2.DataType;
import ucar.nc2.NetcdfFile;
import ucar.nc2.Variable;

Expand Down Expand Up @@ -148,7 +150,7 @@ public RadarData(NetcdfFile ncfile, String timestamp, int maxAmtTilts, double ra
Variable baseVlcyAzi = ncfile.findVariable("azimuthV_HI");

Variable specWdth = ncfile.findVariable("SpectrumWidth_HI");
Variable specWdthAzi = ncfile.findVariable("azimuthV_HI");
Variable specWdthAzi = baseVlcyAzi;

Variable diffReflAzi = ncfile.findVariable("azimuthD_HI");

Expand All @@ -165,6 +167,12 @@ public RadarData(NetcdfFile ncfile, String timestamp, int maxAmtTilts, double ra
System.out.println("corrCoef: " + corrCoef);
System.out.println("diffPhse: " + diffPhse);

System.out.println("baseReflAzi: " + baseReflAzi);
System.out.println("baseVlcyAzi: " + baseVlcyAzi);
System.out.println("diffReflAzi: " + diffReflAzi);
System.out.println("corrCoefAzi: " + corrCoefAzi);
System.out.println("diffPhseAzi: " + diffPhseAzi);

reflectivity = readNexradData(baseRefl, baseReflAzi, reflPostProc, -33.0f, -32.5f, maxAmtTilts);
radialVelocity = readNexradData(baseVlcy, baseVlcyAzi, vlcyPostProc, -64.5f, -64.0f, maxAmtTilts);
spectrumWidth = readNexradData(specWdth, specWdthAzi, spwdPostProc, -64.5f, -64.0f, maxAmtTilts);
Expand Down Expand Up @@ -240,6 +248,7 @@ public RadarData(NetcdfFile ncfile, String timestamp, int maxAmtTilts, double ra
// return readNexradData(rawData, azimuths, proc, -1024, -2048);
// }

@SuppressWarnings("deprecation")
private static float[][][] readNexradData(Variable rawData, Variable azimuths, PostProc proc, float ndValue,
float rfValue, int maxAmtTilts) throws IOException {
if(rawData == null) return new float[1][720][1832];
Expand All @@ -256,7 +265,6 @@ private static float[][][] readNexradData(Variable rawData, Variable azimuths, P
_data = rawData.read();
_azi = azimuths.read();

@SuppressWarnings("deprecation")
boolean isDiffRefl = ("DifferentialReflectivity_HI".equals(rawData.getName()));

if (isDiffRefl) {
Expand Down Expand Up @@ -589,6 +597,7 @@ public String inspect(double latitude, double longitude) {
}

return dataStr;
// return dataStr + "<a: " + azi + ", r:" + range + ">";
}

private static final double SIZE_RADIAL = 50;
Expand Down Expand Up @@ -1052,7 +1061,12 @@ public void run() {
precipitationType[i][j] = (byte) RadarView.modelI1.getPrecipitationType(getScanTime(),
queryLat, queryLon, RadarView.srtm.getElevation(queryLat, queryLon));
}


if(i == 710 && j == 829) {
System.out.println("ptype[710, 829]: " + precipitationType[i][j]);
RadarView.modelI1.getPrecipitationType(getScanTime(),
queryLat, queryLon, PtypeAlgorithm.BOURGOUIN_REVISED_EXTENDED, true, RadarView.srtm.getElevation(queryLat, queryLon), true);
}
// g.setColor(RadarView.refl12PTypesColors.getColor(reflectivity[0][i][j], RadarView.modelI0.getPrecipitationType(modelInitTime, 80 - j * 0.1, -130 + i * 0.1)));
// g.fillRect(i, j, 1, 1);
}
Expand Down
4 changes: 4 additions & 0 deletions src/com/ameliaWx/radarView/RadarPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,10 @@ public void run() {

private void drawWarnings(double ulLon, double ulLat, double lrLon, double lrLat, double ppd,
ArrayList<ArrayList<PointD>> warningPolygons, ArrayList<String> warningNames) {
if(RadarView.warningPolygons == null) {
return;
}

int imgWidth = (int) ((lrLon - ulLon) * ppd);
int imgHeight = (int) ((ulLat - lrLat) * ppd);

Expand Down
56 changes: 51 additions & 5 deletions src/com/ameliaWx/radarView/RadarView.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@
import com.ameliaWx.radarView.srtm.SrtmModel2;
import com.ameliaWx.soundingViewer.Sounding;
import com.ameliaWx.soundingViewer.SoundingFrame;
import com.ameliaWx.soundingViewer.unixTool.RadiosondeSite;
import com.ameliaWx.soundingViewer.unixTool.RadiosondeWrapper;
import com.ameliaWx.weatherUtils.WeatherUtils;
import com.univocity.parsers.csv.CsvParser;
import com.univocity.parsers.csv.CsvParserSettings;
Expand Down Expand Up @@ -164,7 +166,9 @@ public class RadarView extends JFrame {
public static boolean viewCities = true;

public static boolean isWindows = false;


public static ArrayList<String> radiosondeList = null;

public static void main(String[] args) {
// try {
// RadarPanel.drawWorldMap();
Expand Down Expand Up @@ -241,6 +245,9 @@ public RadarView() {
loadRadarSites();
segmentTimes[0] = System.currentTimeMillis() - segmentStartTime;

loadWindow.setTitle("Initializing RadarView: Loading radiosonde sites...");
radiosondeList = RadiosondeSite.fourLetterCodeList();

loadWindow.setTitle("Initializing RadarView: Loading cities...");
segmentStartTime = System.currentTimeMillis();
loadCities();
Expand Down Expand Up @@ -1287,7 +1294,7 @@ public void paintComponent(Graphics g) {
// System.out.printf("%4.1f", 100.0 * usedMemory / maxMemory);
// System.out.println("%");

instance.setTitle("RadarView Beta Version 4 (" + String.format("%4.1f", 100.0 * usedMemory / maxMemory)
instance.setTitle("RadarView Beta Version 5 (" + String.format("%4.1f", 100.0 * usedMemory / maxMemory)
+ "%, " + convToGigaMega(usedMemory).trim() + ")");
// long paintEndTime = System.currentTimeMillis();
// System.out.println("paint exec time: " + (paintEndTime - paintStartTime) + " ms");
Expand Down Expand Up @@ -1416,6 +1423,9 @@ public void run() {
// JOptionPane.showMessageDialog(null,
// "The data download may take a while. You will be notified when it is finished.");
break;
case KeyEvent.VK_B:
displayRadiosonde();
break;
case KeyEvent.VK_C:
viewCities = !viewCities;
g.repaint();
Expand Down Expand Up @@ -1893,8 +1903,9 @@ private void displaySounding(int x, int y) {
PointD dR = PointD.subtract(dR2, dR1);
double windOffsetAngle = Math.atan2(-dR.getY(), dR.getX());

new SoundingFrame("RAP", sounding0Obj, soundingTime0, soundingMObj, soundingTimeM, sounding1Obj, soundingTime1,
SoundingFrame s = new SoundingFrame("RAP", sounding0Obj, soundingTime0, soundingMObj, soundingTimeM, sounding1Obj, soundingTime1,
lat, lon, windOffsetAngle, new RadarMapInset());
s.setLocationRelativeTo(instance);
}

private Sounding hashMapToNwpSounding(HashMap<NwpField, Float> hashMap) {
Expand Down Expand Up @@ -2224,6 +2235,14 @@ private static void readConfigTxt() {
}
}

private static void displayRadiosonde() {
String radiosonde = (String) JOptionPane.showInputDialog(null,
"What radiosonde would you like to view?\n", "Choose Radiosonde",
JOptionPane.QUESTION_MESSAGE, null, radiosondeList.toArray(), 0);

RadiosondeWrapper.displayCurrentSounding(RadiosondeSite.findSite(radiosonde.substring(0, 4)));
}

private static void chooseDefaultRadarSite() {
String[] radarNames = new String[radarSites.size()];

Expand Down Expand Up @@ -2538,17 +2557,26 @@ private static void downloadNexradData(String radarSite, int animLength, List<St
System.err.println("Caught EOF!");
} catch (NullPointerException e) {
testPassed = false;
System.err.println("Caught NullPtr!");
System.err.println("Caught NullPtr! test passed: " + testPassed);
System.out.println("test passed: " + testPassed);
} finally {
new File(dataFolder + radarSite + "-test.nexrad.uncompress").delete();
}

int testOffset = testPassed ? 0 : 1;

// if(mostRecentFilename.length() >= 4) {
// String mrfPrefix = mostRecentFilename.substring(0, 4);
// if(prevChosenRadar != mrfPrefix) {
// System.out.println("prevChosenRadar/mrfPrefix:\t" + prevChosenRadar + "\t" + mrfPrefix);
// prevChosenRadar = mrfPrefix;
// }
// }

System.out.println("nexrad files: " + Arrays.toString(nexradFiles.toArray()));
System.out.println("most recent filename: " + mostRecentFilename);

System.out.println("chosenRadar/prevChosenRadar:\t" + chosenRadar + "\t" + prevChosenRadar);

if (radarData == null || !chosenRadar.equals(prevChosenRadar)) {
animationMode = false;

Expand Down Expand Up @@ -2597,6 +2625,7 @@ private static void downloadNexradData(String radarSite, int animLength, List<St
boolean foundInLookback = false;
for (int lookback = 1; lookback < nexradFiles.size() - 2; lookback++) {
if (mostRecentFilename.equals(nexradFiles.get(lookback + testOffset))) {
foundInLookback = true;
System.out.println("test passed: " + testPassed);
System.out.println("test offset: " + testOffset);

Expand Down Expand Up @@ -3183,6 +3212,23 @@ private static ArrayList<PointD> getPointsStormReports(File kml) {
String name = nameSuperstring.substring(10, nameSuperstring.length() - 11);

String[] latLonAlt = coords.split(",");

boolean foundInvalidData = false;
for(int i = 0; i < latLonAlt.length; i++) {
// Pattern pC = Pattern.compile("[^0-9\\.-]");
// Matcher mC = pC.matcher(placemark);

try {
Double.valueOf(latLonAlt[i]);
} catch (NumberFormatException e) {
foundInvalidData = true;
break;
}
}

if(foundInvalidData) {
continue;
}

PointD coord = new PointD(Double.valueOf(latLonAlt[1]), Double.valueOf(latLonAlt[0]));

Expand Down
Loading

0 comments on commit c7dd492

Please sign in to comment.