deg To Dir
Compass glyph + abbreviation for a bearing in degrees clockwise from north. Accepts any finite bearing, normalizing it into [0, 360) first.
Two fixes from the original, both matching the already-correct com.xweather.mapsgl.weather.common.Units.degToDir used by the data inspector:
full modulo normalization instead of a single
+-360nudge, which threw an IndexOutOfBoundsException for any bearing below -360 (negative index) and picked the wrong bucket above 720; anda 22.5 degree bucket width.
360 / dirs.sizewas Int/Int division and evaluated to 22, so every boundary drifted progressively (a bearing of 89 read "E" instead of "ENE"). All eight cardinal and inter-cardinal bearings are unchanged by this; only intermediate bearings shift, by at most one bucket.
Buckets run [0, 22.5) = N, [22.5, 45) = NNE, and so on, so the first bucket starts at north rather than being centred on it. That is left as-is: it is what Units.degToDir has always done, and changing it would move every reported direction.