Created
June 17, 2024 22:48
-
-
Save pukpr/3a3566b601a54da2724df9c29159ce16 to your computer and use it in GitHub Desktop.
Flat tidal factor series, 2nd-order multiply 1st to 2nd partition
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Conventional tidal series summation or superposition of cycles | |
function Tide_Sum_Diff (Template : in Data_Pairs; | |
Constituents : in Long_Periods_Amp_Phase; | |
Periods : in Long_Periods; | |
Ref_Time : in Long_Float := 0.0; | |
Scaling : in Long_Float := 1.0; | |
Cos_Phase : in Boolean := True; | |
Year_Len : in Long_Float := Year_Length; | |
Integ: in Long_Float := 0.0 | |
) return Data_Pairs is | |
Pi : Long_Float := Ada.Numerics.Pi; | |
Time : Long_Float; | |
Res : Data_Pairs := Template; | |
One : constant Long_Float := 1.0; | |
Partition : constant Integer := 7; -- 4 | |
begin | |
for I in Template'Range loop | |
Time := Template(I).Date + Ref_Time; | |
declare | |
TF1, TF2 : Long_Float := 0.0; | |
use Ada.Numerics.Long_Elementary_Functions; | |
begin | |
for J in Constituents'First .. Constituents'First + Partition loop | |
declare | |
L : Amp_Phase renames Constituents(J); | |
Freq : Long_Float := Year_Len / Periods(J); | |
begin | |
if Aliased_Period then | |
Freq := Long_Float'Remainder(Freq,One); | |
end if; | |
if Cos_Phase then | |
TF1 := TF1 + L.Amplitude*(Cos(2.0*Pi*Freq*Time + L.Phase)); | |
else | |
TF1 := TF1 + L.Amplitude*(Sin(2.0*Pi*Freq*Time + L.Phase)); | |
end if; | |
end; | |
end loop; | |
for J in Constituents'First + Partition+1 .. Constituents'Last loop | |
declare | |
L : Amp_Phase renames Constituents(J); | |
Freq : Long_Float := Year_Len / Periods(J); | |
begin | |
if Aliased_Period then | |
Freq := Long_Float'Remainder(Freq,One); | |
end if; | |
if Cos_Phase then | |
TF2 := TF2 + L.Amplitude*(Cos(2.0*Pi*Freq*Time + L.Phase)); | |
else | |
TF2 := TF2 + L.Amplitude*(Sin(2.0*Pi*Freq*Time + L.Phase)); | |
end if; | |
end; | |
end loop; | |
Res(I) := (Time, TF1 + TF2 + Scaling * TF1 * TF2 ); | |
end; | |
end loop; | |
return Res; | |
end Tide_Sum_Diff; | |
function Tide_Sum (Template : in Data_Pairs; | |
Constituents : in Long_Periods_Amp_Phase; | |
Periods : in Long_Periods; | |
Ref_Time : in Long_Float := 0.0; | |
Scaling : in Long_Float := 1.0; | |
Cos_Phase : in Boolean := True; | |
Year_Len : in Long_Float := Year_Length; | |
Integ: in Long_Float := 0.0 | |
) return Data_Pairs is | |
Res1 : Data_Pairs := Template; | |
begin | |
Res1 := Tide_Sum_Diff (Template, Constituents, Periods, 0.0, Scaling, Cos_Phase, Year_Len, Integ); | |
return Res1; | |
end Tide_Sum; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
DTW=2
DTW 0.6041530471 0.7440587325 4 1
PS C:\Users\pp\scratch\anom\run> $env:NUMBER_OF_PROCESSORS="8"
PS C:\Users\pp\scratch\anom\run> ..\backup bi_darwin_overfit_harm721c-1920-1980excl-dtw1fixharm_mod-overnight4aWOW1dtwccDTW_noharm1hi1cc-1940-1945CCbaddlowC