#79 closed defect (fixed)
an error in SubSer and DatCh
Reported by: | imendez | Owned by: | danirus |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | TimeSetAlgebra | Version: | head |
Severity: | normal | Keywords: | |
Cc: |
Description
This code:
Serie sr = CalInd(WD(7), Diario);
Date f = First(sr);
Date l = Last(sr);
Serie srFec = DatCh(sr, WD(6), FirstS);
Serie srSub = SubSer(srFec, f, l);
apparently works rigth, but when making a table you can see that srSub hasn't no
data.
I think it's a problem with SubSer when making it from TheBegin (but, curiously,
not when making it until The End):
Serie srSubBeg = SubSer(CalInd(WD(7), Diario), TheBegin, y2004);
Serie srSubEnd = SubSer(CalInd(WD(7), Diario), y2004, TheEnd);
Now, "srSubEnd" is rigth, but "srSubBeg" hasn't got any data.
This problem merges from another error in DatCh:
/
Serie sr = SubSer(Trend(y2004m07d01, Diario), y2004m07d01, y2004m07d31);
Serie srFec = DatCh(sr, WD(6), FirstS);
/
"srFec" has a wrong data (FirstS(sr)) at y2004m06d26, that is Succ(y2004m07d01,
WD(6), -1)
Regards
Change History (9)
comment:1 Changed 21 years ago by
Status: | new → assigned |
---|
comment:2 Changed 21 years ago by
comment:3 Changed 21 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
The 2nd part of this Bug has been resolved.
The problem was a wrong initialization of firstDate_ attribute for DatCh Serie
(Dev Info: BTsrDatingChange::FirstDate() method). Til now, this attribute
receives its value from the FirstNoGreat value of Serie given as first
parameter. In the example, Serie sr start at y2004m7d1, and the FirstNoGreat
value into WD(6) was that y2004m06d26.
Now DatCh start exactly in the first Date given in the parameter Serie.
A solution for this two bugs has been commited in Tol module of the CVS.
comment:4 Changed 21 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
I think the first part of this bug (related to SubSer function) is only in part
resolved. Now, when making a SubSer from TheBegin the resulting series has
rigth values, but its First date is wrong.
Compile this:
/
Serie q = SubSer(CalInd(WD(7), Diario), y2003, y2005);
Serie srSubBeg = SubSer(q, TheBegin, y2004);
Serie srSubEnd = SubSer(q, y2004, TheEnd);
Date f1 = First(srSubBeg);
Date f2 = First(srSubEnd);
Date l1 = Last(srSubBeg);
Date l2 = Last(srSubEnd);
/
Realize that "f1", The first date of "srSubBeg", is y2004m01d01 instead of y2003.
Note: this test has been compiled withTo version dated at Aug 2 2004.
comment:5 Changed 21 years ago by
I'm just start working on this Bug.
By now, the problem appears only under Windows. Under Linux the code works fine.
Daniel
comment:6 Changed 21 years ago by
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
This bug has been just resolved.
When the 2nd argument was TheBegin, SubSerie uses BDate::DefaultFirst value,
that always represents 1/January/current_year.
The solution try to use the firstDate_ attribute of the BUserTimeSerie used as
1st argument in SubSer Tol function. I said, if we have the code:
Serie q = SubSer(CalInd(WD(7), Diario), y2003, y2005);
Serie srSubBeg = SubSer(q, TheBegin, y2004);
then, Tol must use the firstDate_ of Serie q.
But now I have a doubt, how must be the behavior with TheEnd value?:
Serie srSubEnd = SubSer(q, y2004, TheEnd);
I think lastDate_ of srSubEnd Serie must be y2005, and never TheEnd, because
srSubEnd relays on Serie q, that goes until y2005.
If you consider that TheEnd should have the same behavior as TheBegin, please,
reopen this bug.
comment:7 Changed 21 years ago by
The 2nd. part of this bug, related with this code:
Serie sr = SubSer(Trend(y2004m07d01, Diario), y2004m07d01, y2004m07d31);
Serie srFec = DatCh(sr, WD(6), FirstS);
Is not a bug.
comment:8 Changed 21 years ago by
Since this bug was closed, we have been talking about the behaviour of SubSer.
Following I offers here a partial conclusion of that discussion:
With this code:
Serie srSubBeg = SubSer(CalInd(WD(7), Diario), TheBegin, y2004);
Date FirstDate = First(srSubBeg);
Serie srSubEnd = SubSer(CalInd(WD(7), Diario), y2004, TheEnd);
Date LastDate = Last(srSubEnd);
Tol must returns:
A variable Date called FirstDate == TheBegin
A variable Date called LastDate == TheEnd
With this code:
Serie a = SubSer(CalInd(C),Diario,y2004m1d1,y2004m12d31);
Serie b = SubSer(a,y2003m12d31,y2005m1d1);
Serie c = SubSer(a,TheBegin,TheEnd);
Tol must returns:
A Serie "a" -> Diario[y2004m01d01, y2004m12d21]
A Serie "b" -> Diario[y2004m01d01, y2004m12d21]
A Serie "c" -> Diario[y2004m01d01, y2004m12d21]
Other ordered behaviour, related with statistical operations (SumS, FirstS...),
will be implemented in a near future.
comment:9 Changed 18 years ago by
bug_file_loc: | → http://cvs.tol-project.org/viewcvs.cgi/tol_tests/tol/Bugzilla/bug_000079 |
---|
The first part of the error, related with SubSer has been resolved yet. The
problem was a wrong behavior when firstDate_ attribute of current Serie was
TheBegin. This wrong behavior was in BTsrSubSerie::FirstDate() method, that
never checks if the 2nd parameter used to call SubSer was BDate::TheBegin. In
that case, always to operate in a correct way, firstDate_ must be
BDate::DefaultFirst.
Still pending for resolution the second part of this Bug, related with DatCh
function.