Weather: wind direction in a shortcut

It seems apple has chosen to show wind direction in the weather conditions on a 0-360 scale instead of N-E-S-W (and all combinations usually made from those)

Does anyone have an idea on how to reference 0-360 to North-East-South-West etc. in a shortcut?

Added difficulty: North would be 350 - 010 f.e. see table below

Maybe one of these…

  • A set of IFs.
  • 360 entries in a dictionary.
  • Modulo arithmetic on the degrees (offset by adding or subtracting the deviation from origin on North = 10 degrees) and then looking up the result by position in an ordered list.
  • Find a web API or page search to scrape that can work it out.

I’m going to look into it this week(end), will post if I get it sorted. But will be difficult I think

I came up with the following approximation of the wind direction (also for a shortcuts program):
If degrees is less than 11 or greater than 349 the wind direction is North.

If not, I add 11,25 to the degrees, divide it by 22,5. The result is than rounded down. This way you get a number.

I have a list (woordenboek) from 1 to 15 with all the wind directions from NNE as one, NE as two, ENE as three, etc, eight as South and NNW as 15.

Eg. 187 degrees + 11,25 is 198,25
198,25 / 22,5 = 8,8 rounded down is 8 and therefore the wind direction is South

Thanks Frank! I’ll try that one, sounds like a (=the) solution. (bedankt!)

can you share a screenshot of the dictionary?

This might give you a step up?

The first shortcut I hope should convert and positive value compass bearing to the cardinal, primary or secondary inter-cardinal.

This second shortcut is simply an example to enter a bearing and feedback the result using the previous shortcut.

1 Like

Hi, here you go.

(text) contains of nr. 8 as example