Skip to content

Commit

Permalink
Fixed bug in precipitation type algorithms.
Browse files Browse the repository at this point in the history
  • Loading branch information
a-urq committed Aug 17, 2023
1 parent d7ab3f3 commit df00d97
Show file tree
Hide file tree
Showing 25 changed files with 27 additions and 1 deletion.
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 modified bin/com/ameliaWx/radarView/nwpModel/RapInterpModel.class
Binary file not shown.
19 changes: 19 additions & 0 deletions src/com/ameliaWx/radarView/RadarView.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@

import com.ameliaWx.radarView.nwpModel.LambertConformalProjection;
import com.ameliaWx.radarView.nwpModel.NwpField;
import com.ameliaWx.radarView.nwpModel.PtypeAlgorithm;
import com.ameliaWx.radarView.nwpModel.RapInterpModel;
import com.ameliaWx.radarView.nwpModel.RapModel;
import com.ameliaWx.radarView.srtm.SrtmModel2;
Expand Down Expand Up @@ -1471,6 +1472,24 @@ public void run() {

g.repaint();

break;
case KeyEvent.VK_P:
DateTime scanTime = radarData[chosenTimestep].getScanTime();
double westLon = centralLon - ((g.getWidth() - 200) / 2) / pixelsPerDegree;
double eastLon = centralLon + ((g.getWidth() - 200) / 2) / pixelsPerDegree;
double northLat = centralLat + ((g.getHeight()) / 2) / pixelsPerDegree;
double southLat = centralLat - ((g.getHeight()) / 2) / pixelsPerDegree;

double lon = linScale(0, g.getWidth() - 200, westLon, eastLon, mx);
double lat = linScale(0, g.getHeight(), northLat, southLat, my);

double srtmElev = srtm.getElevation(lat, lon);

if(scanTime.isAfter(time1)) {
modelI1.getPrecipitationType(scanTime, lat, lon, PtypeAlgorithm.BOURGOUIN_REVISED_EXTENDED, true, srtmElev, true);
} else {
modelI0.getPrecipitationType(scanTime, lat, lon, PtypeAlgorithm.BOURGOUIN_REVISED_EXTENDED, true, srtmElev, true);
}
break;
case KeyEvent.VK_R:
if (e.isControlDown()) {
Expand Down
9 changes: 8 additions & 1 deletion src/com/ameliaWx/radarView/nwpModel/RapInterpModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ public int getPrecipitationType(DateTime time, double latitude, double longitude
// rewrite to use getDataForPtypesAsArray
public int getPrecipitationType(DateTime time, double latitude, double longitude, PtypeAlgorithm algo,
boolean dynamicInitLayer, double srtmElev) {
return getPrecipitationType(time, latitude, longitude, algo, dynamicInitLayer, srtmElev, false);
}

public int getPrecipitationType(DateTime time, double latitude, double longitude, PtypeAlgorithm algo,
boolean dynamicInitLayer, double srtmElev, boolean debug) {
// HashMap<NwpField, Double> tmpProfile = getData(time, latitude, longitude);
if (model1.getData(0, latitude, longitude, NwpField.TMP_2M) != -1024.0) {
float timeNormalized = getTimeInterpWeight(time);
Expand Down Expand Up @@ -149,6 +154,8 @@ public int getPrecipitationType(DateTime time, double latitude, double longitude
// System.out.println(hgtSurface/100 + " m");
// System.out.println(tmpSurface/100 + " K");
// System.out.print("pre\t");

if(debug) System.out.println("ptype debug on");

PrecipitationType ptype = PrecipitationType.RAIN;
switch (algo) {
Expand All @@ -160,7 +167,7 @@ public int getPrecipitationType(DateTime time, double latitude, double longitude
break;
case BOURGOUIN_REVISED_EXTENDED:
ptype = PtypeAlgorithms.bourgouinRevisedExtendedMethod(pressureLevels, tmpIsobaric, dptIsobaric,
hgtIsobaric, presSurface, hgtSurface, tmpSurface, dynamicInitLayer);
hgtIsobaric, presSurface, hgtSurface, tmpSurface, dynamicInitLayer, debug);
break;
case URQUHART_EXPERIMENTAL:
break;
Expand Down

0 comments on commit df00d97

Please sign in to comment.