google-code-export / ccc-gistemp

Automatically exported from code.google.com/p/ccc-gistemp
Other
0 stars 0 forks source link

Series sometimes have early parts truncated when writing to file. #70

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
If a series (giss_data.Series) does not start in January then when it is 
written to a file in V2Mean format, its first (partial) year will not be 
written.

(I don't think this is a problem for running ccc-gistemp normally, as the 
intermediate files are not used as inputs.  But it will be a problem if running 
individual steps).

This python program illustrates:

from code.giss_data import Series
from tool.giss_io import V2MeanWriter

s = Series(uid='123459990001')
s.set_series(1880*12+3, range(24))
w = V2MeanWriter('foo')
w.write(s)
w.close()

The series should start in 1880-03 but in file foo we see:

1234599900011881  100  110  120  130  140  150  160  170  180  190  200  210
1234599900011882  220  230-9999-9999-9999-9999-9999-9999-9999-9999-9999-9999

Not good.

Original issue reported on code.google.com by d...@pobox.com on 16 Jul 2010 at 7:33

GoogleCodeExporter commented 9 years ago
This is because s.has_data_for_year(1880) returns False (incorrectly).  So no 
row is output for 1880.

The bug is in "if start_index < 0" in get_a_year.  If a series starts in 
January, then a negative month index corresponds to a year that has no data; 
this is what the code expects.  But if a series starts in some other month, 
then the initial partial year has to be handled separately.

Original comment by d...@pobox.com on 16 Jul 2010 at 7:45

GoogleCodeExporter commented 9 years ago
Should have added to the initial report: a series normally starts in january 
but the urban adjustment in step 2 aggressively truncates and will produce many 
series that do not start in january.

Original comment by d...@pobox.com on 16 Jul 2010 at 8:28

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r463.

Original comment by d...@pobox.com on 16 Jul 2010 at 8:47