Thursday, August 25, 2011

CDMS inconsistency

Not sure this counts as a bug, but it is a weird inconsistency.


>>> import cdms
>>> s1 = cdms.open("ch.17_Lister_0001_all_02.nc")
>>> s2 = cdms.open("ch.18_Lister_0001_all_02.nc")
>>> s3 = cdms.open("ch.12_Lister_0001_all_02.nc")
>>> s4 = cdms.open("ch.13_Lister_0001_all_02.nc")

>>> d1 = s1['FLNSOI']
>>> d2 = s2['FLNSOI']
>>> d3 = s3['FLNSOI']
>>> d4 = s4['FLNSOI']

>>> dd1 = d1 - d3
>>> dd2 = d2 - d4

>>> d1.getAxis(0).id
'time'
>>> d2.getAxis(0).id
'time'
>>> d3.getAxis(0).id
'time'
>>> d4.getAxis(0).id
'time'


>>> dd1.getAxis(0).id
'time'
>>> dd2.getAxis(0).id
'axis_10'


The second behavior occurs repeatably on three out of 180 file pairs, was hard to track down, and prevented the NCO ncrcat command from working. Fortunately the workaround is easy.


>>> dd2.setAxisList(d2.getAxisList())


But it's baffling how this even happens. All of the _all_NN.nc files were created by the NCO ncra command. Probably it is correct to do this and there is no guarantee that an axis list will be inherited after a calculation. But why does it USUALLY happen? These files are all produced by the same processes!

I'd prefer to have my mind read every time or never, not 59 times out of 60.

This wasted three hours of my life.