[Scipy-svn] r2538 - trunk/Lib/sandbox/timeseries/src
scipy-svn at scipy.org
scipy-svn at scipy.org
Thu Jan 11 13:44:54 EST 2007
Author: mattknox_ca
Date: 2007-01-11 12:44:52 -0600 (Thu, 11 Jan 2007)
New Revision: 2538
Modified:
trunk/Lib/sandbox/timeseries/src/cseries.c
Log:
added error handling for converting to a high frequency when the start_date of the source series is outside the allowable range
Modified: trunk/Lib/sandbox/timeseries/src/cseries.c
===================================================================
--- trunk/Lib/sandbox/timeseries/src/cseries.c 2007-01-11 18:26:01 UTC (rev 2537)
+++ trunk/Lib/sandbox/timeseries/src/cseries.c 2007-01-11 18:44:52 UTC (rev 2538)
@@ -635,14 +635,19 @@
//convert start index to new frequency
newStartTemp = asfreq_main(startIndex, 'B');
- if (newStartTemp == -1) { newStart = asfreq_endpoints(startIndex, 'A'); }
+ if (newStartTemp < 1) { newStart = asfreq_endpoints(startIndex, 'A'); }
else { newStart = newStartTemp; }
//convert end index to new frequency
newEndTemp = asfreq_main(startIndex+array->dimensions[0]-1, 'A');
- if (newEndTemp == -1) { newEnd = asfreq_endpoints(startIndex+array->dimensions[0]-1, 'B'); }
+ if (newEndTemp < 1) { newEnd = asfreq_endpoints(startIndex+array->dimensions[0]-1, 'B'); }
else { newEnd = newEndTemp; }
+ if (newStart < 1) {
+ PyErr_SetString(PyExc_ValueError, "start_date outside allowable range for destination frequency");
+ return NULL;
+ }
+
newLen = newEnd - newStart + 1;
newHeight = get_height(fromFreq[0], toFreq[0]);
More information about the Scipy-svn
mailing list