veech / vgrib2

A library for parsing grib2 files written in Typescript
MIT License
4 stars 2 forks source link

Fix for negative latitudes being incorrectly calculated #2

Closed RichardPilbery closed 3 years ago

RichardPilbery commented 3 years ago

This is a bit janky, but I'm not that comfortable with bitwise operations in javascript. Basically, it looks like the left-most bit indicates whether a value is negative or not, but if this is not reset to 0, then the incorrect latitude will be calculcated. Hopefuly fixes #1

veech commented 3 years ago

Awesome! Thanks for the help! Have you verified that positive lat/long values are unaffected? (Sorry for the lack of testing)

RichardPilbery commented 3 years ago

Yes I have. There are no code changes with respect to latitude and the bitwise operation is only applied for latitudfe values < 0.

veech commented 3 years ago

Good catch! Thanks for your help!