Skip to content Skip to sidebar Skip to footer

Python Iris Netcdf Time Gone Awry

Something seems to have gone wrong between yesterday and today. I’m wondering if you might be able to help? This is all running Python using iris. Basically when I ran my code ye

Solution 1:

I don't know what's going on with your time coordinate, but a workaround might be to specifically plot against your year coordinates:

qplt.plot(CCCma_mean.coord('year'), CCCma_mean, label='CanRCM4_ERAINT', lw=1.5, color='blue')
qplt.plot(CRU_mean.coord('year'), CRU_mean, label='Observed', lw=2, color='black')

Solution 2:

Thank you @RuthC. That did the trick. It seemed to be plotting time as the default and since some data is days since 1949 and the other is days since 1900 this plotted them 49 years apart on the x axis. Although it is odd that it had worked the day before! Something must have changed with my software.

Note that I also had to remove this code:

 plt.gca().xaxis.set_major_locator(mdates.YearLocator(5))

otherwise the x-axis wouldn't show the year data along the bottom.

Appreciate it! Erika

Post a Comment for "Python Iris Netcdf Time Gone Awry"