Last active
May 22, 2024 13:53
-
-
Save pukpr/239a25ebe81082c6a14107861b7b9af3 to your computer and use it in GitHub Desktop.
Declination times perigee factors tidal summation
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 | |
-- Declination times perigee factors | |
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; | |
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 + 8 loop | |
declare | |
L : Amp_Phase renames Constituents(J); | |
Period : Long_Float := Periods(J); | |
begin | |
if Cos_Phase then | |
TF1 := TF1 + L.Amplitude*(Cos(2.0*Pi*Year_Len/Period*Time + L.Phase)); | |
else | |
TF1 := TF1 + L.Amplitude*(Sin(2.0*Pi*Year_Len/Period*Time + L.Phase)); | |
end if; | |
end; | |
end loop; | |
for J in Constituents'First + 9 .. Constituents'Last loop | |
declare | |
L : Amp_Phase renames Constituents(J); | |
Period : Long_Float := Periods(J); | |
begin | |
if Cos_Phase then | |
TF2 := TF2 + L.Amplitude*(Cos(2.0*Pi*Year_Len/Period*Time + L.Phase)); | |
else | |
TF2 := TF2 + L.Amplitude*(Sin(2.0*Pi*Year_Len/Period*Time + L.Phase)); | |
end if; | |
end; | |
end loop; | |
Res(I) := (Time, (Scaling + TF1)*(Integ + 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, Res2 : Data_Pairs := Template; | |
begin | |
Res1 := Tide_Sum_Diff (Template, Constituents, Periods, 0.0, Scaling, Cos_Phase, Year_Len, Integ); | |
Res2 := Tide_Sum_Diff (Template, Constituents, Periods, Ref_Time, Scaling, Cos_Phase, Year_Len, Integ); | |
for I in Res1'Range loop | |
Res1(I).Value := Res1(I).Value - Res2(I).Value; | |
end loop; | |
return Res1; | |
end Tide_Sum; | |
-- see https://geoenergymath.com/2024/04/29/fundy-mental-continued |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
PDO
DTW 0.7712390670 0.3920946649 7 1
PS C:\Users\pp\scratch\drac\run> ..\backup tropAMO_ENSO_forcing_scaled1_pdo_trial2cc1d_2harm