1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- package model
- const EnvironmentDataKey = "environment_data_%d"
- const (
- ModelInfoDefault = iota
- ModelInfoAirQuality //空气质量
- ModelInfoPM25 //pm2.5
- ModelInfoPM10 //pm10
- ModelInfoTemprature //温度
- ModelInfoHumidity //湿度
- ModelInfowindSpeed //风速
- ModelInfoPressure //气压
- ModelInfoNoise //噪音
- ModelInfoLightIntensity //光照强度
- ModelInfoWindDirection //风向
- ModelInfoRainfall //降雨量
- ModelInfoUltravioletRays //紫外线
- 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
- }
|