fix: 修改导出的风向
This commit is contained in:
parent
eeeffa3e95
commit
1ad2eb6e60
@ -384,8 +384,17 @@ func (e *Exporter) fetchCaiyunRealtimeWind(ctx context.Context, lat, lon float64
|
|||||||
if strings.ToLower(data.Status) != "ok" || strings.ToLower(data.Result.Realtime.Status) != "ok" {
|
if strings.ToLower(data.Status) != "ok" || strings.ToLower(data.Result.Realtime.Status) != "ok" {
|
||||||
return 0, 0, false
|
return 0, 0, false
|
||||||
}
|
}
|
||||||
// 使用 SI 单位,风速直接为 m/s
|
// 使用 SI 单位,风速为 m/s;风向为弧度,这里转换为度[0,360)
|
||||||
return data.Result.Realtime.Wind.Speed, data.Result.Realtime.Wind.Direction, true
|
spd := data.Result.Realtime.Wind.Speed
|
||||||
|
dirRad := data.Result.Realtime.Wind.Direction
|
||||||
|
dirDeg := dirRad * 180.0 / math.Pi
|
||||||
|
for dirDeg < 0 {
|
||||||
|
dirDeg += 360
|
||||||
|
}
|
||||||
|
for dirDeg >= 360 {
|
||||||
|
dirDeg -= 360
|
||||||
|
}
|
||||||
|
return spd, dirDeg, true
|
||||||
}
|
}
|
||||||
|
|
||||||
func ensureFileWithHeader(path string) bool {
|
func ensureFileWithHeader(path string) bool {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user