SOURCE

function calcWind(v) {
    calcUV = (ds,dw) => {
        if(ds<0) return {
            u: 0,
            v: 0
        }
        return {
            u: ds * Math.cos((270 - dw) * Math.PI / 180),
            v: ds * Math.sin((270 - dw) * Math.PI / 180)
        }
    }
    
    return v.map(e=>calcUV(e.wind_speed_at_ten_meters,e.wind_direction_at_ten_meters))
}

function calcLonLat(lo1,lo2,la1,la2,nx,ny) {
    const numToArr = (a1,a2,n) => {
        arr = [];
    while (lo1<lo2) {
        arrlo+=nx
        arrLo.push(arrLo)
    }
    }
    let arrLo = [],arrLa = []
    while (lo1<lo2) {
        arrlo+=nx
        arrLo.push(arrLo)
    }
    

}

console.log(calcWind(
 [
        {
            "wind_speed_at_ten_meters": "5.9210815",
            "lon": 119.8384930475,
            "wind_direction_at_ten_meters": "117.3913",
            "lat": 34.5924223066666
        },
        {
            "wind_speed_at_ten_meters": "6.0296783",
            "lon": 121.1844538,
            "wind_direction_at_ten_meters": "121.20606",
            "lat": 33.6400016
        },
        {
            "wind_speed_at_ten_meters": "5.560688",
            "lon": 121.4182643,
            "wind_direction_at_ten_meters": "112.233696",
            "lat": 33.1695206
        },
        {
            "wind_speed_at_ten_meters": "5.831649",
            "lon": 122.2550822225,
            "wind_direction_at_ten_meters": "117.40398",
            "lat": 32.0494005919444
        },
        {
            "wind_speed_at_ten_meters": "6.8596387",
            "lon": 121.492430277777,
            "wind_direction_at_ten_meters": "116.71792",
            "lat": 32.7300191666666
        },
        {
            "wind_speed_at_ten_meters": "6.8596387",
            "lon": 121.323369,
            "wind_direction_at_ten_meters": "116.71792",
            "lat": 32.6802815
        },
        {
            "wind_speed_at_ten_meters": "6.9308047",
            "lon": 122.235778606111,
            "wind_direction_at_ten_meters": "119.41637",
            "lat": 32.1017966961111
        },
        {
            "wind_speed_at_ten_meters": "6.9308047",
            "lon": 122.096345000277,
            "wind_direction_at_ten_meters": "119.41637",
            "lat": 32.1744147483333
        }
    ]

))
console 命令行工具 X clear

                    
>
console