气象上把风吹来的方向确定为风的方向。因此,风来自北方叫做北风,风来自南方叫做南风。气象台站预报风时,当风向在某个方位左右摆动不能肯定时,则加以“偏”字,如偏北风。当风力很小时,则采用“风向不定”来说明。风向的测量单位,我们用方位来表示。如陆地上,一般用16个方位表示,海上多用36个方位表示;在高空则用角度表示。用角度表示风向,是把圆周分成360度。北风(N)是0度(即360度),东风(E)是90度,南风(S)是180度,西风(W)是270度,其余的风向都可以由此计算出来。
import java.util.HashMap;
import java.util.Map;
public class WeatherSwitchUtil {
private static Map<String, String> windPowerMap = getWindInfo();
private static Map<String, String> windDirectMap = getWindDirect();
public static String getWindPower(double windVelocity){
for(Map.Entry map : windPowerMap.entrySet()){
String windRegion = map.getValue().toString();
String windName = map.getKey().toString();
if(windRegion.indexOf("-") != -1){
String[] windRegionArray = windRegion.split("-");
double windMin = Double.parseDouble(windRegionArray[0])