I am trying to make seasonal maps out of climate datasets using the function imshow
from the matplotlib toolbox. My problem is that I can only get imshow to plot the logical coordinates x and y which makes my map of Spain upside down:
I have tried different methods and I think one of my problems might be that my longitude and latitude coordinates are 2d data arrays and not just vectors.
So far my code looks like this:
seasonal = PET.groupby('time.season').mean(dim=['time'])
seasonal.plot.imshow(col= 'season', robust = True)
And my data looks like this:
<xarray.DataArray 'PET' (year: 1, x: 834, y: 1115)>
array([[[nan, nan, nan, ..., nan, nan, nan],
[nan, nan, nan, ..., nan, nan, nan],
[nan, nan, nan, ..., nan, nan, nan],
...,
[nan, nan, nan, ..., nan, nan, nan],
[nan, nan, nan, ..., nan, nan, nan],
[nan, nan, nan, ..., nan, nan, nan]]], dtype=float32)
Coordinates:
lon (x, y) float64 ...
lat (x, y) float64 43.99 43.99 43.99 43.99 ... 35.75 35.75 35.75 35.75
* year (year) int64 2008
Dimensions without coordinates: x, y
Does anyone know how to solve this, so imshow
plots with longitude and latitude instead of x and y?