onaci / leaflet-velocity

Visualise velocity data on a leaflet layer
https://onaci.github.io/leaflet-velocity/
Other
598 stars 213 forks source link

Processing data for leaflet-velocity #65

Closed jmhatch closed 3 years ago

jmhatch commented 3 years ago

This isn't a leaflet-velocity issue, but I thought I'd start here. I'm trying to add wind data to a leaflet map. I download the data using the following link,

https://nomads.ncep.noaa.gov/cgi-bin/filter_gfs_1p00.pl?file=gfs.t12z.pgrb2.1p00.f000&lev_10_m_above_ground=on&var_UGRD=on&var_VGRD=on&subregion=&leftlon=-72.74273&rightlon=-67.92787&toplat=43.64460&bottomlat=40.04384&dir=%2Fgfs.20210312%2F12

Then I convert the grib file to json using the weacast-grib2json program,

grib2json -d -n -o gfs.t06z.pgrb2.1p00.f000 gfs.t06z.pgrb2.1p00.f000.json

Basically following the guidance found here and here.

However, when I display the wind data on my leaflet map,

mine

it looks different than what is displayed on windy or earth.

windy_tv

Not sure what is going on, as the reference datetimes are the same, but it has to be a data issue.

Attached the json and index.html file as a MWE.

mwe_wind_data.zip

estamos commented 3 years ago

First of all, in order see the exact Wind animation in your leaflet map as in Windy, Earth etc

  1. you should make sure you are using the same input.

This can be done by checking side to side the .json values that you are using with the ones that Windy or Earth uses. It may be kinda tricky, as I know that Windy does not pass .json files but .png files to client. Alternatively, you can open downloaded .grib files with Panoply and see if you are displaying the same forecast (if the forecast is for the same datetime). It will be easier to look datetimes in UTC. You should check that your are downloading the same model from NOAA server with the same resolution.

  1. Note that slight differences may be still found since forecasting service providers may meta-process their data before visualization.

After ensuring you have the same .grib input and displaying the same .json data you should definitely

  1. check your angleConvention type.

Referring to leaflet-velocity's README

The angle convention option refers to the convention used to express the wind direction as an angle from north direction in the control. It can be any combination of bearing (angle toward which the flow goes) or meteo (angle from which the flow comes), and CW (angle value increases clock-wise) or CCW (angle value increases counter clock-wise). If not given defaults to bearingCCW.