Skip to content

How to prepare the data from openweather API for velocify wind map? #106

@MrPhyaeSoneThwim

Description

@MrPhyaeSoneThwim

Currently, I am implementing the wind map using the data from https://onaci.github.io/leaflet-velocity/wind-global.json But the data look strange for me. Is there any way to convert the weather data of OpenWeather API for all cities in specific country because those two format are totally different.

Supported Structure of Data

[
{
    "header": {
      "discipline": 0,
      "disciplineName": "Meteorological products",
      "gribEdition": 2,
      "gribLength": 76420,
      "center": 7,
      "centerName": "US National Weather Service - NCEP(WMC)",
      "subcenter": 0,
      "refTime": "2016-04-30T06:00:00.000Z",
      "significanceOfRT": 1,
      "significanceOfRTName": "Start of forecast",
      "productStatus": 0,
      "productStatusName": "Operational products",
      "productType": 1,
      "productTypeName": "Forecast products",
      "productDefinitionTemplate": 0,
      "productDefinitionTemplateName": "Analysis/forecast at horizontal level/layer at a point in time",
      "parameterCategory": 2,
      "parameterCategoryName": "Momentum",
      "parameterNumber": 2,
      "parameterNumberName": "U-component_of_wind",
      "parameterUnit": "m.s-1",
      "genProcessType": 2,
      "genProcessTypeName": "Forecast",
      "forecastTime": 0,
      "surface1Type": 103,
      "surface1TypeName": "Specified height level above ground",
      "surface1Value": 10.0,
      "surface2Type": 255,
      "surface2TypeName": "Missing",
      "surface2Value": 0.0,
      "gridDefinitionTemplate": 0,
      "gridDefinitionTemplateName": "Latitude_Longitude",
      "numberPoints": 65160,
      "shape": 6,
      "shapeName": "Earth spherical with radius of 6,371,229.0 m",
      "gridUnits": "degrees",
      "resolution": 48,
      "winds": "true",
      "scanMode": 0,
      "nx": 360,
      "ny": 181,
      "basicAngle": 0,
      "subDivisions": 0,
      "lo1": 0.0,
      "la1": 90.0,
      "lo2": 359.0,
      "la2": -90.0,
      "dx": 1.0,
      "dy": 1.0
    },
    "data": [
      4.54,
      4.52,
      4.49,
      4.47,
      4.44,
      4.41,
      4.38
    ]
}
]

Open Weather API response, but it will be an array of objects for cities in a specific country

{
    "coord": {
        "lon": 106.461,
        "lat": 11.0895
    },
    "weather": [
        {
            "id": 804,
            "main": "Clouds",
            "description": "overcast clouds",
            "icon": "04n"
        }
    ],
    "base": "stations",
    "main": {
        "temp": 300.07,
        "feels_like": 304.38,
        "temp_min": 300.07,
        "temp_max": 300.07,
        "pressure": 1005,
        "humidity": 97,
        "sea_level": 1005,
        "grnd_level": 1003
    },
    "visibility": 5928,
    "wind": {
        "speed": 2.79,
        "deg": 202,
        "gust": 9.37
    },
    "clouds": {
        "all": 86
    },
    "dt": 1693763130,
    "sys": {
        "type": 1,
        "id": 9314,
        "country": "VN",
        "sunrise": 1693781064,
        "sunset": 1693825374
    },
    "timezone": 25200,
    "id": 1584661,
    "name": "Cu Chi",
    "cod": 200
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions