Created
May 28, 2024 12:17
-
-
Save pukpr/2326fba3f5061ed2a8cec58b43db8308 to your computer and use it in GitHub Desktop.
Simple multiplicative Tidal factor
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; | |
Cumulative : Long_Float := 0.0; | |
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 + 3 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 + 4 .. 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; | |
Cumulative := Cumulative + cos(Scaling + TF1); | |
Res(I) := (Time, cos(Scaling + TF1)*(Integ + TF2) ); | |
end; | |
end loop; | |
Cumulative := Cumulative/Long_Float(Template'Length); | |
for I in Template'Range loop | |
Res(I).Value := Res(I).Value - Cumulative*Integ; | |
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 | |
--Res2, | |
Res1 : 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; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
QBO
CC 0.9112808632 0.4519173125 7 1
PS C:\Users\pp\scratch\anom\run> ..\backup qbo_30_kit_1960_1980oneB
C:\Users\pp\scratch\anom\run>copy enso_opt.exe.par enso_opt.exe.par.qbo_30_kit_1960_1980oneB
50
![image](https://private-user-images.githubusercontent.com/2855758/346434013-47471fa4-a8e3-484b-afad-63ae7840f18f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjExNDg2OTIsIm5iZiI6MTcyMTE0ODM5MiwicGF0aCI6Ii8yODU1NzU4LzM0NjQzNDAxMy00NzQ3MWZhNC1hOGUzLTQ4NGItYWZhZC02M2FlNzg0MGYxOGYucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDcxNiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA3MTZUMTY0NjMyWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ODU5NzUwMmI0ODllOTJhOTFkZTQyZmRiZGNmYmU3NDMzYmNlOWZhZWJkMzU3YzM0NzA1NGE4YWU3M2I5OGZkZiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.rStlWZLh2axkFqf_Aj36HbjfoSdS-vF0pAN4VW2u8Cc)
Catchup mode enabled:TRUE
CC 0.9241659569 0.4393720874 3 1
PS C:\Users\pp\scratch\anom\run> ..\backup qbo_30_kit_1960_1980oneB-50b