How are VR files .wnd structured ?
Post by iconPost by Reves_de_gosse | 2023-07-01 | 09:12:45

Hi Cvetan
VR sends weather files from NOAA to our PCs as .wnd files.
for example : https://static.virtualregatta.com/winds/live/20230701/00/006.wnd
But I can't read them.
Could you tell us what their structure is, and how to read them ?
Thanks

commenticon 9 Comments
Post by iconPost by zezo | 2023-07-02 | 18:53:43
8-bit signed integer U/V values

function vr_speed(d) {
if (d > 127) {
d = 256 - d;
return -(d*d)*(3600.0/230400.0);
}
return (d*d)*(3600.0/230400.0);
}

Post by iconPost by zezo | 2023-07-02 | 19:43:16
And then to TWD/TWS

function uv2d(u, v) {
var d = Math.atan2(u,v) * 180/Math.PI + 180;
if (d < 0)
d += 360;
else if (d >= 360)
d -= 360;
return d;
}

function uv2s(u,v) {
return Math.sqrt(u*u + v*v);
}

Post by iconPost by Reves_de_gosse | 2023-07-04 | 13:24:05
Thanks, I will try it.

Post by iconPost by plux | 2023-08-16 | 15:23:22
Hello
Thank's for your great works.
files wnd are binary encoded howto decode them ?
Tks
Post by iconPost by Hardtack | 2023-08-20 | 17:15:45
The files contain U and V wind components as single bytes - equaling to two bytes per data point.
Cvetan actually provided the function to decode the values above, along with functions to convert U and V to wind speed and direction.

Your task is to figure out the order in which the bytes are stored. Obviously it's a serialized 3D matrix (lat, lon, component), but you have to find the order in which the columns are written, as well as the order of values in a columns. I'd expect U and V first by latitude, then by longitude, north to south and west to east. In pseudo code:


for lat from 90 downto -90
for lon from 0 to 359
wind[lat,lon].u = read(file)
wind[lat,lon].v = read(file)
end
end


Post by iconPost by plux | 2023-08-22 | 12:34:26
nice, tks fo explanation
Post by iconPost by Reves_de_gosse | 2023-10-01 | 08:16:07
En fait, aujourd'hui, lorsque VR utilise une prédiction météo en 1°, ils utilisent les fichiers .wnd comme décrit plus haut.
Mais en 0.25, ils utilisent des fichiers .grb, qui sont des Gribs standards.

In fact, today, when VR uses a weather forecast in 1°, they use the .wnd files as described above.
But in 0.25°, they use the .grb files, which are standard Gribs.

Post by iconPost by Reves_de_gosse | 2024-11-26 | 20:12:30
Hello Cvetan
In July 2023, http://zezo.org/forum.pl?tid=8668 , you indicated how to go from the VR value in 8 signed bits of U and V to its floating value :
function vr_speed(d) {
if (d > 127) {
d = 256 - d;
return -(d*d)*(3600.0/230400.0);
}
return (d*d)*(3600.0/230400.0);
}

What seems inconsistent to me with this last formula :

sub vr($) {
my $d = shift;
my $sign = ($d < 0)?-1:1;
return $sign * round(sqrt(abs($d*230.4)));
}

by a coefficient of 3.6 to fall back on the rounded value.
So what is the right formula?
Thanks.


P.S. Of course, the goal is to process NOAA data without having to read the files on VR.
Post by iconPost by zezo | 2024-11-29 | 10:09:47
They use proper GRIB files now. But they are rounded to 7-bit integers.

Interestingly, the minimum wind value is variable, depending on the current data, but the scale factor is fixed. It could get a bit more precision by applying floating scaling factor. But it's probably the way one of the standard grib tools works, and maybe there is no provision for custom scaling factor in that specific signed char[] format.

I'm using the same encoding in the webp image files to get the same numbers as the game interface.

forward encoding:

my $uo = int((($u - $minu) * 100 + 32.5)/64);

and back to m/s

speed_m_s = wind_data[offset] * 0.64 + wind_data.minu;

border
Topics list
Posts
border
1
border
border
5
border
border
Copyright 2009 by ZEZO.ORG. All Rights Reserved.