Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quickmap shifts longitude of data, resulting in wrong plot #20

Open
juntyr opened this issue Oct 10, 2024 · 0 comments
Open

Quickmap shifts longitude of data, resulting in wrong plot #20

juntyr opened this issue Oct 10, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@juntyr
Copy link
Contributor

juntyr commented Oct 10, 2024

What happened?

I am plotting a temperature field. Before calling the earthkit.plots.quickmap.plot function, the longitude of the data ranges from 0 to 360. After plotting, the xarray.DataArray's own longitude has changed (!) to -180 to 180, and the plot itself is wrong, with the map lines and axis labels using the -180 to 180 range, but the data still assuming that everything is in 0 to 360 (e.g. South America's temperatures are plotted on the map lines of Australia).

What are the steps to reproduce the bug?

I think this issue relates to xarray's indices being mutable: pydata/xarray#7463. Somewhere in the plotting, I assume there is some code to standardize the longitude to the -180 to 180 range, which assumes it's operating on a copy of the data. However, it is able to mutate the actual longitude index. When later code checks, it sees that the longitude index is correct (even though the temperature data has not been shifted yet), and so doesn't do anything else. As a result, after plotting, the plot is wrong and the data array has been changed.

Version

0.2.3

Platform (OS and architecture)

Emscripten WebAssembly (lab.climet.eu)

Relevant log output

No response

Accompanying data

https://a3s.fi/compression.lab.climet.eu/era5_t2m_2012_12_01_14:00.nc

Organisation

University of Helsinki

@juntyr juntyr added the bug Something isn't working label Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant