diff --git a/bin/com/ameliaWx/radarView/ColorTable.class b/bin/com/ameliaWx/radarView/ColorTable.class new file mode 100644 index 0000000..6259bb0 Binary files /dev/null and b/bin/com/ameliaWx/radarView/ColorTable.class differ diff --git a/bin/com/ameliaWx/radarView/RadarData.class b/bin/com/ameliaWx/radarView/RadarData.class index 92109d7..6f7235f 100644 Binary files a/bin/com/ameliaWx/radarView/RadarData.class and b/bin/com/ameliaWx/radarView/RadarData.class differ diff --git a/bin/com/ameliaWx/radarView/RadarDealiasingTest$1.class b/bin/com/ameliaWx/radarView/RadarDealiasingTest$1.class index 6c29231..7e5df5c 100644 Binary files a/bin/com/ameliaWx/radarView/RadarDealiasingTest$1.class and b/bin/com/ameliaWx/radarView/RadarDealiasingTest$1.class differ diff --git a/bin/com/ameliaWx/radarView/RadarDealiasingTest$2.class b/bin/com/ameliaWx/radarView/RadarDealiasingTest$2.class index 81cd24a..f1a7e77 100644 Binary files a/bin/com/ameliaWx/radarView/RadarDealiasingTest$2.class and b/bin/com/ameliaWx/radarView/RadarDealiasingTest$2.class differ diff --git a/bin/com/ameliaWx/radarView/RadarDealiasingTest$3.class b/bin/com/ameliaWx/radarView/RadarDealiasingTest$3.class index 2a96a19..a7f5f03 100644 Binary files a/bin/com/ameliaWx/radarView/RadarDealiasingTest$3.class and b/bin/com/ameliaWx/radarView/RadarDealiasingTest$3.class differ diff --git a/bin/com/ameliaWx/radarView/RadarDealiasingTest.class b/bin/com/ameliaWx/radarView/RadarDealiasingTest.class index d906c78..f5c677c 100644 Binary files a/bin/com/ameliaWx/radarView/RadarDealiasingTest.class and b/bin/com/ameliaWx/radarView/RadarDealiasingTest.class differ diff --git a/bin/com/ameliaWx/radarView/RadarMapInset.class b/bin/com/ameliaWx/radarView/RadarMapInset.class index 4ba6d05..611cbe6 100644 Binary files a/bin/com/ameliaWx/radarView/RadarMapInset.class and b/bin/com/ameliaWx/radarView/RadarMapInset.class differ diff --git a/bin/com/ameliaWx/radarView/RadarPanel$1.class b/bin/com/ameliaWx/radarView/RadarPanel$1.class index e30476c..974a9d7 100644 Binary files a/bin/com/ameliaWx/radarView/RadarPanel$1.class and b/bin/com/ameliaWx/radarView/RadarPanel$1.class differ diff --git a/bin/com/ameliaWx/radarView/RadarPanel$2.class b/bin/com/ameliaWx/radarView/RadarPanel$2.class index c190256..72e915c 100644 Binary files a/bin/com/ameliaWx/radarView/RadarPanel$2.class and b/bin/com/ameliaWx/radarView/RadarPanel$2.class differ diff --git a/bin/com/ameliaWx/radarView/RadarPanel$3.class b/bin/com/ameliaWx/radarView/RadarPanel$3.class index b43292b..b3dd7ab 100644 Binary files a/bin/com/ameliaWx/radarView/RadarPanel$3.class and b/bin/com/ameliaWx/radarView/RadarPanel$3.class differ diff --git a/bin/com/ameliaWx/radarView/RadarPanel$4.class b/bin/com/ameliaWx/radarView/RadarPanel$4.class index db84726..ddf165e 100644 Binary files a/bin/com/ameliaWx/radarView/RadarPanel$4.class and b/bin/com/ameliaWx/radarView/RadarPanel$4.class differ diff --git a/bin/com/ameliaWx/radarView/RadarPanel.class b/bin/com/ameliaWx/radarView/RadarPanel.class index 8550880..ce34690 100644 Binary files a/bin/com/ameliaWx/radarView/RadarPanel.class and b/bin/com/ameliaWx/radarView/RadarPanel.class differ diff --git a/bin/com/ameliaWx/radarView/RadarSite.class b/bin/com/ameliaWx/radarView/RadarSite.class index aeccc52..2855b0e 100644 Binary files a/bin/com/ameliaWx/radarView/RadarSite.class and b/bin/com/ameliaWx/radarView/RadarSite.class differ diff --git a/bin/com/ameliaWx/radarView/RadarView$1.class b/bin/com/ameliaWx/radarView/RadarView$1.class index 93427a4..b2ccc42 100644 Binary files a/bin/com/ameliaWx/radarView/RadarView$1.class and b/bin/com/ameliaWx/radarView/RadarView$1.class differ diff --git a/bin/com/ameliaWx/radarView/RadarView$2.class b/bin/com/ameliaWx/radarView/RadarView$2.class index 45b1a44..2eca279 100644 Binary files a/bin/com/ameliaWx/radarView/RadarView$2.class and b/bin/com/ameliaWx/radarView/RadarView$2.class differ diff --git a/bin/com/ameliaWx/radarView/RadarView$3.class b/bin/com/ameliaWx/radarView/RadarView$3.class index 4499915..cafb392 100644 Binary files a/bin/com/ameliaWx/radarView/RadarView$3.class and b/bin/com/ameliaWx/radarView/RadarView$3.class differ diff --git a/bin/com/ameliaWx/radarView/RadarView$4.class b/bin/com/ameliaWx/radarView/RadarView$4.class index 7f3d26d..913b3ab 100644 Binary files a/bin/com/ameliaWx/radarView/RadarView$4.class and b/bin/com/ameliaWx/radarView/RadarView$4.class differ diff --git a/bin/com/ameliaWx/radarView/RadarView$5.class b/bin/com/ameliaWx/radarView/RadarView$5.class index d3ce7b7..1267b41 100644 Binary files a/bin/com/ameliaWx/radarView/RadarView$5.class and b/bin/com/ameliaWx/radarView/RadarView$5.class differ diff --git a/bin/com/ameliaWx/radarView/RadarView$6.class b/bin/com/ameliaWx/radarView/RadarView$6.class new file mode 100644 index 0000000..a143580 Binary files /dev/null and b/bin/com/ameliaWx/radarView/RadarView$6.class differ diff --git a/bin/com/ameliaWx/radarView/RadarView$AnimateThread$1.class b/bin/com/ameliaWx/radarView/RadarView$AnimateThread$1.class index 20277e3..43cfd30 100644 Binary files a/bin/com/ameliaWx/radarView/RadarView$AnimateThread$1.class and b/bin/com/ameliaWx/radarView/RadarView$AnimateThread$1.class differ diff --git a/bin/com/ameliaWx/radarView/RadarView$AnimateThread.class b/bin/com/ameliaWx/radarView/RadarView$AnimateThread.class index c4de71c..5fedce5 100644 Binary files a/bin/com/ameliaWx/radarView/RadarView$AnimateThread.class and b/bin/com/ameliaWx/radarView/RadarView$AnimateThread.class differ diff --git a/bin/com/ameliaWx/radarView/RadarView$CheckOnlineThread$1.class b/bin/com/ameliaWx/radarView/RadarView$CheckOnlineThread$1.class index 4c0db60..dfd767e 100644 Binary files a/bin/com/ameliaWx/radarView/RadarView$CheckOnlineThread$1.class and b/bin/com/ameliaWx/radarView/RadarView$CheckOnlineThread$1.class differ diff --git a/bin/com/ameliaWx/radarView/RadarView$CheckOnlineThread.class b/bin/com/ameliaWx/radarView/RadarView$CheckOnlineThread.class index 4996366..0f9db32 100644 Binary files a/bin/com/ameliaWx/radarView/RadarView$CheckOnlineThread.class and b/bin/com/ameliaWx/radarView/RadarView$CheckOnlineThread.class differ diff --git a/bin/com/ameliaWx/radarView/RadarView$RVGraphics.class b/bin/com/ameliaWx/radarView/RadarView$RVGraphics.class index 1acf579..d935c67 100644 Binary files a/bin/com/ameliaWx/radarView/RadarView$RVGraphics.class and b/bin/com/ameliaWx/radarView/RadarView$RVGraphics.class differ diff --git a/bin/com/ameliaWx/radarView/RadarView$RVKeyListener$1.class b/bin/com/ameliaWx/radarView/RadarView$RVKeyListener$1.class index ab44195..a1a40db 100644 Binary files a/bin/com/ameliaWx/radarView/RadarView$RVKeyListener$1.class and b/bin/com/ameliaWx/radarView/RadarView$RVKeyListener$1.class differ diff --git a/bin/com/ameliaWx/radarView/RadarView$RVKeyListener$2.class b/bin/com/ameliaWx/radarView/RadarView$RVKeyListener$2.class index f099f5b..4757d37 100644 Binary files a/bin/com/ameliaWx/radarView/RadarView$RVKeyListener$2.class and b/bin/com/ameliaWx/radarView/RadarView$RVKeyListener$2.class differ diff --git a/bin/com/ameliaWx/radarView/RadarView$RVKeyListener$3.class b/bin/com/ameliaWx/radarView/RadarView$RVKeyListener$3.class index a4f1cb7..d464fb5 100644 Binary files a/bin/com/ameliaWx/radarView/RadarView$RVKeyListener$3.class and b/bin/com/ameliaWx/radarView/RadarView$RVKeyListener$3.class differ diff --git a/bin/com/ameliaWx/radarView/RadarView$RVKeyListener.class b/bin/com/ameliaWx/radarView/RadarView$RVKeyListener.class index b4a96e8..2079124 100644 Binary files a/bin/com/ameliaWx/radarView/RadarView$RVKeyListener.class and b/bin/com/ameliaWx/radarView/RadarView$RVKeyListener.class differ diff --git a/bin/com/ameliaWx/radarView/RadarView$RVMouseListener$1.class b/bin/com/ameliaWx/radarView/RadarView$RVMouseListener$1.class index a304951..a731a0b 100644 Binary files a/bin/com/ameliaWx/radarView/RadarView$RVMouseListener$1.class and b/bin/com/ameliaWx/radarView/RadarView$RVMouseListener$1.class differ diff --git a/bin/com/ameliaWx/radarView/RadarView$RVMouseListener$2.class b/bin/com/ameliaWx/radarView/RadarView$RVMouseListener$2.class index 50d2b59..ee18829 100644 Binary files a/bin/com/ameliaWx/radarView/RadarView$RVMouseListener$2.class and b/bin/com/ameliaWx/radarView/RadarView$RVMouseListener$2.class differ diff --git a/bin/com/ameliaWx/radarView/RadarView$RVMouseListener.class b/bin/com/ameliaWx/radarView/RadarView$RVMouseListener.class index 29dc757..5503c1a 100644 Binary files a/bin/com/ameliaWx/radarView/RadarView$RVMouseListener.class and b/bin/com/ameliaWx/radarView/RadarView$RVMouseListener.class differ diff --git a/bin/com/ameliaWx/radarView/RadarView$RVMouseMotionListener.class b/bin/com/ameliaWx/radarView/RadarView$RVMouseMotionListener.class index 1d2bdf3..6a322e2 100644 Binary files a/bin/com/ameliaWx/radarView/RadarView$RVMouseMotionListener.class and b/bin/com/ameliaWx/radarView/RadarView$RVMouseMotionListener.class differ diff --git a/bin/com/ameliaWx/radarView/RadarView$RVMouseWheelListener.class b/bin/com/ameliaWx/radarView/RadarView$RVMouseWheelListener.class index 446e3ea..1eaffc3 100644 Binary files a/bin/com/ameliaWx/radarView/RadarView$RVMouseWheelListener.class and b/bin/com/ameliaWx/radarView/RadarView$RVMouseWheelListener.class differ diff --git a/bin/com/ameliaWx/radarView/RadarView$RefreshTimerThread$1.class b/bin/com/ameliaWx/radarView/RadarView$RefreshTimerThread$1.class index 5704de1..a52912d 100644 Binary files a/bin/com/ameliaWx/radarView/RadarView$RefreshTimerThread$1.class and b/bin/com/ameliaWx/radarView/RadarView$RefreshTimerThread$1.class differ diff --git a/bin/com/ameliaWx/radarView/RadarView$RefreshTimerThread$RefreshWorkerThread.class b/bin/com/ameliaWx/radarView/RadarView$RefreshTimerThread$RefreshWorkerThread.class index 7e2d5c9..4c502f4 100644 Binary files a/bin/com/ameliaWx/radarView/RadarView$RefreshTimerThread$RefreshWorkerThread.class and b/bin/com/ameliaWx/radarView/RadarView$RefreshTimerThread$RefreshWorkerThread.class differ diff --git a/bin/com/ameliaWx/radarView/RadarView$RefreshTimerThread.class b/bin/com/ameliaWx/radarView/RadarView$RefreshTimerThread.class index dcd3d45..6ca53e1 100644 Binary files a/bin/com/ameliaWx/radarView/RadarView$RefreshTimerThread.class and b/bin/com/ameliaWx/radarView/RadarView$RefreshTimerThread.class differ diff --git a/bin/com/ameliaWx/radarView/RadarView.class b/bin/com/ameliaWx/radarView/RadarView.class index 2e7151f..da78c7d 100644 Binary files a/bin/com/ameliaWx/radarView/RadarView.class and b/bin/com/ameliaWx/radarView/RadarView.class differ diff --git a/bin/com/ameliaWx/radarView/mapProjections/EquirectangularProjection.class b/bin/com/ameliaWx/radarView/mapProjections/EquirectangularProjection.class new file mode 100644 index 0000000..cf295c7 Binary files /dev/null and b/bin/com/ameliaWx/radarView/mapProjections/EquirectangularProjection.class differ diff --git a/bin/com/ameliaWx/radarView/mapProjections/LambertConformalProjection.class b/bin/com/ameliaWx/radarView/mapProjections/LambertConformalProjection.class new file mode 100644 index 0000000..ad61e1d Binary files /dev/null and b/bin/com/ameliaWx/radarView/mapProjections/LambertConformalProjection.class differ diff --git a/bin/com/ameliaWx/radarView/mapProjections/MapProjection.class b/bin/com/ameliaWx/radarView/mapProjections/MapProjection.class new file mode 100644 index 0000000..d4e6512 Binary files /dev/null and b/bin/com/ameliaWx/radarView/mapProjections/MapProjection.class differ diff --git a/bin/com/ameliaWx/radarView/mapProjections/PolarStereographicProjection.class b/bin/com/ameliaWx/radarView/mapProjections/PolarStereographicProjection.class new file mode 100644 index 0000000..ce21ade Binary files /dev/null and b/bin/com/ameliaWx/radarView/mapProjections/PolarStereographicProjection.class differ diff --git a/bin/com/ameliaWx/radarView/mapProjections/RadialProjection.class b/bin/com/ameliaWx/radarView/mapProjections/RadialProjection.class new file mode 100644 index 0000000..b4e8854 Binary files /dev/null and b/bin/com/ameliaWx/radarView/mapProjections/RadialProjection.class differ diff --git a/bin/com/ameliaWx/radarView/nwpModel/HrrrAkSubhourlyModel.class b/bin/com/ameliaWx/radarView/nwpModel/HrrrAkSubhourlyModel.class index e4c0a87..65916a2 100644 Binary files a/bin/com/ameliaWx/radarView/nwpModel/HrrrAkSubhourlyModel.class and b/bin/com/ameliaWx/radarView/nwpModel/HrrrAkSubhourlyModel.class differ diff --git a/bin/com/ameliaWx/radarView/nwpModel/HrrrModel.class b/bin/com/ameliaWx/radarView/nwpModel/HrrrModel.class index 9acbf00..8a715ad 100644 Binary files a/bin/com/ameliaWx/radarView/nwpModel/HrrrModel.class and b/bin/com/ameliaWx/radarView/nwpModel/HrrrModel.class differ diff --git a/bin/com/ameliaWx/radarView/nwpModel/HrrrSubhourlyModel.class b/bin/com/ameliaWx/radarView/nwpModel/HrrrSubhourlyModel.class index a12377e..8a849a8 100644 Binary files a/bin/com/ameliaWx/radarView/nwpModel/HrrrSubhourlyModel.class and b/bin/com/ameliaWx/radarView/nwpModel/HrrrSubhourlyModel.class differ diff --git a/bin/com/ameliaWx/radarView/nwpModel/HybridModel.class b/bin/com/ameliaWx/radarView/nwpModel/HybridModel.class index 4dec029..043e8fb 100644 Binary files a/bin/com/ameliaWx/radarView/nwpModel/HybridModel.class and b/bin/com/ameliaWx/radarView/nwpModel/HybridModel.class differ diff --git a/bin/com/ameliaWx/radarView/nwpModel/RapInterpModel.class b/bin/com/ameliaWx/radarView/nwpModel/RapInterpModel.class index a0f9411..1277322 100644 Binary files a/bin/com/ameliaWx/radarView/nwpModel/RapInterpModel.class and b/bin/com/ameliaWx/radarView/nwpModel/RapInterpModel.class differ diff --git a/bin/com/ameliaWx/radarView/nwpModel/RapModel.class b/bin/com/ameliaWx/radarView/nwpModel/RapModel.class index 9bc590f..f4d55a6 100644 Binary files a/bin/com/ameliaWx/radarView/nwpModel/RapModel.class and b/bin/com/ameliaWx/radarView/nwpModel/RapModel.class differ diff --git a/bin/com/ameliaWx/radarView/nwpModel/test/NwpModelTest.class b/bin/com/ameliaWx/radarView/nwpModel/test/NwpModelTest.class index 8eda256..4a2d0c7 100644 Binary files a/bin/com/ameliaWx/radarView/nwpModel/test/NwpModelTest.class and b/bin/com/ameliaWx/radarView/nwpModel/test/NwpModelTest.class differ diff --git a/bin/com/ameliaWx/radarView/res/UbuntuMono-B.ttf b/bin/com/ameliaWx/radarView/res/UbuntuMono-B.ttf new file mode 100644 index 0000000..7bd6665 Binary files /dev/null and b/bin/com/ameliaWx/radarView/res/UbuntuMono-B.ttf differ diff --git a/bin/com/ameliaWx/radarView/res/colortables/aru/aruCrcf.pal b/bin/com/ameliaWx/radarView/res/colortables/aru/aruCrcf.pal new file mode 100644 index 0000000..cbd3735 --- /dev/null +++ b/bin/com/ameliaWx/radarView/res/colortables/aru/aruCrcf.pal @@ -0,0 +1,24 @@ +; +; Full range correlation coefficient palette +; Made by Zander Urquhart +; + +Product: CC +Units: NONE +Step: 0.001 + +Color: 0 0 0 0 +Color: 0.5 128 128 148 +Color: 0.6 0 0 64 +Color: 0.7 0 0 128 +Color: 0.8 255 255 128 +Color: 0.9 255 150 64 +Color: 0.95 192 75 0 +Color: 0.975 128 0 0 +Color: 1.0 64 0 0 +Color: 1.01 128 16 112 +Color: 1.05 255 128 255 +Color: 1.1 255 255 255 + +ND: 0 0 0 +RF: 128 0 192 diff --git a/bin/com/ameliaWx/radarView/res/colortables/aru/aruDphs.pal b/bin/com/ameliaWx/radarView/res/colortables/aru/aruDphs.pal new file mode 100644 index 0000000..6365802 --- /dev/null +++ b/bin/com/ameliaWx/radarView/res/colortables/aru/aruDphs.pal @@ -0,0 +1,21 @@ +; +; Full range differential phase palette +; Made by Zander Urquhart +; + +Product: DP +Units: degree +Step: 30 + +Color: 0 255 255 255 +Color: 15 255 255 255 +Color: 30 0 0 64 +Color: 45 128 255 128 +Color: 60 0 64 0 +Color: 75 255 255 128 +Color: 90 255 128 0 +Color: 120 64 0 0 +Color: 180 255 128 255 + +ND: 0 0 0 +RF: 128 0 192 diff --git a/bin/com/ameliaWx/radarView/res/colortables/aru/aruDrfl.pal b/bin/com/ameliaWx/radarView/res/colortables/aru/aruDrfl.pal new file mode 100644 index 0000000..3ed8cc9 --- /dev/null +++ b/bin/com/ameliaWx/radarView/res/colortables/aru/aruDrfl.pal @@ -0,0 +1,24 @@ +; +; Full range differential reflectivity palette +; Made by Zander Urquhart +; + +Product: ZDR +Units: DB +Step: 1 + +Color: -8 0 0 0 +Color: -3.5 0 0 0 +Color: 0 180 180 180 +Color: 0.5 0 0 96 +Color: 1 128 255 255 +Color: 2 0 64 0 +Color: 2.5 255 255 128 +Color: 3 255 128 0 +Color: 4 192 0 0 +Color: 5 64 0 0 +Color: 8 255 127 255 + + +ND: 0 0 0 +RF: 128 0 192 diff --git a/bin/com/ameliaWx/radarView/res/colortables/aru/aruKdp.pal b/bin/com/ameliaWx/radarView/res/colortables/aru/aruKdp.pal new file mode 100644 index 0000000..529a224 --- /dev/null +++ b/bin/com/ameliaWx/radarView/res/colortables/aru/aruKdp.pal @@ -0,0 +1,23 @@ +; +; Full range KDP palette +; Made by Zander Urquhart +; + +Product: DP +Units: DEG/KM +Step: 30 + +Color: -2.0 64 64 64 +Color: -1.0 150 150 150 +Color: -0.5 64 0 16 +Color: 0.0 128 0 0 +Color: 1.0 255 128 128 +Color: 2.0 96 0 128 +Color: 3.0 128 128 255 +Color: 4.0 0 64 0 +Color: 5.0 255 255 128 +Color: 6.0 128 64 0 +Color: 10.0 255 255 255 + +ND: 0 0 0 +RF: 128 0 192 diff --git a/bin/com/ameliaWx/radarView/res/colortables/aru/aruPrecipDepiction.pal b/bin/com/ameliaWx/radarView/res/colortables/aru/aruPrecipDepiction.pal new file mode 100644 index 0000000..a7398af --- /dev/null +++ b/bin/com/ameliaWx/radarView/res/colortables/aru/aruPrecipDepiction.pal @@ -0,0 +1,36 @@ +; +; Full range reflectivity palette +; Made by Amelia Urquhart +; + +Product: BR +Units: dBZ +Step: 10 + +Color: 0 0 0 0 RAIN +Color: 10 0 128 63 RAIN +Color: 20 128 255 192 RAIN +Color: 30 0 64 0 RAIN +Color: 40 255 255 128 RAIN +Color: 50 64 0 0 RAIN +Color: 60 255 127 255 RAIN + +Color: 0 0 0 0 MIX +Color: 20 255 170 170 MIX +Color: 30 192 0 0 64 0 0 MIX +Color: 40 32 32 64 MIX +Color: 45 127 225 255 MIX +Color: 50 215 235 255 MIX +Color: 60 30 90 30 MIX + +Color: 0 0 0 0 SNOW +Color: 20 153 255 255 SNOW +Color: 30 0 127 255 0 0 64 SNOW +Color: 40 64 0 64 SNOW +Color: 45 192 125 192 SNOW +Color: 50 255 225 255 SNOW +Color: 60 90 30 30 SNOW + + +ND: 0 0 0 +RF: 128 0 192 diff --git a/bin/com/ameliaWx/radarView/res/colortables/aru/aruPwat.pal b/bin/com/ameliaWx/radarView/res/colortables/aru/aruPwat.pal new file mode 100644 index 0000000..35a4b4e --- /dev/null +++ b/bin/com/ameliaWx/radarView/res/colortables/aru/aruPwat.pal @@ -0,0 +1,23 @@ +; +; Full range precipitable water and vertically integrated liquid palette +; Made by Amelia Urquhart +; + +Product: PWAT +Units: kg/m^2 +Step: 10 + +Color: 0 70 70 70 218 218 218 +Color: 10 244 221 189 90 57 57 +Color: 20 57 65 103 +Color: 30 176 237 255 +Color: 40 12 27 103 +Color: 50 12 255 12 14 80 16 +Color: 60 87 40 87 +Color: 70 241 41 237 +Color: 80 110 18 12 +Color: 100 255 250 12 + + +ND: 0 0 0 +RF: 128 0 192 diff --git a/bin/com/ameliaWx/radarView/res/colortables/aru/aruRefl-12Ptypes.pal b/bin/com/ameliaWx/radarView/res/colortables/aru/aruRefl-12Ptypes.pal new file mode 100644 index 0000000..74df937 --- /dev/null +++ b/bin/com/ameliaWx/radarView/res/colortables/aru/aruRefl-12Ptypes.pal @@ -0,0 +1,77 @@ +; +; Full range reflectivity palette +; Made by Zander Urquhart +; + +Product: BR +Units: dBZ +Step: 10 + +Color: 0 0 0 0 RAIN +Color: 10 0 64 32 RAIN +Color: 20 128 255 192 RAIN +Color: 30 0 64 0 RAIN +Color: 40 255 255 128 RAIN +Color: 50 64 0 0 RAIN +Color: 60 255 127 255 RAIN + +Color: 0 0 0 0 FRZR_ELEV +Color: 10 64 18 18 FRZR_ELEV +Color: 20 255 70 70 FRZR_ELEV +Color: 40 145 0 0 FRZR_ELEV +Color: 60 32 0 0 FRZR_ELEV + +Color: 0 0 0 0 FRZR_SRFC +Color: 10 64 43 43 FRZR_SRFC +Color: 20 255 170 170 FRZR_SRFC +Color: 40 255 0 0 FRZR_SRFC +Color: 60 128 0 0 FRZR_SRFC + +Color: 0 0 0 0 FRZR_ICEP_MIX +Color: 10 64 19 64 FRZR_ICEP_MIX +Color: 20 255 75 255 FRZR_ICEP_MIX +Color: 60 75 0 75 FRZR_ICEP_MIX + +Color: 0 0 0 0 ICEP +Color: 10 51 23 64 ICEP +Color: 20 203 93 255 ICEP +Color: 60 48 0 64 ICEP + +Color: 0 0 0 0 RAIN_ICEP_MIX +Color: 10 51 43 38 RAIN_ICEP_MIX +Color: 20 203 173 153 RAIN_ICEP_MIX +Color: 60 20 20 20 RAIN_ICEP_MIX + +Color: 0 0 0 0 RAIN_SNOW_MIX +Color: 10 38 43 51 RAIN_SNOW_MIX +Color: 20 153 173 203 RAIN_SNOW_MIX +Color: 60 20 20 20 RAIN_SNOW_MIX + +Color: 0 0 0 0 ICEP_SNOW_MIX +Color: 10 64 32 0 ICEP_SNOW_MIX +Color: 20 255 128 0 ICEP_SNOW_MIX +Color: 60 75 22 0 ICEP_SNOW_MIX + +Color: 0 0 0 0 FRZR_SNOW_MIX +Color: 10 49 31 31 FRZR_SNOW_MIX +Color: 20 194 123 123 FRZR_SNOW_MIX +Color: 60 50 30 30 FRZR_SNOW_MIX + +Color: 0 0 0 0 WET_SNOW +Color: 10 19 32 64 WET_SNOW +Color: 20 76 127 255 WET_SNOW +Color: 60 0 0 102 WET_SNOW + +Color: 0 0 0 0 DRY_SNOW +Color: 10 19 64 64 DRY_SNOW +Color: 20 76 255 255 DRY_SNOW +Color: 60 20 55 102 DRY_SNOW + +Color: 0 0 0 0 VERY_DRY_SNOW +Color: 10 38 64 64 VERY_DRY_SNOW +Color: 20 153 255 255 VERY_DRY_SNOW +Color: 60 0 30 102 VERY_DRY_SNOW + + +ND: 0 0 0 +RF: 128 0 192 diff --git a/bin/com/ameliaWx/radarView/res/colortables/aru/aruRefl-3Ptypes.pal b/bin/com/ameliaWx/radarView/res/colortables/aru/aruRefl-3Ptypes.pal new file mode 100644 index 0000000..bd9308f --- /dev/null +++ b/bin/com/ameliaWx/radarView/res/colortables/aru/aruRefl-3Ptypes.pal @@ -0,0 +1,39 @@ +; +; Full range reflectivity palette +; Made by Zander Urquhart +; + +Product: BR +Units: dBZ +Step: 10 + +Color: 0 0 0 0 RAIN +Color: 10 0 64 32 RAIN +Color: 20 128 255 192 RAIN +Color: 30 0 64 0 RAIN +Color: 40 255 255 128 RAIN +Color: 50 64 0 0 RAIN +Color: 60 255 127 255 RAIN + +Color: 0 0 0 0 WINTRY_MIX +Color: 10 64 40 40 WINTRY_MIX +Color: 20 255 170 170 WINTRY_MIX +Color: 30 192 0 0 64 0 0 WINTRY_MIX +Color: 40 32 32 64 WINTRY_MIX +Color: 45 127 175 215 WINTRY_MIX +; Color: 45 127 225 255 WINTRY_MIX bluer 45s +Color: 50 215 235 255 WINTRY_MIX +Color: 60 30 90 30 WINTRY_MIX + +Color: 0 0 0 0 SNOW +Color: 10 40 64 64 SNOW +Color: 20 153 255 255 SNOW +Color: 30 0 127 255 0 0 64 SNOW +Color: 40 64 0 64 SNOW +Color: 45 192 125 192 SNOW +Color: 50 255 225 255 SNOW +Color: 60 90 30 30 SNOW + + +ND: 0 0 0 +RF: 128 0 192 diff --git a/bin/com/ameliaWx/radarView/res/colortables/aru/aruRefl-4Ptypes.pal b/bin/com/ameliaWx/radarView/res/colortables/aru/aruRefl-4Ptypes.pal new file mode 100644 index 0000000..6a6428e --- /dev/null +++ b/bin/com/ameliaWx/radarView/res/colortables/aru/aruRefl-4Ptypes.pal @@ -0,0 +1,44 @@ +; +; Full range reflectivity palette +; Made by Amelia Urquhart +; + +Product: BR +Units: dBZ +Step: 10 + +Color: 0 0 0 0 RAIN +Color: 10 0 64 32 RAIN +Color: 20 128 255 192 RAIN +Color: 30 0 64 0 RAIN +Color: 40 255 255 128 RAIN +Color: 50 64 0 0 RAIN +Color: 60 255 127 255 RAIN + +Color: 0 0 0 0 FRZR +Color: 10 64 32 48 FRZR +Color: 20 255 140 198 FRZR +Color: 30 191 80 143 64 16 48 FRZR +Color: 40 64 0 16 FRZR +Color: 50 255 0 0 FRZR +Color: 60 255 192 192 FRZR + +Color: 0 0 0 0 ICEP +Color: 10 48 32 64 ICEP +Color: 20 192 128 255 ICEP +Color: 30 130 32 180 48 16 64 ICEP +Color: 40 32 32 48 ICEP +Color: 60 215 215 245 ICEP + +Color: 0 0 0 0 SNOW +Color: 10 40 64 64 SNOW +Color: 20 153 255 255 SNOW +Color: 30 0 127 255 0 0 64 SNOW +Color: 40 64 0 64 SNOW +Color: 45 192 125 192 SNOW +Color: 50 255 225 255 SNOW +Color: 60 90 30 30 SNOW + + +ND: 0 0 0 +RF: 128 0 192 \ No newline at end of file diff --git a/bin/com/ameliaWx/radarView/res/colortables/aru/aruRefl.pal b/bin/com/ameliaWx/radarView/res/colortables/aru/aruRefl.pal new file mode 100644 index 0000000..6d311c8 --- /dev/null +++ b/bin/com/ameliaWx/radarView/res/colortables/aru/aruRefl.pal @@ -0,0 +1,24 @@ +; +; Full range reflectivity palette +; Made by Amelia Urquhart +; + +Product: BR +Units: dBZ +Step: 10 + +Color: -30 0 0 0 +Color: -29.999 64 0 96 +Color: -0 180 180 190 +Color: 10 0 0 96 128 255 255 +Color: 20 128 255 192 +Color: 30 0 48 16 +Color: 40 255 255 128 +Color: 50 64 0 0 +Color: 60 255 127 255 +Color: 70 64 0 64 +Color: 80 128 255 255 + + +ND: 0 0 0 +RF: 128 0 192 diff --git a/bin/com/ameliaWx/radarView/res/colortables/aru/aruReflFrzr.pal b/bin/com/ameliaWx/radarView/res/colortables/aru/aruReflFrzr.pal new file mode 100644 index 0000000..344293c --- /dev/null +++ b/bin/com/ameliaWx/radarView/res/colortables/aru/aruReflFrzr.pal @@ -0,0 +1,18 @@ +; +; Full range freezing rain reflectivity palette (low filter) +; Made by Zander Urquhart +; + +Product: BR +Units: DBZ +Step: 10 + +Color: 0 0 0 0 +Color: 20 255 129 255 +Color: 30 152 62 152 64 16 64 +Color: 40 64 0 16 +Color: 50 255 0 0 +Color: 60 255 192 192 + +ND: 0 0 0 +RF: 128 0 192 \ No newline at end of file diff --git a/bin/com/ameliaWx/radarView/res/colortables/aru/aruReflHighSat.pal b/bin/com/ameliaWx/radarView/res/colortables/aru/aruReflHighSat.pal new file mode 100644 index 0000000..83bfde5 --- /dev/null +++ b/bin/com/ameliaWx/radarView/res/colortables/aru/aruReflHighSat.pal @@ -0,0 +1,27 @@ +; +; Full range high-saturation reflectivity palette +; Made by Amelia Urquhart +; + +Product: BR +Units: dBZ +Step: 10 + +Color: -30 0 0 0 +Color: -29.999 64 0 96 +Color: -5 179 179 179 104 101 92 +Color: 10 0 0 255 +Color: 15 5 110 254 4 225 254 +Color: 25 0 105 5 +Color: 30 4 179 12 0 255 4 +Color: 40 255 255 0 +Color: 45 255 194 0 +Color: 50 255 132 0 +Color: 55 255 77 0 177 33 32 +Color: 60 255 83 241 +Color: 70 178 45 188 +Color: 80 128 255 255 + + +ND: 0 0 0 +RF: 128 0 192 diff --git a/bin/com/ameliaWx/radarView/res/colortables/aru/aruReflHighSatLowFilter.pal b/bin/com/ameliaWx/radarView/res/colortables/aru/aruReflHighSatLowFilter.pal new file mode 100644 index 0000000..38e3f27 --- /dev/null +++ b/bin/com/ameliaWx/radarView/res/colortables/aru/aruReflHighSatLowFilter.pal @@ -0,0 +1,25 @@ +; +; Full range high-saturation reflectivity palette +; Made by Amelia Urquhart +; + +Product: BR +Units: dBZ +Step: 10 + +Color: 0 0 0 0 +Color: 10 0 0 255 +Color: 15 5 110 254 4 225 254 +Color: 25 0 105 5 +Color: 30 4 179 12 0 255 4 +Color: 40 255 255 0 +Color: 45 255 194 0 +Color: 50 255 132 0 +Color: 55 255 77 0 177 33 32 +Color: 60 255 83 241 +Color: 70 178 45 188 +Color: 80 128 255 255 + + +ND: 0 0 0 +RF: 128 0 192 diff --git a/bin/com/ameliaWx/radarView/res/colortables/aru/aruReflIcep.pal b/bin/com/ameliaWx/radarView/res/colortables/aru/aruReflIcep.pal new file mode 100644 index 0000000..4d7798b --- /dev/null +++ b/bin/com/ameliaWx/radarView/res/colortables/aru/aruReflIcep.pal @@ -0,0 +1,17 @@ +; +; Full range ice pellets reflectivity palette (low filter) +; Made by Zander Urquhart +; + +Product: BR +Units: DBZ +Step: 10 + +Color: 0 0 0 0 +Color: 20 192 128 255 +Color: 30 80 32 200 48 16 64 +Color: 40 32 32 48 +Color: 60 215 215 245 + +ND: 0 0 0 +RF: 128 0 192 \ No newline at end of file diff --git a/bin/com/ameliaWx/radarView/res/colortables/aru/aruReflLowFilter.pal b/bin/com/ameliaWx/radarView/res/colortables/aru/aruReflLowFilter.pal new file mode 100644 index 0000000..42f7a27 --- /dev/null +++ b/bin/com/ameliaWx/radarView/res/colortables/aru/aruReflLowFilter.pal @@ -0,0 +1,23 @@ +; +; Full range reflectivity palette (low filter) +; Made by Amelia Urquhart +; + +Product: BR +Units: DBZ +Step: 10 + + +Color: 0 0 0 0 +Color: 10 0 0 96 128 255 255 +Color: 20 128 255 192 +Color: 30 0 48 16 +Color: 40 255 255 128 +Color: 50 64 0 0 +Color: 60 255 127 255 +Color: 70 64 0 64 +Color: 80 128 255 255 + + +ND: 0 0 0 +RF: 128 0 192 diff --git a/bin/com/ameliaWx/radarView/res/colortables/aru/aruReflMix.pal b/bin/com/ameliaWx/radarView/res/colortables/aru/aruReflMix.pal new file mode 100644 index 0000000..33c84c9 --- /dev/null +++ b/bin/com/ameliaWx/radarView/res/colortables/aru/aruReflMix.pal @@ -0,0 +1,19 @@ +; +; Full range wintry mix reflectivity palette (low filter) +; Made by Zander Urquhart +; + +Product: BR +Units: DBZ +Step: 10 + +Color: 0 0 0 0 +Color: 20 255 170 170 +Color: 30 192 0 0 64 0 0 +Color: 40 32 32 64 +Color: 45 127 225 255 +Color: 50 215 235 255 +Color: 60 30 90 30 + +ND: 0 0 0 +RF: 128 0 192 \ No newline at end of file diff --git a/bin/com/ameliaWx/radarView/res/colortables/aru/aruReflSimple.pal b/bin/com/ameliaWx/radarView/res/colortables/aru/aruReflSimple.pal new file mode 100644 index 0000000..046202d --- /dev/null +++ b/bin/com/ameliaWx/radarView/res/colortables/aru/aruReflSimple.pal @@ -0,0 +1,22 @@ +; +; Full range reflectivity palette +; Made by Zander Urquhart +; + +Product: BR +Units: dBZ +Step: 10 + +Color: 0 0 0 0 0 0 0 +Color: 5 0 0 96 0 0 96 +Color: 10 128 255 255 128 255 255 +Color: 20 0 192 0 0 192 0 +Color: 30 255 255 128 255 255 128 +Color: 40 255 128 64 255 128 64 +Color: 50 255 0 0 255 0 0 +Color: 60 255 127 255 255 127 255 +Color: 70 255 127 255 + + +ND: 0 0 0 +RF: 128 0 192 diff --git a/bin/com/ameliaWx/radarView/res/colortables/aru/aruReflSnow.pal b/bin/com/ameliaWx/radarView/res/colortables/aru/aruReflSnow.pal new file mode 100644 index 0000000..223ddab --- /dev/null +++ b/bin/com/ameliaWx/radarView/res/colortables/aru/aruReflSnow.pal @@ -0,0 +1,19 @@ +; +; Full range snow reflectivity palette (low filter) +; Made by Zander Urquhart +; + +Product: BR +Units: DBZ +Step: 10 + +Color: 0 0 0 0 +Color: 20 153 255 255 +Color: 30 0 127 255 0 0 64 +Color: 40 64 0 64 +Color: 45 192 125 192 +Color: 50 255 225 255 +Color: 60 90 30 30 + +ND: 0 0 0 +RF: 128 0 192 \ No newline at end of file diff --git a/bin/com/ameliaWx/radarView/res/colortables/aru/aruSpwd.pal b/bin/com/ameliaWx/radarView/res/colortables/aru/aruSpwd.pal new file mode 100644 index 0000000..2decc96 --- /dev/null +++ b/bin/com/ameliaWx/radarView/res/colortables/aru/aruSpwd.pal @@ -0,0 +1,23 @@ +; +; Full range spectrum width palette +; Made by Zander Urquhart +; + +Product: SW +Units: mph +Step: 10 +Scale: 2.236936 ; converts mph to m/s + +Color: 0 5 5 10 +Color: 10 128 128 148 +Color: 15 255 128 128 +Color: 20 64 0 64 +Color: 25 255 128 255 +Color: 30 0 64 0 +Color: 35 128 255 128 +Color: 40 0 64 64 +Color: 50 128 255 255 +Color: 60 255 255 255 + +ND: 0 0 0 +RF: 128 0 192 diff --git a/bin/com/ameliaWx/radarView/res/colortables/aru/aruTmp.pal b/bin/com/ameliaWx/radarView/res/colortables/aru/aruTmp.pal new file mode 100644 index 0000000..5fb2e04 --- /dev/null +++ b/bin/com/ameliaWx/radarView/res/colortables/aru/aruTmp.pal @@ -0,0 +1,31 @@ +; +; Full range temperature palette +; Made by Amelia Urquhart +; + +Product: TMP +Units: K +Step: 10 + +Color: 173.15 125 75 125 +Color: 193.15 75 125 75 +Color: 213.15 255 235 235 +Color: 223.15 60 255 255 60 60 255 +Color: 233.15 60 60 230 +Color: 243.15 255 150 220 +Color: 253.15 143 0 143 +Color: 255.37 255 255 255 +Color: 263.15 55 0 155 150 220 255 +Color: 273.15 150 255 255 +Color: 278.15 0 191 127 +Color: 283.15 0 127 0 +Color: 288.15 50 191 50 +Color: 293.15 255 255 50 +Color: 298.15 175 50 0 64 0 0 +Color: 303.15 127 0 0 +Color: 313.15 255 170 255 +Color: 323.15 71 48 71 +Color: 333.15 0 0 0 + +ND: 20 20 25 +RF: 64 64 64 diff --git a/bin/com/ameliaWx/radarView/res/colortables/aru/aruVlcy.pal b/bin/com/ameliaWx/radarView/res/colortables/aru/aruVlcy.pal new file mode 100644 index 0000000..5f76955 --- /dev/null +++ b/bin/com/ameliaWx/radarView/res/colortables/aru/aruVlcy.pal @@ -0,0 +1,28 @@ +; +; Full range radial velocity palette +; Made by Zander Urquhart +; + +Product: RV +Units: mph +Step: 20 +Scale: 2.236936 ; converts mph to m/s + +Color: -120 64 0 64 +Color: -100 128 0 128 +Color: -80 128 128 255 +Color: -60 0 0 64 +Color: -40 128 255 255 +Color: -20 0 96 64 +Color: -10 64 160 96 224 232 228 +Color: 0 232 224 224 +Color: 10 192 64 64 +Color: 20 96 64 0 +Color: 40 255 192 128 +Color: 60 64 0 64 +Color: 80 255 128 255 +Color: 100 255 64 128 +Color: 120 128 0 64 + +ND: 0 0 0 +RF: 128 0 192 diff --git a/bin/com/ameliaWx/radarView/res/colortables/awips/refl-awips-neon-2015.pal b/bin/com/ameliaWx/radarView/res/colortables/awips/refl-awips-neon-2015.pal new file mode 100644 index 0000000..10caf36 --- /dev/null +++ b/bin/com/ameliaWx/radarView/res/colortables/awips/refl-awips-neon-2015.pal @@ -0,0 +1,24 @@ +# https://www.colortables.com/reflectivity/awips-neon-2015 + +product: BR +units: dBZ +step: 5 + +solidcolor: 90 58 103 181 +solidcolor: 89 58 103 181 +Color: 75 5 236 240 1 32 32 +Color: 70 178 0 255 105 0 219 +Color: 65 255 117 255 225 11 227 +Color: 60 255 255 255 255 157 255 +Color: 50 255 0 0 75 0 0 +Color: 40 255 226 0 255 128 0 +color: 35 255 255 0 255 226 0 +Color: 32 17 100 17 17 100 17 +Color: 25 17 214 24 +Color: 22 140 230 255 +color: 19 30 148 242 +Color: 15 22 65 175 +Color: 10 19 33 62 +Color4: -5 40 48 66 100 +color4: -20 162 66 213 0 +Color4: -30 56 18 78 0 diff --git a/bin/com/ameliaWx/radarView/res/colortables/awips/refl-awips.pal b/bin/com/ameliaWx/radarView/res/colortables/awips/refl-awips.pal new file mode 100644 index 0000000..01f07eb --- /dev/null +++ b/bin/com/ameliaWx/radarView/res/colortables/awips/refl-awips.pal @@ -0,0 +1,18 @@ +; Based on the color table used at the Oklahoma Weather Lab WDTD April 12 2023 event + +product:BR +units: dBZ +step: 5 + +color: -20 0 0 0 128 128 128 +color: 15 128 255 240 +color: 25 128 255 150 0 48 0 +color: 35 32 64 0 +color: 40 255 255 110 200 110 0 +color: 50 255 0 0 32 0 0 +color: 60 255 255 255 +color: 65 157 102 157 40 10 40 +color: 70 0 255 255 +color: 80 10 40 40 + +nd: 0 0 0 diff --git a/src/com/ameliaWx/radarView/ColorTable.java b/src/com/ameliaWx/radarView/ColorTable.java new file mode 100644 index 0000000..8b1f7f4 --- /dev/null +++ b/src/com/ameliaWx/radarView/ColorTable.java @@ -0,0 +1,823 @@ +package com.ameliaWx.radarView; + +import java.awt.Color; +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.Graphics2D; +import java.awt.Rectangle; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.net.URL; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Scanner; + +import javax.imageio.ImageIO; + +import org.apache.commons.io.FileUtils; + +public class ColorTable { + // write this to read in *.pal files, unmodified. use sam emmerson's colortables + // as tests + + private static final int NUM_MASKS = 12; // number of precip types supported + private Color[][] colors = new Color[NUM_MASKS][]; + private boolean[] masksUsed = new boolean[NUM_MASKS]; + private Color noData; + private Color rangeFolded; + + private float ndValue = -1024; + private float rfValue = -2048; + + private float vmax; + private float vmin; + private String units; + + private float interval; + + private float scale = 1; + + // for testing + public static void main(String[] args) throws IOException { + ColorTable aruRefl = new ColorTable(loadResourceAsFile("res/colortables/awips/refl-awips-neon-2015.pal"), 0.1f, 10, "dBZ"); + + System.out.println("refl @ -40 dBZ: " + aruRefl.getColor(-40)); + System.out.println("refl @ -1024 dBZ: " + aruRefl.getColor(-1024)); + + ImageIO.write(aruRefl.drawColorLegend(200, 650, 67, true), "PNG", new File("aruReflLowFilter.png")); + } + + public ColorTable(File f, float resolution, float interval, String units) { + this.units = units; + this.interval = interval; + + Scanner sc = null; + try { + sc = new Scanner(f); + } catch (FileNotFoundException e) { + vmax = 0.0f; + vmin = 0.0f; + + e.printStackTrace(); + } + + ArrayList tokensList = new ArrayList<>(); + + while (sc.hasNextLine()) { + String line = sc.nextLine(); + + if (line.length() == 0) + continue; + if (';' == line.charAt(0)) + continue; + + if (line.toLowerCase().startsWith("color:")) { + StringBuilder tokensStr = new StringBuilder(); + + Scanner lineSc = new Scanner(line); + + while (lineSc.hasNext()) { + tokensStr.append(lineSc.next() + " "); + } + lineSc.close(); + + String[] tokens = tokensStr.toString().split(" "); + +// System.out.println(Arrays.toString(tokens)); + + tokensList.add(tokens); + } + + if (line.toLowerCase().startsWith("color4:")) { + StringBuilder tokensStr = new StringBuilder(); + + Scanner lineSc = new Scanner(line); + + while (lineSc.hasNext()) { + tokensStr.append(lineSc.next() + " "); + } + lineSc.close(); + + String[] tokens = tokensStr.toString().split(" "); + +// System.out.println(Arrays.toString(tokens)); + + tokensList.add(tokens); + } + + if (line.toLowerCase().startsWith("solidcolor:")) { + StringBuilder tokensStr = new StringBuilder(); + + Scanner lineSc = new Scanner(line); + + while (lineSc.hasNext()) { + tokensStr.append(lineSc.next() + " "); + } + lineSc.close(); + + String[] tokens = tokensStr.toString().split(" "); + +// System.out.println(Arrays.toString(tokens)); + + tokensList.add(tokens); + } + + if (line.toLowerCase().startsWith("scale:")) { + StringBuilder tokensStr = new StringBuilder(); + + Scanner lineSc = new Scanner(line); + + while (lineSc.hasNext()) { + tokensStr.append(lineSc.next() + " "); + } + lineSc.close(); + + String[] tokens = tokensStr.toString().split(" "); + + scale = Float.valueOf(tokens[1]); +// System.out.println("scale: " + scale); + } + + if (line.toLowerCase().startsWith("nd:")) { + StringBuilder tokensStr = new StringBuilder(); + + Scanner lineSc = new Scanner(line); + + while (lineSc.hasNext()) { + tokensStr.append(lineSc.next() + " "); + } + lineSc.close(); + + String[] tokens = tokensStr.toString().split(" "); + + noData = new Color(Integer.valueOf(tokens[1]), Integer.valueOf(tokens[2]), Integer.valueOf(tokens[3])); + } + + if (line.toLowerCase().startsWith("rf:")) { + StringBuilder tokensStr = new StringBuilder(); + + Scanner lineSc = new Scanner(line); + + while (lineSc.hasNext()) { + tokensStr.append(lineSc.next() + " "); + } + lineSc.close(); + + String[] tokens = tokensStr.toString().split(" "); + + rangeFolded = new Color(Integer.valueOf(tokens[1]), Integer.valueOf(tokens[2]), + Integer.valueOf(tokens[3])); + } + } + + int[] colorKeyAmt = new int[NUM_MASKS]; + for (int i = 0; i < tokensList.size(); i++) { + String[] tokens = tokensList.get(i); + + int mask = 0; + + if (tokens.length % 3 == 0) { + String maskId = tokens[tokens.length - 1]; + + mask = maskId(maskId); + } + + int rgbValuesListed = (tokensList.get(i).length - 2) / 3; + + colorKeyAmt[mask] += rgbValuesListed; + + if(tokens[0].contains("solidcolor")) { +// System.out.println("solidcolor detected"); + colorKeyAmt[mask]++; + } + + if(mask == 0) System.out.println(colorKeyAmt[mask] + "\t" + tokens[0]); + } + + float[][] colorKeys = new float[NUM_MASKS][]; + Color[][] colorValues = new Color[NUM_MASKS][]; + + for (int i = 0; i < NUM_MASKS; i++) { + colorKeys[i] = new float[colorKeyAmt[i]]; + colorValues[i] = new Color[colorKeyAmt[i]]; + } + + int[] colorKeysProcessed = new int[NUM_MASKS]; + for (int mask = 0; mask < NUM_MASKS; mask++) { + for (int i = 0; i < tokensList.size(); i++) { + String[] tokens = tokensList.get(i); + if(mask == 0) System.out.println(colorKeysProcessed[mask] + "\t" + tokens[0]); + + int selectedMask = 0; + + if (tokens.length % 3 == 0) { + String maskId = tokens[tokens.length - 1]; + + selectedMask = maskId(maskId); + } + + if (mask == selectedMask) { + boolean color4 = tokens[0].toLowerCase().contains("color4"); + boolean solidcolor = tokens[0].toLowerCase().contains("solidcolor"); + + if(solidcolor && i < tokensList.size() - 1) { + colorKeys[mask][colorKeysProcessed[mask]] = Float.valueOf(tokens[1]); + colorValues[mask][colorKeysProcessed[mask]] = new Color(Integer.valueOf(tokens[2]), + Integer.valueOf(tokens[3]), Integer.valueOf(tokens[4])); + + colorKeysProcessed[mask]++; + + String[] nextColorTokens = tokensList.get(i + 1); + int orderSign = (int) Math.signum(Float.valueOf(nextColorTokens[1]) - Float.valueOf(tokens[1])); + + colorKeys[mask][colorKeysProcessed[mask]] = Float.valueOf(tokens[1]) + orderSign * 0.01f; + colorValues[mask][colorKeysProcessed[mask]] = new Color(Integer.valueOf(nextColorTokens[2]), + Integer.valueOf(nextColorTokens[3]), Integer.valueOf(nextColorTokens[4])); + + colorKeysProcessed[mask]++; + } else if(color4) { + int rgbValuesListed = (tokens.length - 2) / 4; + + for (int j = 0; j < rgbValuesListed; j++) { + colorKeys[mask][colorKeysProcessed[mask]] = Float.valueOf(tokens[1]); + colorValues[mask][colorKeysProcessed[mask]] = new Color(Integer.valueOf(tokens[2 + 4 * j]), + Integer.valueOf(tokens[3 + 4 * j]), Integer.valueOf(tokens[4 + 4 * j]), Integer.valueOf(tokens[5 + 4 * j])); + + colorKeysProcessed[mask]++; + } + } else { + int rgbValuesListed = (tokens.length - 2) / 3; + + for (int j = 0; j < rgbValuesListed; j++) { + colorKeys[mask][colorKeysProcessed[mask]] = Float.valueOf(tokens[1]); + colorValues[mask][colorKeysProcessed[mask]] = new Color(Integer.valueOf(tokens[2 + 3 * j]), + Integer.valueOf(tokens[3 + 3 * j]), Integer.valueOf(tokens[4 + 3 * j])); + + colorKeysProcessed[mask]++; + } + } + } + } + + if(colorKeys[0][0] > colorKeys[0][colorKeys[0].length - 1]) { + colorKeys = deepReverse(colorKeys); + colorValues = deepReverse(colorValues); + } + + shiftKeys(colorKeys[mask]); + } + + System.out.println(Arrays.toString(colorKeysProcessed)); + + vmin = colorKeys[0][0]; + vmax = colorKeys[0][colorKeys[0].length - 1]; + + for (int i = 0; i < NUM_MASKS; i++) { + colors[i] = new Color[(int) Math.round((vmax - vmin) / resolution) + 1]; + + masksUsed[i] = (colorValues[i].length != 0); + + for (float v = vmin; v <= vmax; v += resolution) { + int index = (int) Math.round((v - vmin) / resolution); + colors[i][index] = colorLerp(v, colorKeys[i], colorValues[i]); + } + } + + sc.close(); + + if(noData == null) { + noData = new Color(0, 0, 0, 0); + } + + if(rangeFolded == null) { + rangeFolded = new Color(0, 0, 0, 0); + } + } + + private static float[][] deepReverse(float[][] a) + { + int n = a.length; + float[][] b = new float[n][]; + + for (int i = 0; i < n; i++) { + b[i] = reverse(a[i]); + } + + return b; + } + + private static float[] reverse(float[] a) + { + int n = a.length; + float[] b = new float[n]; + int j = n; + + for (int i = 0; i < n; i++) { + b[j - 1] = a[i]; + j = j - 1; + } + + return b; + } + + private static Color[][] deepReverse(Color[][] a) + { + int n = a.length; + Color[][] b = new Color[n][]; + + for (int i = 0; i < n; i++) { + b[i] = reverse(a[i]); + } + + return b; + } + + private static Color[] reverse(Color[] a) + { + int n = a.length; + Color[] b = new Color[n]; + int j = n; + + for (int i = 0; i < n; i++) { + b[j - 1] = a[i]; + j = j - 1; + } + + return b; + } + + private static int maskId(String maskId) { + if ("RAIN".equals(maskId)) { + return 0; + } else if ("FRZR_SRFC".equals(maskId)) { + return 1; + } else if ("ICEP".equals(maskId)) { + return 2; + } else if ("VERY_DRY_SNOW".equals(maskId)) { + return 3; + } else if ("FRZR_SNOW_MIX".equals(maskId)) { + return 4; + } else if ("RAIN_SNOW_MIX".equals(maskId)) { + return 5; + } else if ("FRZR_ELEV".equals(maskId)) { + return 6; + } else if ("DRY_SNOW".equals(maskId)) { + return 7; + } else if ("WET_SNOW".equals(maskId)) { + return 8; + } else if ("RAIN_ICEP_MIX".equals(maskId)) { + return 9; + } else if ("FRZR_ICEP_MIX".equals(maskId)) { + return 10; + } else if ("ICEP_SNOW_MIX".equals(maskId)) { + return 11; + } + + else if ("FRZR".equals(maskId)) { + return 1; + } else if ("SNOW".equals(maskId)) { + return 3; + } + + else if ("WINTRY_MIX".equals(maskId)) { + return 1; + } + + return 0; + } + + // value should NEVER be outside keys. as such, handling for that case is not + // implemented + private Color colorLerp(float value, float[] keys, Color[] values) { + if (values.length == 0) + return Color.BLACK; + + for (int i = 0; i < keys.length - 1; i++) { + if (value > keys[i + 1]) + continue; + if (keys[i] == keys[i + 1]) + return values[i]; + + double w1 = (keys[i + 1] - value) / (keys[i + 1] - keys[i]); + double w2 = (value - keys[i]) / (keys[i + 1] - keys[i]); + + int r1 = values[i].getRed(); + int g1 = values[i].getGreen(); + int b1 = values[i].getBlue(); + int r2 = values[i + 1].getRed(); + int g2 = values[i + 1].getGreen(); + int b2 = values[i + 1].getBlue(); + +// Color c = new Color((int) Math.pow(Math.sqrt(r1) * w1 + Math.sqrt(r2) * w2, 2), (int) Math.pow(Math.sqrt(g1) * w1 + Math.sqrt(g2) * w2, 2), (int) Math.pow(Math.sqrt(b1) * w1 + Math.sqrt(b2) * w2, 2)); + Color c = new Color((int) (r1 * w1 + r2 * w2), (int) (g1 * w1 + g2 * w2), (int) (b1 * w1 + b2 * w2)); + + return c; + } + + return values[values.length - 1]; + } + + private void shiftKeys(float[] keys) { + for (int i = 0; i < keys.length - 2; i++) { + if (keys[i] == keys[i + 1]) { + keys[i + 1] = keys[i + 2]; + i++; + } + } + } + + public Color getColor(double value) { + return getColor(value, 0); + } + + public Color getColor(double value, int mask) { + if (vmax == vmin) + return Color.BLACK; + + // if specific colors are not specified in this mask, point to the appropriate mask's colors + if(!masksUsed[mask]) { + if(masksUsed[2]) { + //4-type logic + switch(mask) { + case 0: + mask = 0; + break; + case 1: + mask = 1; + break; + case 2: + mask = 2; + break; + case 3: + mask = 3; + break; + case 4: + mask = 1; + break; + case 5: + mask = 0; // 3; + break; + case 6: + mask = 1; + break; + case 7: + mask = 3; + break; + case 8: + mask = 3; + break; + case 9: + mask = 0; // 2; + break; + case 10: + mask = 1; + break; + case 11: + mask = 2; + break; + } + + } else if(masksUsed[1]) { + //3-type logic + switch(mask) { + case 0: + mask = 0; + break; + case 1: + mask = 1; + break; + case 2: + mask = 1; + break; + case 3: + mask = 3; + break; + case 4: + mask = 1; + break; + case 5: + mask = 1; + break; + case 6: + mask = 1; + break; + case 7: + mask = 3; + break; + case 8: + mask = 3; + break; + case 9: + mask = 1; + break; + case 10: + mask = 1; + break; + case 11: + mask = 1; + break; + } + } else { + //1-type logic; + mask = 0; + } + } + + if (value == ndValue) + return noData; + if (value == rfValue) + return rangeFolded; + + double resolution = (vmax - vmin) / colors[mask].length; + int index = (int) Math.round((value * scale - vmin) / resolution); + + if (index < 0) + return colors[mask][0]; + if (index >= colors[mask].length) + return colors[mask][colors[mask].length - 2]; + + return colors[mask][index]; + } + + public double getNdValue() { + return ndValue; + } + + public void setNdValue(float ndValue) { + this.ndValue = ndValue; + } + + public double getRfValue() { + return rfValue; + } + + public void setRfValue(float rfValue) { + this.rfValue = rfValue; + } + + public BufferedImage drawColorLegend(int width, int height, int padding, boolean vertical) { + int numMasksUsed = 0; + + for (int i = 0; i < NUM_MASKS; i++) { + numMasksUsed += masksUsed[i] ? 1 : 0; + } + + BufferedImage legend = new BufferedImage(width, height, BufferedImage.TYPE_3BYTE_BGR); + Graphics2D g = legend.createGraphics(); + g.setFont(new Font(Font.MONOSPACED, Font.BOLD, 12)); + + if (numMasksUsed == 1) { + g.drawImage(drawColorLegendSegment(width, height, padding, padding, 1, 0, vertical), 0, 0, null); + } else if (numMasksUsed <= 3) { + g.drawImage(drawColorLegendSegment(width, height / 3, padding, 10, 1, 0, vertical), 0, 0, null); + g.drawImage(drawColorLegendSegment(width, height / 3, padding, 10, 1, 1, vertical), 0, 1 * height / 3, + null); + g.drawImage(drawColorLegendSegment(width, height / 3, padding, 10, 1, 3, vertical), 0, 2 * height / 3, + null); + + drawCenteredString(g, "RAIN", new Rectangle(padding / 2, height / 6, 0, 0), g.getFont()); + + drawCenteredString(g, "WINTRY", + new Rectangle(padding / 2, 3 * height / 6 - g.getFontMetrics().getHeight() / 2, 0, 0), g.getFont()); + drawCenteredString(g, "MIX", + new Rectangle(padding / 2, 3 * height / 6 + g.getFontMetrics().getHeight() / 2, 0, 0), g.getFont()); + + drawCenteredString(g, "SNOW", new Rectangle(padding / 2, 5 * height / 6, 0, 0), g.getFont()); + } else if (numMasksUsed <= 4) { + g.drawImage(drawColorLegendSegment(width, height / 4, padding, 10, 2, 0, vertical), 0, 0, null); + g.drawImage(drawColorLegendSegment(width, height / 4, padding, 10, 2, 1, vertical), 0, 1 * height / 4, + null); + g.drawImage(drawColorLegendSegment(width, height / 4, padding, 10, 2, 2, vertical), 0, 2 * height / 4, + null); + g.drawImage(drawColorLegendSegment(width, height / 4, padding, 10, 2, 3, vertical), 0, 3 * height / 4, + null); + + drawCenteredString(g, "RAIN", new Rectangle(padding / 2, height / 8, 0, 0), g.getFont()); + + drawCenteredString(g, "FREEZING", + new Rectangle(padding / 2, 3 * height / 8 - g.getFontMetrics().getHeight() / 2, 0, 0), g.getFont()); + drawCenteredString(g, "RAIN", + new Rectangle(padding / 2, 3 * height / 8 + g.getFontMetrics().getHeight() / 2, 0, 0), g.getFont()); + + drawCenteredString(g, "ICE", + new Rectangle(padding / 2, 5 * height / 8 - g.getFontMetrics().getHeight() / 2, 0, 0), g.getFont()); + drawCenteredString(g, "PELLETS", + new Rectangle(padding / 2, 5 * height / 8 + g.getFontMetrics().getHeight() / 2, 0, 0), g.getFont()); + + drawCenteredString(g, "SNOW", new Rectangle(padding / 2, 7 * height / 8, 0, 0), g.getFont()); + } else if (numMasksUsed <= 12) { + g.drawImage(drawColorLegendSegment(width, height / 12, padding, 10, 6, 0, vertical), 0, 0, null); + g.drawImage(drawColorLegendSegment(width, height / 12, padding, 10, 6, 6, vertical), 0, 1 * height / 12, + null); + g.drawImage(drawColorLegendSegment(width, height / 12, padding, 10, 6, 1, vertical), 0, 2 * height / 12, + null); + g.drawImage(drawColorLegendSegment(width, height / 12, padding, 10, 6, 10, vertical), 0, 3 * height / 12, + null); + g.drawImage(drawColorLegendSegment(width, height / 12, padding, 10, 6, 2, vertical), 0, 4 * height / 12, + null); + g.drawImage(drawColorLegendSegment(width, height / 12, padding, 10, 6, 11, vertical), 0, 5 * height / 12, + null); + g.drawImage(drawColorLegendSegment(width, height / 12, padding, 10, 6, 9, vertical), 0, 6 * height / 12, + null); + g.drawImage(drawColorLegendSegment(width, height / 12, padding, 10, 6, 5, vertical), 0, 7 * height / 12, + null); + g.drawImage(drawColorLegendSegment(width, height / 12, padding, 10, 6, 4, vertical), 0, 8 * height / 12, + null); + g.drawImage(drawColorLegendSegment(width, height / 12, padding, 10, 6, 8, vertical), 0, 9 * height / 12, + null); + g.drawImage(drawColorLegendSegment(width, height / 12, padding, 10, 6, 7, vertical), 0, 10 * height / 12, + null); + g.drawImage(drawColorLegendSegment(width, height / 12, padding, 10, 6, 3, vertical), 0, 11 * height / 12, + null); + + drawCenteredString(g, "RAIN", new Rectangle(padding / 2, height / 24, 0, 0), g.getFont()); + + drawCenteredString(g, "FREEZING", + new Rectangle(padding / 2, 3 * height / 24 - g.getFontMetrics().getHeight(), 0, 0), g.getFont()); + drawCenteredString(g, "RAIN", + new Rectangle(padding / 2, 3 * height / 24, 0, 0), g.getFont()); + drawCenteredString(g, "(ELEVATED)", + new Rectangle(padding / 2, 3 * height / 24 + g.getFontMetrics().getHeight(), 0, 0), g.getFont()); + + drawCenteredString(g, "FREEZING", + new Rectangle(padding / 2, 5 * height / 24 - g.getFontMetrics().getHeight(), 0, 0), g.getFont()); + drawCenteredString(g, "RAIN", + new Rectangle(padding / 2, 5 * height / 24, 0, 0), g.getFont()); + drawCenteredString(g, "(SURFACE)", + new Rectangle(padding / 2, 5 * height / 24 + g.getFontMetrics().getHeight(), 0, 0), g.getFont()); + + drawCenteredString(g, "FRZR-ICEP", + new Rectangle(padding / 2, 7 * height / 24 - g.getFontMetrics().getHeight() / 2, 0, 0), g.getFont()); + drawCenteredString(g, "MIX", + new Rectangle(padding / 2, 7 * height / 24 + g.getFontMetrics().getHeight() / 2, 0, 0), g.getFont()); + + drawCenteredString(g, "ICE", + new Rectangle(padding / 2, 9 * height / 24 - g.getFontMetrics().getHeight() / 2, 0, 0), g.getFont()); + drawCenteredString(g, "PELLETS", + new Rectangle(padding / 2, 9 * height / 24 + g.getFontMetrics().getHeight() / 2, 0, 0), g.getFont()); + + drawCenteredString(g, "ICEP-SNOW", + new Rectangle(padding / 2, 11 * height / 24 - g.getFontMetrics().getHeight() / 2, 0, 0), g.getFont()); + drawCenteredString(g, "MIX", + new Rectangle(padding / 2, 11 * height / 24 + g.getFontMetrics().getHeight() / 2, 0, 0), g.getFont()); + + drawCenteredString(g, "RAIN-ICEP", + new Rectangle(padding / 2, 13 * height / 24 - g.getFontMetrics().getHeight() / 2, 0, 0), g.getFont()); + drawCenteredString(g, "MIX", + new Rectangle(padding / 2, 13 * height / 24 + g.getFontMetrics().getHeight() / 2, 0, 0), g.getFont()); + + drawCenteredString(g, "RAIN-SNOW", + new Rectangle(padding / 2, 15 * height / 24 - g.getFontMetrics().getHeight() / 2, 0, 0), g.getFont()); + drawCenteredString(g, "MIX", + new Rectangle(padding / 2, 15 * height / 24 + g.getFontMetrics().getHeight() / 2, 0, 0), g.getFont()); + + drawCenteredString(g, "FRZR-SNOW", + new Rectangle(padding / 2, 17 * height / 24 - g.getFontMetrics().getHeight() / 2, 0, 0), g.getFont()); + drawCenteredString(g, "MIX", + new Rectangle(padding / 2, 17 * height / 24 + g.getFontMetrics().getHeight() / 2, 0, 0), g.getFont()); + + drawCenteredString(g, "WET SNOW", new Rectangle(padding / 2, 19 * height / 24, 0, 0), g.getFont()); + + drawCenteredString(g, "DRY SNOW", new Rectangle(padding / 2, 21 * height / 24, 0, 0), g.getFont()); + + drawCenteredString(g, "VERY DRY", + new Rectangle(padding / 2, 23 * height / 24 - g.getFontMetrics().getHeight() / 2, 0, 0), g.getFont()); + drawCenteredString(g, "SNOW", + new Rectangle(padding / 2, 23 * height / 24 + g.getFontMetrics().getHeight() / 2, 0, 0), g.getFont()); + } + + return legend; + } + + public BufferedImage drawColorLegendSegment(int width, int height, int padding, int hPadding, int intvMult, + int mask, boolean vertical) { + BufferedImage legend = new BufferedImage(width, height, BufferedImage.TYPE_3BYTE_BGR); + Graphics2D g = legend.createGraphics(); + + g.setFont(new Font(Font.MONOSPACED, Font.BOLD, 12)); + g.setColor(Color.BLACK); + g.fillRect(0, 0, width, height); + g.setColor(Color.WHITE); + g.drawLine(0, 0, 0, height); + + if (vertical) { + for (int i = 0; i < height - 2 * hPadding; i++) { + double val = vmin + (vmax - vmin) / (height - 2 * hPadding) * i; + + g.setColor(getColor(val / scale, mask)); + g.fillRect(padding, height - hPadding - i, width - 2 * padding, 1); + } + + int numMarks = (int) Math.round((vmax - vmin) / (interval * intvMult)); + g.setColor(Color.WHITE); + for (int i = 0; i <= numMarks; i++) { + int y = (int) ((height - hPadding) - (height - 2.0 * hPadding) / numMarks * i); + double val = vmin + (vmax - vmin) / numMarks * i; + + if ("C".equals(units)) + val = convertKtoC(val); + if ("F".equals(units)) + val = convertKtoF(val); + + g.fillRect(padding, y, width - 2 * padding, 1); + drawCenteredString(g, String.format("%6.1f " + units, val), + new Rectangle(width - padding + 28, y, 0, 0), g.getFont()); + } + } else { + for (int i = 0; i < width - 2 * padding; i++) { + double val = vmin + (vmax - vmin) / (width - 2 * padding) * i; + + g.setColor(getColor(val / scale, mask)); + g.fillRect(i + padding, padding, 1, height - 2 * padding); + } + + int numMarks = (int) (Math.round(vmax - vmin) / interval); + g.setColor(Color.WHITE); + for (int i = 0; i <= numMarks; i++) { + int y = (int) ((width - padding) - (width - 2.0 * padding) / numMarks * i); + double val = vmin + (vmax - vmin) / numMarks * i; + + if ("C".equals(units)) + val = convertKtoC(val); + if ("F".equals(units)) + val = convertKtoF(val); + + g.fillRect(padding, y, height - 2 * padding, 1); + + String u = (i == 0) ? " " + units : ""; + + drawCenteredString(g, String.format("%6.1f" + u, val), new Rectangle(y, padding - 25, 0, 0), + g.getFont()); + } + } + + g.dispose(); + return legend; + } + + /** + * Draw a String centered in the middle of a Rectangle. + * + * @param g The Graphics instance. + * @param text The String to draw. + * @param rect The Rectangle to center the text in. + */ + public static void drawCenteredString(Graphics2D g, String text, Rectangle rect, Font font) { + // Get the FontMetrics + FontMetrics metrics = g.getFontMetrics(font); + // Determine the X coordinate for the text + int x = rect.x + (rect.width - metrics.stringWidth(text)) / 2; + // Determine the Y coordinate for the text (note we add the ascent, as in java + // 2d 0 is top of the screen) + int y = rect.y + (rect.height + metrics.getHeight()) / 3; + // Set the font + g.setFont(font); + // Draw the String + g.drawString(text, x, y); + } + + private static double convertKtoC(double k) { + return k - 273.15; + } + + private static double convertCtoF(double c) { + return 1.8 * c + 32.0; + } + + private static double convertKtoF(double k) { + return convertCtoF(convertKtoC(k)); + } + + private static File loadResourceAsFile(String urlStr) { +// System.out.println(urlStr); + URL url = RadarView.class.getResource(urlStr); +// System.out.println(url); +// System.out.println(is); + URL tilesObj = url; + + // System.out.println("Temp-file created."); + + RadarView.tempFilesToDelete.add(RadarView.dataFolder + "temp/" + urlStr + ""); + File file = new File(RadarView.dataFolder + "temp/" + urlStr + ""); + + if (tilesObj == null) { + System.out.println("Loading failed to start."); + return null; + } + + // System.out.println("Loading successfully started."); + + try { + FileUtils.copyURLToFile(tilesObj, file); + } catch (Exception e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + return null; + } + + return file; + } +} diff --git a/src/com/ameliaWx/radarView/RadarData.java b/src/com/ameliaWx/radarView/RadarData.java index b558b8e..e2fb8e3 100644 --- a/src/com/ameliaWx/radarView/RadarData.java +++ b/src/com/ameliaWx/radarView/RadarData.java @@ -546,7 +546,7 @@ public String inspect(double latitude, double longitude) { if(RadarView.numPtypes == 3) { pType = "WINTRY MIX"; } else if(RadarView.numPtypes == 4) { - pType = "SNOW"; + pType = "ICE PELLETS"; } else if(RadarView.numPtypes == 12) { pType = "ICEP-SNOW MIX"; } diff --git a/src/com/ameliaWx/radarView/RadarDealiasingTest.java b/src/com/ameliaWx/radarView/RadarDealiasingTest.java index a1e40f8..6d454e5 100644 --- a/src/com/ameliaWx/radarView/RadarDealiasingTest.java +++ b/src/com/ameliaWx/radarView/RadarDealiasingTest.java @@ -24,15 +24,17 @@ import org.joda.time.DateTime; import org.joda.time.DateTimeZone; +import com.ameliaWx.utils.general.PointF; + import ucar.ma2.Array; import ucar.nc2.NetcdfFile; import ucar.nc2.Variable; public class RadarDealiasingTest { - private static ArrayList> countyBorders; - private static ArrayList> stateBorders; - private static ArrayList> interstates; - private static ArrayList> majorRoads; + private static ArrayList> countyBorders; + private static ArrayList> stateBorders; + private static ArrayList> interstates; + private static ArrayList> majorRoads; static { File countyBordersKML = loadResourceAsFile("res/usCounties.kml"); @@ -65,9 +67,9 @@ public class RadarDealiasingTest { private static final String imgId = "09"; public static void main(String[] args) throws IOException { - ColorScale reflectivityColors = new ColorScale(RadarPanel.loadResourceAsFile("res/aruReflLowFilter.pal"), 0.1f, 10, "dBZ"); - ColorScale velocityColors = new ColorScale(RadarPanel.loadResourceAsFile("res/aruVlcy.pal"), 0.1f, 20, "mph"); - ColorScale spectrumWidthColors = new ColorScale(RadarPanel.loadResourceAsFile("res/aruSpwd.pal"), 0.1f, 20, "mph"); + ColorTable reflectivityColors = new ColorTable(RadarPanel.loadResourceAsFile("res/aruReflLowFilter.pal"), 0.1f, 10, "dBZ"); + ColorTable velocityColors = new ColorTable(RadarPanel.loadResourceAsFile("res/aruVlcy.pal"), 0.1f, 20, "mph"); + ColorTable spectrumWidthColors = new ColorTable(RadarPanel.loadResourceAsFile("res/aruSpwd.pal"), 0.1f, 20, "mph"); @SuppressWarnings("deprecation") NetcdfFile ncfile = NetcdfFile.open(new File("/home/a-urq/Documents/normanTornado-20230226/data/KTLX" + filename + "_V06").getAbsolutePath()); // NetcdfFile ncfile = NetcdfFile.open(new File("KFDR20230216_021442.nexrad").getAbsolutePath()); @@ -425,7 +427,7 @@ private static void drawLoc3(Graphics2D g2d, int homeX, int homeY) { g2d.drawLine(homeX + 5, homeY, homeX + 10, homeY); } - private static BufferedImage drawPolarProjImage(double[][] data, int size, double res, ColorScale colors) { + private static BufferedImage drawPolarProjImage(double[][] data, int size, double res, ColorTable colors) { if (azimuths == null || azimuths.length != size) computeAzimuths(size); @@ -1427,20 +1429,20 @@ private static BufferedImage drawBasemap(double westLongitude, double northLatit gg.setColor(Color.WHITE); gg.setStroke(bs); for (int i = 0; i < stateBorders.size(); i++) { - ArrayList state = stateBorders.get(i); + ArrayList state = stateBorders.get(i); for (int j = 0; j < state.size(); j++) { int k = j + 1; if (k >= state.size()) k = 0; - PointD p1 = state.get(j); - PointD p2 = state.get(k); + PointF p1 = state.get(j); + PointF p2 = state.get(k); // prevents the weird "wobble" from panning around - PointD _p1 = new PointD(Math.round(p1.getX() * pixelsPerDegree) / pixelsPerDegree, + PointF _p1 = new PointF(Math.round(p1.getX() * pixelsPerDegree) / pixelsPerDegree, Math.round(p1.getY() * pixelsPerDegree) / pixelsPerDegree); - PointD _p2 = new PointD(Math.round(p2.getX() * pixelsPerDegree) / pixelsPerDegree, + PointF _p2 = new PointF(Math.round(p2.getX() * pixelsPerDegree) / pixelsPerDegree, Math.round(p2.getY() * pixelsPerDegree) / pixelsPerDegree); p1 = _p1; p2 = _p2; @@ -1472,15 +1474,15 @@ private static BufferedImage drawBasemap(double westLongitude, double northLatit gg.setColor(new Color(255, 255, 255, 127)); gg.setStroke(bs); for (int i = 0; i < countyBorders.size(); i++) { - ArrayList state = countyBorders.get(i); + ArrayList state = countyBorders.get(i); for (int j = 0; j < state.size(); j++) { int k = j + 1; if (k >= state.size()) k = 0; - PointD p1 = state.get(j); - PointD p2 = state.get(k); + PointF p1 = state.get(j); + PointF p2 = state.get(k); boolean renderP1 = (p1.getX() >= westLongitude && p1.getX() <= eastLongitude && p1.getY() >= southLatitude && p1.getY() <= northLatitude); @@ -1544,13 +1546,13 @@ private static BufferedImage drawBasemap(double westLongitude, double northLatit gh.setStroke(ts); for (int i = 0; i < interstates.size(); i++) { - ArrayList state = interstates.get(i); + ArrayList state = interstates.get(i); for (int j = 0; j < state.size() - 1; j++) { int k = j + 1; - PointD p1 = state.get(j); - PointD p2 = state.get(k); + PointF p1 = state.get(j); + PointF p2 = state.get(k); boolean renderP1 = (p1.getX() >= westLongitude && p1.getX() <= eastLongitude && p1.getY() >= southLatitude && p1.getY() <= northLatitude); @@ -1592,13 +1594,13 @@ private static BufferedImage drawBasemap(double westLongitude, double northLatit gg.setColor(new Color(127, 127, 255)); gg.setStroke(bs); for (int i = 0; i < majorRoads.size(); i++) { - ArrayList state = majorRoads.get(i); + ArrayList state = majorRoads.get(i); for (int j = 0; j < state.size() - 1; j++) { int k = j + 1; - PointD p1 = state.get(j); - PointD p2 = state.get(k); + PointF p1 = state.get(j); + PointF p2 = state.get(k); boolean renderP1 = (p1.getX() >= westLongitude && p1.getX() <= eastLongitude && p1.getY() >= southLatitude && p1.getY() <= northLatitude); @@ -1709,7 +1711,7 @@ private static double linScale(double preMin, double preMax, double postMin, dou return slope * (value - preMin) + postMin; } - private static ArrayList> getPolygons(File kml) { + private static ArrayList> getPolygons(File kml) { Pattern p = Pattern.compile(".*?"); @@ -1723,13 +1725,13 @@ private static ArrayList> getPolygons(File kml) { coordList.add(m.group().substring(13, m.group().length() - 14)); } - ArrayList> polygons = new ArrayList<>(); + ArrayList> polygons = new ArrayList<>(); for (String coords : coordList) { Scanner sc = new Scanner(coords); sc.useDelimiter(" "); - ArrayList polygon = new ArrayList<>(); + ArrayList polygon = new ArrayList<>(); while (sc.hasNext()) { String s = sc.next(); @@ -1741,7 +1743,7 @@ private static ArrayList> getPolygons(File kml) { } else continue; - polygon.add(new PointD(Double.valueOf(pp[0]), Double.valueOf(pp[1]))); + polygon.add(new PointF(Double.valueOf(pp[0]), Double.valueOf(pp[1]))); } sc.close(); diff --git a/src/com/ameliaWx/radarView/RadarMapInset.java b/src/com/ameliaWx/radarView/RadarMapInset.java index e3e2294..a32e3fa 100644 --- a/src/com/ameliaWx/radarView/RadarMapInset.java +++ b/src/com/ameliaWx/radarView/RadarMapInset.java @@ -6,9 +6,9 @@ import java.awt.image.BufferedImage; import java.awt.image.RescaleOp; import java.util.ArrayList; -import java.util.Arrays; import com.ameliaWx.soundingViewer.MapInset; +import com.ameliaWx.utils.general.PointF; public class RadarMapInset implements MapInset { private BufferedImage radarImage = RadarPanel.getRadarImageForMapInset(); @@ -41,10 +41,10 @@ public BufferedImage drawMapInset(double lat, double lon, double extent, int siz gg.setColor(new Color(255, 255, 255)); gg.setStroke(bs); - for (ArrayList polygon : RadarPanel.getStateBorders()) { + for (ArrayList polygon : RadarPanel.getStateBorders()) { for (int i = 0; i < polygon.size(); i++) { - PointD p1 = polygon.get(i); - PointD p2 = polygon.get((i == polygon.size() - 1) ? 0 : (i + 1)); + PointF p1 = polygon.get(i); + PointF p2 = polygon.get((i == polygon.size() - 1) ? 0 : (i + 1)); double lat1 = p1.getY(); double lon1 = p1.getX(); @@ -74,10 +74,10 @@ public BufferedImage drawMapInset(double lat, double lon, double extent, int siz gg.setColor(new Color(255, 255, 255)); gg.setStroke(bs); - for (ArrayList polygon : RadarPanel.getCanadianProvinces()) { + for (ArrayList polygon : RadarPanel.getCanadianProvinces()) { for (int i = 0; i < polygon.size(); i++) { - PointD p1 = polygon.get(i); - PointD p2 = polygon.get((i == polygon.size() - 1) ? 0 : (i + 1)); + PointF p1 = polygon.get(i); + PointF p2 = polygon.get((i == polygon.size() - 1) ? 0 : (i + 1)); double lat1 = p1.getY(); double lon1 = p1.getX(); @@ -107,10 +107,10 @@ public BufferedImage drawMapInset(double lat, double lon, double extent, int siz gg.setColor(new Color(255, 255, 255)); gg.setStroke(bs); - for (ArrayList polygon : RadarPanel.getEstados()) { + for (ArrayList polygon : RadarPanel.getEstados()) { for (int i = 0; i < polygon.size(); i++) { - PointD p1 = polygon.get(i); - PointD p2 = polygon.get((i == polygon.size() - 1) ? 0 : (i + 1)); + PointF p1 = polygon.get(i); + PointF p2 = polygon.get((i == polygon.size() - 1) ? 0 : (i + 1)); double lat1 = p1.getY(); double lon1 = p1.getX(); @@ -140,10 +140,10 @@ public BufferedImage drawMapInset(double lat, double lon, double extent, int siz gg.setColor(new Color(255, 255, 255)); gg.setStroke(bs); - for (ArrayList polygon : RadarPanel.getCountyBorders()) { + for (ArrayList polygon : RadarPanel.getCountyBorders()) { for (int i = 0; i < polygon.size(); i++) { - PointD p1 = polygon.get(i); - PointD p2 = polygon.get((i == polygon.size() - 1) ? 0 : (i + 1)); + PointF p1 = polygon.get(i); + PointF p2 = polygon.get((i == polygon.size() - 1) ? 0 : (i + 1)); double lat1 = p1.getY(); double lon1 = p1.getX(); @@ -172,10 +172,10 @@ public BufferedImage drawMapInset(double lat, double lon, double extent, int siz gg.setColor(new Color(255, 255, 255)); gg.setStroke(bs); - for (ArrayList polygon : RadarPanel.getCanadianProvincesSubd()) { + for (ArrayList polygon : RadarPanel.getCanadianProvincesSubd()) { for (int i = 0; i < polygon.size(); i++) { - PointD p1 = polygon.get(i); - PointD p2 = polygon.get((i == polygon.size() - 1) ? 0 : (i + 1)); + PointF p1 = polygon.get(i); + PointF p2 = polygon.get((i == polygon.size() - 1) ? 0 : (i + 1)); double lat1 = p1.getY(); double lon1 = p1.getX(); @@ -204,10 +204,10 @@ public BufferedImage drawMapInset(double lat, double lon, double extent, int siz gg.setColor(new Color(0, 0, 0)); gg.setStroke(ts); - for (ArrayList polygon : RadarPanel.getInterstates()) { + for (ArrayList polygon : RadarPanel.getInterstates()) { for (int i = 0; i < polygon.size() - 1; i++) { - PointD p1 = polygon.get(i); - PointD p2 = polygon.get(i + 1); + PointF p1 = polygon.get(i); + PointF p2 = polygon.get(i + 1); double lat1 = p1.getY(); double lon1 = p1.getX(); @@ -231,12 +231,12 @@ public BufferedImage drawMapInset(double lat, double lon, double extent, int siz } } - gg.setColor(new Color(180, 0, 0)); + gg.setColor(new Color(128, 0, 0)); gg.setStroke(bs); - for (ArrayList polygon : RadarPanel.getInterstates()) { + for (ArrayList polygon : RadarPanel.getInterstates()) { for (int i = 0; i < polygon.size() - 1; i++) { - PointD p1 = polygon.get(i); - PointD p2 = polygon.get(i + 1); + PointF p1 = polygon.get(i); + PointF p2 = polygon.get(i + 1); double lat1 = p1.getY(); double lon1 = p1.getX(); @@ -265,10 +265,10 @@ public BufferedImage drawMapInset(double lat, double lon, double extent, int siz gg.setColor(new Color(0, 0, 0)); gg.setStroke(ts); - for (ArrayList polygon : RadarPanel.getMajorRoads()) { + for (ArrayList polygon : RadarPanel.getMajorRoads()) { for (int i = 0; i < polygon.size() - 1; i++) { - PointD p1 = polygon.get(i); - PointD p2 = polygon.get(i + 1); + PointF p1 = polygon.get(i); + PointF p2 = polygon.get(i + 1); double lat1 = p1.getY(); double lon1 = p1.getX(); @@ -294,10 +294,10 @@ public BufferedImage drawMapInset(double lat, double lon, double extent, int siz gg.setColor(new Color(127, 127, 255)); gg.setStroke(bs); - for (ArrayList polygon : RadarPanel.getMajorRoads()) { + for (ArrayList polygon : RadarPanel.getMajorRoads()) { for (int i = 0; i < polygon.size() - 1; i++) { - PointD p1 = polygon.get(i); - PointD p2 = polygon.get(i + 1); + PointF p1 = polygon.get(i); + PointF p2 = polygon.get(i + 1); double lat1 = p1.getY(); double lon1 = p1.getX(); @@ -327,7 +327,7 @@ public BufferedImage drawMapInset(double lat, double lon, double extent, int siz gg.setStroke(blk); for (int p = 0; p < RadarView.warningPolygons.size(); p++) { - ArrayList polygon = RadarView.warningPolygons.get(p); + ArrayList polygon = RadarView.warningPolygons.get(p); gg.setColor(Color.BLACK); @@ -336,8 +336,8 @@ public BufferedImage drawMapInset(double lat, double lon, double extent, int siz if (j == polygon.size()) j = 0; - PointD p1 = polygon.get(i); - PointD p2 = polygon.get(j); + PointF p1 = polygon.get(i); + PointF p2 = polygon.get(j); double lat1 = p1.getY(); double lon1 = p1.getX(); @@ -364,7 +364,7 @@ public BufferedImage drawMapInset(double lat, double lon, double extent, int siz gg.setStroke(clr); for (int p = 0; p < RadarView.warningPolygons.size(); p++) { - ArrayList polygon = RadarView.warningPolygons.get(p); + ArrayList polygon = RadarView.warningPolygons.get(p); String name = RadarView.warningNames.get(p).substring(5, 7); String nameW = RadarView.warningNames.get(p).trim(); @@ -387,8 +387,8 @@ public BufferedImage drawMapInset(double lat, double lon, double extent, int siz if (j == polygon.size()) j = 0; - PointD p1 = polygon.get(i); - PointD p2 = polygon.get(j); + PointF p1 = polygon.get(i); + PointF p2 = polygon.get(j); double lat1 = p1.getY(); double lon1 = p1.getX(); @@ -421,7 +421,7 @@ public BufferedImage drawMapInset(double lat, double lon, double extent, int siz gg.setStroke(blk2); for (int p = 0; p < RadarView.watchParallelograms.size(); p++) { - ArrayList polygon = RadarView.watchParallelograms.get(p); + ArrayList polygon = RadarView.watchParallelograms.get(p); String name = RadarView.spcWatchNames.get(p).trim(); gg.setColor(new Color(0, 0, 0, 0)); @@ -435,8 +435,8 @@ public BufferedImage drawMapInset(double lat, double lon, double extent, int siz if (j == polygon.size()) j = 0; - PointD p1 = polygon.get(i); - PointD p2 = polygon.get(j); + PointF p1 = polygon.get(i); + PointF p2 = polygon.get(j); double lat1 = p1.getY(); double lon1 = p1.getX(); @@ -458,7 +458,7 @@ public BufferedImage drawMapInset(double lat, double lon, double extent, int siz gg.setStroke(clr2); for (int p = 0; p < RadarView.watchParallelograms.size(); p++) { - ArrayList polygon = RadarView.watchParallelograms.get(p); + ArrayList polygon = RadarView.watchParallelograms.get(p); String name = RadarView.spcWatchNames.get(p).trim(); gg.setColor(new Color(0, 0, 0, 0)); @@ -472,8 +472,8 @@ public BufferedImage drawMapInset(double lat, double lon, double extent, int siz if (j == polygon.size()) j = 0; - PointD p1 = polygon.get(i); - PointD p2 = polygon.get(j); + PointF p1 = polygon.get(i); + PointF p2 = polygon.get(j); double lat1 = p1.getY(); double lon1 = p1.getX(); diff --git a/src/com/ameliaWx/radarView/RadarPanel.java b/src/com/ameliaWx/radarView/RadarPanel.java index e743863..2a3e912 100644 --- a/src/com/ameliaWx/radarView/RadarPanel.java +++ b/src/com/ameliaWx/radarView/RadarPanel.java @@ -3,6 +3,7 @@ import java.awt.BasicStroke; import java.awt.Color; import java.awt.Font; +import java.awt.FontFormatException; import java.awt.Graphics2D; import java.awt.image.BufferedImage; import java.awt.image.RescaleOp; @@ -25,6 +26,7 @@ import org.apache.commons.io.FileUtils; import org.joda.time.DateTime; +import com.ameliaWx.utils.general.PointF; import com.univocity.parsers.csv.CsvParser; import com.univocity.parsers.csv.CsvParserSettings; import com.univocity.parsers.csv.CsvWriter; @@ -37,13 +39,13 @@ public class RadarPanel extends JComponent { private static final long serialVersionUID = -5968064830481838268L; - private static ArrayList> countyBorders; - private static ArrayList> stateBorders; - private static ArrayList> interstates; - private static ArrayList> majorRoads; - private static ArrayList> estados; - private static ArrayList> canadianProvinces; - private static ArrayList> canadianProvincesSubd; + private static ArrayList> countyBorders; + private static ArrayList> stateBorders; + private static ArrayList> interstates; + private static ArrayList> majorRoads; + private static ArrayList> estados; + private static ArrayList> canadianProvinces; + private static ArrayList> canadianProvincesSubd; // private static ArrayList> metroAreas; // private static ArrayList> ouCampus; // private static ArrayList> lakeLavon; @@ -359,19 +361,19 @@ public static void drawWorldMap() throws IOException { BasicStroke cyn = new BasicStroke(5, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND); g.setStroke(cyn); for (int i = 0; i < interstates.size(); i++) { - ArrayList state = interstates.get(i); + ArrayList state = interstates.get(i); for (int j = 0; j < state.size() - 1; j++) { int k = j + 1; if (k >= state.size()) k = 0; - PointD p1 = state.get(j); - PointD p2 = state.get(k); + PointF p1 = state.get(j); + PointF p2 = state.get(k); // prevents the weird "wobble" from panning around - PointD _p1 = new PointD(Math.round(p1.getX() * ppd) / ppd, Math.round(p1.getY() * ppd) / ppd); - PointD _p2 = new PointD(Math.round(p2.getX() * ppd) / ppd, Math.round(p2.getY() * ppd) / ppd); + PointF _p1 = new PointF(Math.round(p1.getX() * ppd) / ppd, Math.round(p1.getY() * ppd) / ppd); + PointF _p2 = new PointF(Math.round(p2.getX() * ppd) / ppd, Math.round(p2.getY() * ppd) / ppd); p1 = _p1; p2 = _p2; @@ -414,8 +416,8 @@ public void run() { double width = (eastLongitude - westLongitude) * pixelsPerDegree; double height = (northLatitude - southLatitude) * pixelsPerDegree; - System.out.println(width); - System.out.println(height); +// System.out.println(width); +// System.out.println(height); BufferedImage newBasemap = new BufferedImage((int) width, (int) height, BufferedImage.TYPE_4BYTE_ABGR); Graphics2D g = newBasemap.createGraphics(); @@ -428,20 +430,20 @@ public void run() { gg.setColor(Color.WHITE); gg.setStroke(bs); for (int i = 0; i < stateBorders.size(); i++) { - ArrayList state = stateBorders.get(i); + ArrayList state = stateBorders.get(i); for (int j = 0; j < state.size(); j++) { int k = j + 1; if (k >= state.size()) k = 0; - PointD p1 = state.get(j); - PointD p2 = state.get(k); + PointF p1 = state.get(j); + PointF p2 = state.get(k); // prevents the weird "wobble" from panning around - PointD _p1 = new PointD(Math.round(p1.getX() * pixelsPerDegree) / pixelsPerDegree, + PointF _p1 = new PointF(Math.round(p1.getX() * pixelsPerDegree) / pixelsPerDegree, Math.round(p1.getY() * pixelsPerDegree) / pixelsPerDegree); - PointD _p2 = new PointD(Math.round(p2.getX() * pixelsPerDegree) / pixelsPerDegree, + PointF _p2 = new PointF(Math.round(p2.getX() * pixelsPerDegree) / pixelsPerDegree, Math.round(p2.getY() * pixelsPerDegree) / pixelsPerDegree); p1 = _p1; p2 = _p2; @@ -466,15 +468,15 @@ public void run() { } } for (int i = 0; i < canadianProvinces.size(); i++) { - ArrayList state = canadianProvinces.get(i); + ArrayList state = canadianProvinces.get(i); for (int j = 0; j < state.size(); j++) { int k = j + 1; if (k >= state.size()) k = 0; - PointD p1 = state.get(j); - PointD p2 = state.get(k); + PointF p1 = state.get(j); + PointF p2 = state.get(k); boolean renderP1 = (p1.getX() >= westLongitude && p1.getX() <= eastLongitude && p1.getY() >= southLatitude && p1.getY() <= northLatitude); @@ -496,15 +498,15 @@ public void run() { } } for (int i = 0; i < estados.size(); i++) { - ArrayList state = estados.get(i); + ArrayList state = estados.get(i); for (int j = 0; j < state.size(); j++) { int k = j + 1; if (k >= state.size()) k = 0; - PointD p1 = state.get(j); - PointD p2 = state.get(k); + PointF p1 = state.get(j); + PointF p2 = state.get(k); boolean renderP1 = (p1.getX() >= westLongitude && p1.getX() <= eastLongitude && p1.getY() >= southLatitude && p1.getY() <= northLatitude); @@ -533,15 +535,15 @@ public void run() { gg.setColor(new Color(255, 255, 255, 255)); gg.setStroke(bs); for (int i = 0; i < countyBorders.size(); i++) { - ArrayList state = countyBorders.get(i); + ArrayList state = countyBorders.get(i); for (int j = 0; j < state.size(); j++) { int k = j + 1; if (k >= state.size()) k = 0; - PointD p1 = state.get(j); - PointD p2 = state.get(k); + PointF p1 = state.get(j); + PointF p2 = state.get(k); boolean renderP1 = (p1.getX() >= westLongitude && p1.getX() <= eastLongitude && p1.getY() >= southLatitude && p1.getY() <= northLatitude); @@ -563,15 +565,15 @@ public void run() { } } for (int i = 0; i < canadianProvincesSubd.size(); i++) { - ArrayList state = canadianProvincesSubd.get(i); + ArrayList state = canadianProvincesSubd.get(i); for (int j = 0; j < state.size(); j++) { int k = j + 1; if (k >= state.size()) k = 0; - PointD p1 = state.get(j); - PointD p2 = state.get(k); + PointF p1 = state.get(j); + PointF p2 = state.get(k); boolean renderP1 = (p1.getX() >= westLongitude && p1.getX() <= eastLongitude && p1.getY() >= southLatitude && p1.getY() <= northLatitude); @@ -629,19 +631,19 @@ public void run() { gg = highways.createGraphics(); Graphics2D gh = highwaysBg.createGraphics(); - gg.setColor(new Color(180, 0, 0)); + gg.setColor(new Color(128, 0, 0)); gg.setStroke(bs); gh.setColor(new Color(0, 0, 0)); gh.setStroke(ts); for (int i = 0; i < interstates.size(); i++) { - ArrayList state = interstates.get(i); + ArrayList state = interstates.get(i); for (int j = 0; j < state.size() - 1; j++) { int k = j + 1; - PointD p1 = state.get(j); - PointD p2 = state.get(k); + PointF p1 = state.get(j); + PointF p2 = state.get(k); boolean renderP1 = (p1.getX() >= westLongitude && p1.getX() <= eastLongitude && p1.getY() >= southLatitude && p1.getY() <= northLatitude); @@ -683,13 +685,13 @@ public void run() { gg.setColor(new Color(127, 127, 255)); gg.setStroke(bs); for (int i = 0; i < majorRoads.size(); i++) { - ArrayList state = majorRoads.get(i); + ArrayList state = majorRoads.get(i); for (int j = 0; j < state.size() - 1; j++) { int k = j + 1; - PointD p1 = state.get(j); - PointD p2 = state.get(k); + PointF p1 = state.get(j); + PointF p2 = state.get(k); boolean renderP1 = (p1.getX() >= westLongitude && p1.getX() <= eastLongitude && p1.getY() >= southLatitude && p1.getY() <= northLatitude); @@ -850,7 +852,7 @@ public void run() { } private void drawWarnings(double ulLon, double ulLat, double lrLon, double lrLat, double ppd, - ArrayList> warningPolygons, ArrayList warningNames) { + ArrayList> warningPolygons, ArrayList warningNames) { if(RadarView.warningPolygons == null) { return; } @@ -868,7 +870,7 @@ private void drawWarnings(double ulLon, double ulLat, double lrLon, double lrLat g.setStroke(blk); for (int p = 0; p < warningPolygons.size(); p++) { - ArrayList polygon = warningPolygons.get(p); + ArrayList polygon = warningPolygons.get(p); g.setColor(Color.BLACK); @@ -877,8 +879,8 @@ private void drawWarnings(double ulLon, double ulLat, double lrLon, double lrLat if (j == polygon.size()) j = 0; - PointD p1 = polygon.get(i); - PointD p2 = polygon.get(j); + PointF p1 = polygon.get(i); + PointF p2 = polygon.get(j); boolean renderP1 = (p1.getX() >= ulLon && p1.getX() <= lrLon && p1.getY() >= lrLat && p1.getY() <= ulLat); @@ -899,7 +901,7 @@ private void drawWarnings(double ulLon, double ulLat, double lrLon, double lrLat g.setStroke(clr); for (int p = 0; p < warningPolygons.size(); p++) { - ArrayList polygon = warningPolygons.get(p); + ArrayList polygon = warningPolygons.get(p); String name = warningNames.get(p).substring(5, 7); String nameW = warningNames.get(p).trim(); @@ -922,8 +924,8 @@ private void drawWarnings(double ulLon, double ulLat, double lrLon, double lrLat if (j == polygon.size()) j = 0; - PointD p1 = polygon.get(i); - PointD p2 = polygon.get(j); + PointF p1 = polygon.get(i); + PointF p2 = polygon.get(j); boolean renderP1 = (p1.getX() >= ulLon && p1.getX() <= lrLon && p1.getY() >= lrLat && p1.getY() <= ulLat); @@ -946,15 +948,21 @@ private void drawWarnings(double ulLon, double ulLat, double lrLon, double lrLat } private void drawSpcWatches(double ulLon, double ulLat, double lrLon, double lrLat, double ppd, - ArrayList> watchPolygons, ArrayList watchNames) { - System.out.println(watchPolygons.size()); - System.out.println(watchNames.size()); + ArrayList> watchPolygons, ArrayList watchNames) { int imgWidth = (int) ((lrLon - ulLon) * ppd); int imgHeight = (int) ((ulLat - lrLat) * ppd); BufferedImage watchesImg = new BufferedImage(imgWidth, imgHeight, BufferedImage.TYPE_4BYTE_ABGR); Graphics2D g = watchesImg.createGraphics(); + + if(watchPolygons == null) { + spcWatches = watchesImg; + return; + } + +// System.out.println(watchPolygons.size()); +// System.out.println(watchNames.size()); if (RadarView.viewStormScaleWarnings) { BasicStroke clr = new BasicStroke(4, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER); @@ -963,7 +971,7 @@ private void drawSpcWatches(double ulLon, double ulLat, double lrLon, double lrL g.setStroke(blk); for (int p = 0; p < watchPolygons.size(); p++) { - ArrayList polygon = watchPolygons.get(p); + ArrayList polygon = watchPolygons.get(p); String name = watchNames.get(p).trim(); g.setColor(new Color(0, 0, 0, 0)); @@ -977,8 +985,8 @@ private void drawSpcWatches(double ulLon, double ulLat, double lrLon, double lrL if (j == polygon.size()) j = 0; - PointD p1 = polygon.get(i); - PointD p2 = polygon.get(j); + PointF p1 = polygon.get(i); + PointF p2 = polygon.get(j); boolean renderP1 = (p1.getX() >= ulLon && p1.getX() <= lrLon && p1.getY() >= lrLat && p1.getY() <= ulLat); @@ -999,7 +1007,7 @@ private void drawSpcWatches(double ulLon, double ulLat, double lrLon, double lrL g.setStroke(clr); for (int p = 0; p < watchPolygons.size(); p++) { - ArrayList polygon = watchPolygons.get(p); + ArrayList polygon = watchPolygons.get(p); String name = watchNames.get(p).trim(); g.setColor(new Color(0, 0, 0, 0)); @@ -1013,8 +1021,8 @@ private void drawSpcWatches(double ulLon, double ulLat, double lrLon, double lrL if (j == polygon.size()) j = 0; - PointD p1 = polygon.get(i); - PointD p2 = polygon.get(j); + PointF p1 = polygon.get(i); + PointF p2 = polygon.get(j); boolean renderP1 = (p1.getX() >= ulLon && p1.getX() <= lrLon && p1.getY() >= lrLat && p1.getY() <= ulLat); @@ -1039,7 +1047,7 @@ private void drawSpcWatches(double ulLon, double ulLat, double lrLon, double lrL } private void drawWatches(double ulLon, double ulLat, double lrLon, double lrLat, double ppd, - ArrayList> watchPolygons, ArrayList watchNames) { + ArrayList> watchPolygons, ArrayList watchNames) { int imgWidth = (int) ((lrLon - ulLon) * ppd); int imgHeight = (int) ((ulLat - lrLat) * ppd); @@ -1053,12 +1061,11 @@ private void drawWatches(double ulLon, double ulLat, double lrLon, double lrLat, g.setStroke(blk); for (int p = 0; p < watchPolygons.size(); p++) { - ArrayList polygon = watchPolygons.get(p); + ArrayList polygon = watchPolygons.get(p); String name = watchNames.get(p).trim(); // System.out.println(name); - g.setColor(new Color(0, 0, 0, 0)); if ("Tornado Watch".equals(name)) g.setColor(new Color(0, 0, 0, 196)); if ("Severe Thunderstorm Watch".equals(name)) @@ -1099,8 +1106,8 @@ private void drawWatches(double ulLon, double ulLat, double lrLon, double lrLat, if (j == polygon.size()) j = 0; - PointD p1 = polygon.get(i); - PointD p2 = polygon.get(j); + PointF p1 = polygon.get(i); + PointF p2 = polygon.get(j); boolean renderP1 = (p1.getX() >= ulLon && p1.getX() <= lrLon && p1.getY() >= lrLat && p1.getY() <= ulLat); @@ -1121,7 +1128,7 @@ private void drawWatches(double ulLon, double ulLat, double lrLon, double lrLat, g.setStroke(clr); for (int p = 0; p < watchPolygons.size(); p++) { - ArrayList polygon = watchPolygons.get(p); + ArrayList polygon = watchPolygons.get(p); String name = watchNames.get(p).trim(); g.setColor(new Color(0, 0, 0, 0)); @@ -1165,8 +1172,8 @@ private void drawWatches(double ulLon, double ulLat, double lrLon, double lrLat, if (j == polygon.size()) j = 0; - PointD p1 = polygon.get(i); - PointD p2 = polygon.get(j); + PointF p1 = polygon.get(i); + PointF p2 = polygon.get(j); boolean renderP1 = (p1.getX() >= ulLon && p1.getX() <= lrLon && p1.getY() >= lrLat && p1.getY() <= ulLat); @@ -1191,7 +1198,7 @@ private void drawWatches(double ulLon, double ulLat, double lrLon, double lrLat, } private void drawSpcOutlook(double ulLon, double ulLat, double lrLon, double lrLat, double ppd, - ArrayList> outlookPolygons, ArrayList outlookNames) { + ArrayList> outlookPolygons, ArrayList outlookNames) { int imgWidth = (int) ((lrLon - ulLon) * ppd); int imgHeight = (int) ((ulLat - lrLat) * ppd); @@ -1206,15 +1213,15 @@ private void drawSpcOutlook(double ulLon, double ulLat, double lrLon, double lrL g.setColor(new Color(0, 0, 0)); for (int p = 0; p < outlookPolygons.size(); p++) { - ArrayList polygon = outlookPolygons.get(p); + ArrayList polygon = outlookPolygons.get(p); for (int i = 0; i < polygon.size(); i++) { int j = i + 1; if (j == polygon.size()) j = 0; - PointD p1 = polygon.get(i); - PointD p2 = polygon.get(j); + PointF p1 = polygon.get(i); + PointF p2 = polygon.get(j); // boolean renderP1 = (p1.getX() >= ulLon && p1.getX() <= lrLon && p1.getY() >= lrLat // && p1.getY() <= ulLat); @@ -1235,7 +1242,7 @@ private void drawSpcOutlook(double ulLon, double ulLat, double lrLon, double lrL g.setStroke(clr); for (int p = 0; p < outlookPolygons.size(); p++) { - ArrayList polygon = outlookPolygons.get(p); + ArrayList polygon = outlookPolygons.get(p); String name = outlookNames.get(p); if ("TSTM".equals(name)) @@ -1256,8 +1263,8 @@ private void drawSpcOutlook(double ulLon, double ulLat, double lrLon, double lrL if (j == polygon.size()) j = 0; - PointD p1 = polygon.get(i); - PointD p2 = polygon.get(j); + PointF p1 = polygon.get(i); + PointF p2 = polygon.get(j); // boolean renderP1 = (p1.getX() >= ulLon && p1.getX() <= lrLon && p1.getY() >= lrLat // && p1.getY() <= ulLat); @@ -1280,7 +1287,7 @@ private void drawSpcOutlook(double ulLon, double ulLat, double lrLon, double lrL } private void drawSpcStormReports(double ulLon, double ulLat, double lrLon, double lrLat, double ppd, - ArrayList reportPoints, ArrayList reportNames) { + ArrayList reportPoints, ArrayList reportNames) { int imgWidth = (int) ((lrLon - ulLon) * ppd); int imgHeight = (int) ((ulLat - lrLat) * ppd); @@ -1289,7 +1296,7 @@ private void drawSpcStormReports(double ulLon, double ulLat, double lrLon, doubl if (RadarView.viewSpcStormReports) { for (int i = 0; i < reportPoints.size(); i++) { - PointD p1 = reportPoints.get(i); + PointF p1 = reportPoints.get(i); boolean renderP1 = (p1.getX() >= lrLat && p1.getX() <= ulLat && p1.getY() >= ulLon && p1.getY() <= lrLon); @@ -1451,9 +1458,9 @@ private void drawSiteButtons(double ulLon, double ulLat, double lrLon, double lr for (int i = 0; i < RadarView.radarSites.size(); i++) { RadarSite rs = RadarView.radarSites.get(i); - PointD rsP = rs.getSiteCoords(); + PointF rsP = rs.getSiteCoords(); - PointD _rsP = new PointD(Math.round(rsP.getX() * ppd) / ppd, Math.round(rsP.getY() * ppd) / ppd); + PointF _rsP = new PointF(Math.round(rsP.getX() * ppd) / ppd, Math.round(rsP.getY() * ppd) / ppd); rsP = _rsP; double lat = rsP.getX(); @@ -1474,6 +1481,17 @@ private void drawSiteButtons(double ulLon, double ulLat, double lrLon, double lr private static final String AUTHOR_MESSAGE = "MADE BY AMELIA URQUHART | PRESS 'H' FOR HELP"; public static final Font CAPTION_FONT = new Font(Font.MONOSPACED, Font.BOLD, 12); +// public static Font CAPTION_FONT; + +// static { +// try { +// CAPTION_FONT = Font.createFont(Font.TRUETYPE_FONT, loadResourceAsFile("res/UbuntuMono-B.ttf")).deriveFont(12.0f); +// } catch (FontFormatException e) { +// e.printStackTrace(); +// } catch (IOException e) { +// e.printStackTrace(); +// } +// } private void drawCaptionImg(int timestep) { if (captionImg == null) { @@ -1543,8 +1561,11 @@ public void blankOutImages() { imagesHi[i][0] = BLANK_IMAGE; imagesMd[i][0] = BLANK_IMAGE; imagesLo[i][0] = BLANK_IMAGE; - RadarView.radarData[i].markDataAsRendered(); - RadarView.g.repaint(); + + if(RadarView.radarData[i] != null) { + RadarView.radarData[i].markDataAsRendered(); + RadarView.g.repaint(); + } } } @@ -1637,6 +1658,11 @@ public void shiftByOne() { public void copyToArraysOfNewLength(int newLength) { System.out.println("copy to arrays of new length method"); + + if(imagesLo == null) { + System.out.println("copyToArraysOfNewLength()::imagesLo is null"); + return; + } assert imagesLo.length == RadarView.radarData.length; assert imagesLo.length == RadarView.radarDataFileNames.length; @@ -1698,7 +1724,7 @@ public void copyToArraysOfNewLength(int newLength) { private static int[][] azimuths; private static BufferedImage drawPolarProjImage(float[][] data, byte[][] mask, int size, double res, double coneOfSilence, - ColorScale colors) { + ColorTable colors) { if (azimuths == null || azimuths.length != size) computeAzimuths(size); @@ -1790,9 +1816,9 @@ private static double linScale(double preMin, double preMax, double postMin, dou return slope * (value - preMin) + postMin; } - private static ArrayList> getPolygons(File kml) { + private static ArrayList> getPolygons(File kml) { if(kml == null) { - return new ArrayList>(); + return new ArrayList>(); } Pattern p = Pattern.compile(".*?"); @@ -1807,13 +1833,13 @@ private static ArrayList> getPolygons(File kml) { coordList.add(m.group().substring(13, m.group().length() - 14)); } - ArrayList> polygons = new ArrayList<>(); + ArrayList> polygons = new ArrayList<>(); for (String coords : coordList) { Scanner sc = new Scanner(coords); sc.useDelimiter(" "); - ArrayList polygon = new ArrayList<>(); + ArrayList polygon = new ArrayList<>(); while (sc.hasNext()) { String s = sc.next(); @@ -1825,7 +1851,7 @@ private static ArrayList> getPolygons(File kml) { } else continue; - polygon.add(new PointD(Double.valueOf(pp[0]), Double.valueOf(pp[1]))); + polygon.add(new PointF(Float.valueOf(pp[0]), Float.valueOf(pp[1]))); } sc.close(); @@ -1835,7 +1861,7 @@ private static ArrayList> getPolygons(File kml) { return polygons; } - private static ArrayList> getPolygons(File poly, File meta) { + private static ArrayList> getPolygons(File poly, File meta) { CsvParserSettings settings = new CsvParserSettings(); settings.getFormat().setLineSeparator("\n"); @@ -1846,9 +1872,9 @@ private static ArrayList> getPolygons(File poly, File meta) { List polyRows = parser.parseAll(poly); List metaRows = parser.parseAll(meta); - ArrayList> polygons = new ArrayList<>(); + ArrayList> polygons = new ArrayList<>(); - ArrayList polygon = new ArrayList<>(); + ArrayList polygon = new ArrayList<>(); int polygonId = 0; int polygonSize = Integer.valueOf(metaRows.get(polygonId)[0]); @@ -1862,7 +1888,7 @@ private static ArrayList> getPolygons(File poly, File meta) { } String[] row = polyRows.get(i); - PointD point = new PointD(Double.valueOf(row[0]), Double.valueOf(row[1])); + PointF point = new PointF(Float.valueOf(row[0]), Float.valueOf(row[1])); polygon.add(point); // System.out.printf("%6d\t%6d\t%6d\t%6d\t" + poly.getName() + "\n", i, polyRows.size(), polygon.size(), polygonSize); @@ -1871,9 +1897,9 @@ private static ArrayList> getPolygons(File poly, File meta) { return polygons; } - private static ArrayList> getPolygons(File kml, int reduction) { + private static ArrayList> getPolygons(File kml, int reduction) { if(kml == null) { - return new ArrayList>(); + return new ArrayList>(); } Pattern p = Pattern.compile(".*?"); @@ -1888,13 +1914,13 @@ private static ArrayList> getPolygons(File kml, int reduction) coordList.add(m.group().substring(13, m.group().length() - 14)); } - ArrayList> polygons = new ArrayList<>(); + ArrayList> polygons = new ArrayList<>(); for (String coords : coordList) { Scanner sc = new Scanner(coords); sc.useDelimiter(" "); - ArrayList polygon = new ArrayList<>(); + ArrayList polygon = new ArrayList<>(); int vertices = 0; while (sc.hasNext()) { @@ -1908,7 +1934,7 @@ private static ArrayList> getPolygons(File kml, int reduction) continue; if (vertices % reduction == 0) - polygon.add(new PointD(Double.valueOf(pp[0]), Double.valueOf(pp[1]))); + polygon.add(new PointF(Float.valueOf(pp[0]), Float.valueOf(pp[1]))); vertices++; } @@ -1919,31 +1945,31 @@ private static ArrayList> getPolygons(File kml, int reduction) return polygons; } - public static ArrayList> getCountyBorders() { + public static ArrayList> getCountyBorders() { return countyBorders; } - public static ArrayList> getStateBorders() { + public static ArrayList> getStateBorders() { return stateBorders; } - public static ArrayList> getInterstates() { + public static ArrayList> getInterstates() { return interstates; } - public static ArrayList> getMajorRoads() { + public static ArrayList> getMajorRoads() { return majorRoads; } - public static ArrayList> getEstados() { + public static ArrayList> getEstados() { return estados; } - public static ArrayList> getCanadianProvinces() { + public static ArrayList> getCanadianProvinces() { return canadianProvinces; } - public static ArrayList> getCanadianProvincesSubd() { + public static ArrayList> getCanadianProvincesSubd() { return canadianProvincesSubd; } @@ -1970,12 +1996,12 @@ private static String usingBufferedReader(File filePath) { } @SuppressWarnings("unused") - private static void polygonArrayToCsv(ArrayList> polygons, String fileName) { + private static void polygonArrayToCsv(ArrayList> polygons, String fileName) { List polygonsCsv = new ArrayList<>(); List polygonsCsvMeta = new ArrayList<>(); for(int i = 0; i < polygons.size(); i++) { - ArrayList polygon = polygons.get(i); + ArrayList polygon = polygons.get(i); int polygonSize = polygon.size(); diff --git a/src/com/ameliaWx/radarView/RadarSite.java b/src/com/ameliaWx/radarView/RadarSite.java index 1adf32e..a283993 100644 --- a/src/com/ameliaWx/radarView/RadarSite.java +++ b/src/com/ameliaWx/radarView/RadarSite.java @@ -14,15 +14,17 @@ import org.joda.time.DateTime; import org.joda.time.DateTimeZone; +import com.ameliaWx.utils.general.PointF; + public class RadarSite { private String siteCode; private String siteCity; - private PointD siteCoords; + private PointF siteCoords; private boolean online; private boolean warned; - public RadarSite(String siteCode, String siteCity, PointD siteCoords) { + public RadarSite(String siteCode, String siteCity, PointF siteCoords) { this.siteCode = siteCode; this.siteCity = siteCity; this.siteCoords = siteCoords; @@ -32,7 +34,7 @@ public RadarSite(String siteCode, String siteCity, PointD siteCoords) { } public RadarSite(String siteCode, String siteCity, double latitude, double longitude) { - this(siteCode, siteCity, new PointD(latitude, longitude)); + this(siteCode, siteCity, new PointF(latitude, longitude)); } public String getSiteCode() { @@ -43,7 +45,7 @@ public String getSiteCity() { return siteCity; } - public PointD getSiteCoords() { + public PointF getSiteCoords() { return siteCoords; } diff --git a/src/com/ameliaWx/radarView/RadarView.java b/src/com/ameliaWx/radarView/RadarView.java index b865427..cff37f2 100644 --- a/src/com/ameliaWx/radarView/RadarView.java +++ b/src/com/ameliaWx/radarView/RadarView.java @@ -53,7 +53,7 @@ import org.joda.time.DateTime; import org.joda.time.DateTimeZone; -import com.ameliaWx.radarView.nwpModel.LambertConformalProjection; +import com.ameliaWx.radarView.mapProjections.LambertConformalProjection; import com.ameliaWx.radarView.nwpModel.NwpField; import com.ameliaWx.radarView.nwpModel.PtypeAlgorithm; import com.ameliaWx.radarView.nwpModel.RapInterpModel; @@ -63,6 +63,9 @@ import com.ameliaWx.soundingViewer.SoundingFrame; import com.ameliaWx.soundingViewer.unixTool.RadiosondeSite; import com.ameliaWx.soundingViewer.unixTool.RadiosondeWrapper; +import com.ameliaWx.utils.general.PointF; +import com.ameliaWx.utils.graphics.Button; +import com.ameliaWx.utils.graphics.ButtonFunction; import com.ameliaWx.weatherUtils.WeatherUtils; import com.univocity.parsers.csv.CsvParser; import com.univocity.parsers.csv.CsvParserSettings; @@ -125,25 +128,25 @@ public class RadarView extends JFrame { public static String[] tiltChoices; public static Tilt chosenTilt = Tilt._1; - public static ColorScale[] colors; + public static ColorTable[] colors; public static RadarData[] radarData; public static String[] radarDataFileNames; - public static ColorScale reflectivityColors; - public static ColorScale reflectivityColorsLowFilter; - public static ColorScale refl03PTypesColors; - public static ColorScale refl04PTypesColors; - public static ColorScale refl12PTypesColors; - public static ColorScale velocityColors; - public static ColorScale specWdthColors; - public static ColorScale diffReflColors; - public static ColorScale corrCoefColors; - public static ColorScale diffPhseColors; - public static ColorScale kdpColors; - - public static ColorScale testColors1; - public static ColorScale testColors2; + public static ColorTable reflectivityColors; + public static ColorTable reflectivityColorsLowFilter; + public static ColorTable refl03PTypesColors; + public static ColorTable refl04PTypesColors; + public static ColorTable refl12PTypesColors; + public static ColorTable velocityColors; + public static ColorTable specWdthColors; + public static ColorTable diffReflColors; + public static ColorTable corrCoefColors; + public static ColorTable diffPhseColors; + public static ColorTable kdpColors; + + public static ColorTable testColors1; + public static ColorTable testColors2; public static double centralLat = 33; public static double centralLon = -96.5; @@ -157,6 +160,8 @@ public class RadarView extends JFrame { public static int animLength = 1; public static int animLengthWhenPlaying = 6; public static String mostRecentFilename = ""; + + public static ArrayList