package model

const EnvironmentDataKey = "environment_data_%d"

const (
	ModelInfoDefault       = iota
	ModelInfoNoise         //噪音
	ModelInfoPM25          //pm2.5
	ModelInfoPM10          //pm10
	ModelInfoTemprature    //温度
	ModelInfoHumidity      //湿度
	ModelInfoPressure      //气压
	ModelInfowindSpeed     //风速
	ModelInfoWindDirection //风向

	ModelInfoRainfall        //降雨量
	ModelInfoUltravioletRays //紫外线
	ModelInfoLightIntensity  //光照强度

	ModelInfoAirQuality      //空气质量
	ModelInfoAll        = 20 //综合，所有类型
	ModelInfoAQI        = 21 //空气质量AQI
)

func CalculateDirection(windDirection float32) string {
	result := "-"
	if windDirection > 337.5 || windDirection <= 22.5 {
		result = "北"
	} else if windDirection > 22.5 || windDirection <= 67.5 {
		result = "东北"
	} else if windDirection > 67.5 || windDirection <= 112.5 {
		result = "东"
	} else if windDirection > 112.5 || windDirection <= 157.5 {
		result = "东南"
	} else if windDirection > 157.5 || windDirection <= 202.5 {
		result = "南"
	} else if windDirection > 202.5 || windDirection <= 247.5 {
		result = "西南"
	} else if windDirection > 247.5 || windDirection <= 292.5 {
		result = "西"
	} else if windDirection > 292.5 || windDirection <= 337.5 {
		result = "西北"
	}
	return result
}
