001 /* 002 * This file is part of McIDAS-V 003 * 004 * Copyright 2007-2013 005 * Space Science and Engineering Center (SSEC) 006 * University of Wisconsin - Madison 007 * 1225 W. Dayton Street, Madison, WI 53706, USA 008 * https://www.ssec.wisc.edu/mcidas 009 * 010 * All Rights Reserved 011 * 012 * McIDAS-V is built on Unidata's IDV and SSEC's VisAD libraries, and 013 * some McIDAS-V source code is based on IDV and VisAD source code. 014 * 015 * McIDAS-V is free software; you can redistribute it and/or modify 016 * it under the terms of the GNU Lesser Public License as published by 017 * the Free Software Foundation; either version 3 of the License, or 018 * (at your option) any later version. 019 * 020 * McIDAS-V is distributed in the hope that it will be useful, 021 * but WITHOUT ANY WARRANTY; without even the implied warranty of 022 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 023 * GNU Lesser Public License for more details. 024 * 025 * You should have received a copy of the GNU Lesser Public License 026 * along with this program. If not, see http://www.gnu.org/licenses. 027 */ 028 029 package edu.wisc.ssec.mcidasv.control; 030 031 import java.util.ArrayList; 032 import java.util.List; 033 034 import ucar.unidata.data.grid.GridUtil; 035 import ucar.unidata.idv.control.ReadoutInfo; 036 import visad.Real; 037 import visad.georef.EarthLocation; 038 039 public class HydrometeorClassificationControl extends edu.wisc.ssec.mcidasv.control.ImagePlanViewControl { 040 041 @Override protected List getCursorReadoutInner(EarthLocation el, 042 Real animationValue, 043 int animationStep, 044 List<ReadoutInfo> samples) 045 throws Exception { 046 047 if (currentSlice == null) { 048 return null; 049 } 050 List result = new ArrayList(); 051 Real r = GridUtil.sampleToReal( 052 currentSlice, el, animationValue, getSamplingModeValue(NEAREST_NEIGHBOR)); 053 if (r != null) { 054 ReadoutInfo readoutInfo = new ReadoutInfo(this, r, el, 055 animationValue); 056 readoutInfo.setUnit(getDisplayUnit()); 057 readoutInfo.setRange(getRange()); 058 samples.add(readoutInfo); 059 } 060 061 if ((r != null) && !r.isMissing()) { 062 063 // list of codes found here: 064 // (51.2.2) http://www.roc.noaa.gov/wsr88d/PublicDocs/ICDs/2620003R.pdf 065 String str; 066 switch ((int) r.getValue()) { 067 case 0: str = "SNR<Threshold"; // black 068 break; 069 case 10: str = "Biological"; // medium gray 070 break; 071 case 20: str = "AP/Ground Clutter"; // dark gray 072 break; 073 case 30: str = "Ice Crystals"; // light pink 074 break; 075 case 40: str = "Dry Snow"; // light blue 076 break; 077 case 50: str = "Wet Snow"; // medium blue 078 break; 079 case 60: str = "Light-Moderate Rain"; // light green 080 break; 081 case 70: str = "Heavy Rain"; // medium green 082 break; 083 case 80: str = "Big Drops Rain"; // dark yellow 084 break; 085 case 90: str = "Graupel"; // medium pink 086 break; 087 case 100: str = "Hail, Possibly With Rain"; // red 088 break; 089 // classification algorithm reports "unknown type" here. 090 // How to distinguish this from "McV doesnt understand the code"? 091 case 140: str = "Unknown Type"; // purple 092 break; 093 case 150: str = "RF"; // dark purple 094 break; 095 default: str = "code undefined"; 096 break; 097 } 098 099 result.add("<tr><td>" + getMenuLabel() 100 + ":</td><td align=\"right\">" 101 + str + "</td></tr>"); 102 } 103 return result; 104 105 } 106 }