Using self.gcrs instead of self.ds.traj.ccrs for plot transform, as t… - #210
Conversation
…he latter gives shifted trajectories
| x = self.ds.traj.tx.values.T | ||
| y = self.ds.traj.ty.values.T | ||
| dcrs = self.ds.traj.ccrs | ||
| #dcrs = self.ds.traj.ccrs |
There was a problem hiding this comment.
@gauteh This seems to be the reason for the shifted trajectories on figures. I reproduced the same locally after updating Matplotlib to 3.11
https://matplotlib.org/stable/release/prev_whats_new/whats_new_3.11.0.html
There was a problem hiding this comment.
Hm... but won't this only work if the dataset is in geographic coordinates? tx/ty could be in any coordinates (UTM..). Cartesian (no CRS given) is a separate branch, so those should not be affected.
There was a problem hiding this comment.
In this case it would be more appropriate to use tlon/tlat, but not if cartesian.
There was a problem hiding this comment.
A little bit worrying that dcrs is inaccurate.
There was a problem hiding this comment.
Since this only happens from Matplotlib 3.11, I suspect it is something that should be updated in Cartopy.
See e.g.
SciTools/cartopy#2682
There was a problem hiding this comment.
Or we need to do something in Trajan.
There are many fundamental changes in Matplotlib 3.11, e.g.:
When closing a shown figure window, the related figure is reset to the standalone state, i.e., it's not visible to pyplot anymore, but if you still hold a reference to it, you can continue to work with it (e.g. do fig.savefig(), or re-add it to pyplot with plt.figure(fig) and then show it again).
There was a problem hiding this comment.
Ah, ok. Anyway, maybe it's a good compromise to use tlon/tlat for now, then it makes sense conceptually. I can take a look at that later.
…he latter gives shifted trajectories