openclimatefix / graph_weather

PyTorch implementation of Ryan Keisler's 2022 "Forecasting Global Weather with Graph Neural Networks" paper (https://arxiv.org/abs/2202.07575)
MIT License
188 stars 47 forks source link

Sin/Cos of Lat/Lon in degrees? #51

Closed vitusbenson closed 1 year ago

vitusbenson commented 1 year ago

Hi, I stumbled upon this line: https://github.com/openclimatefix/graph_weather/blob/6524ec45a505d6cbb3e2c36d67d69305c1194063/train/pl_graph_weather.py#L178

If I am not mistaken, the lat & lon given as input to the sine & cose functions are in degrees. Should it then not be?

sin_lat_lons = np.sin(lat_lons * np.pi / 180.)
cos_lat_lons = np.cos(lat_lons * np.pi / 180.)

Cheers!:)

jacobbieker commented 1 year ago

Oh, yeah, you are right! It should be in radians, I'll update it soon, or if you want to open a PR, whichever works!

vitusbenson commented 1 year ago

Thanks for the fix. Same in: https://github.com/openclimatefix/graph_weather/blob/c2593e3664c2e38f573271dbe3460d931b37bafb/graph_weather/models/losses.py#L32

jacobbieker commented 1 year ago

Done!