Skip to content

Instantly share code, notes, and snippets.

@pukpr
Last active May 22, 2024 13:53
Show Gist options
  • Save pukpr/239a25ebe81082c6a14107861b7b9af3 to your computer and use it in GitHub Desktop.
Save pukpr/239a25ebe81082c6a14107861b7b9af3 to your computer and use it in GitHub Desktop.
Declination times perigee factors tidal summation
-- 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
@pukpr
Copy link
Author

pukpr commented May 18, 2024

redo previous
image

@pukpr
Copy link
Author

pukpr commented May 19, 2024

image

@pukpr
Copy link
Author

pukpr commented May 19, 2024

Darwin

image

  10.69175680796 :offset:
  -9.10648478024 :bg:
   0.90663616548 :impA:
  -0.19862226689 :impB:
  -4.43179577521 :impC:
  -0.46979469337:delA:
   0.24508596064:delB:
   0.00000003034:asym:
   0.15583702078:ann1:
  -1.32917772591:ann2:
   0.06588501476:sem1:
  -1.40945847600:sem2:
  -0.00165871307:year:
  -0.47318164061:IR:
  -0.00133309133 :mA:
   0.00135221938 :mP:
  -0.10029989528 :shiftT:
   0.65840777939 :init:
---- Tidal ----
  27.32166155400,    0.01790752976,    5.19066211430,  1,  3539,  4.92043575392418E-04
  27.21222081500,   -0.04463281760,    0.90384877353,  2, -2820,  1.64073093446322E-03
  27.10365333842,    0.04413069154,    5.85100539337,  3,  1442,  2.86165535307149E-03
  13.66083077700,   -0.55962081772,   -2.30353833539,  4, -277,  3.15919149301349E-01
  13.60611040750,   -0.07258663838,    4.51559727251,  5, -827,  9.98077709582378E-03
  13.63341568476,   -0.04171550183,  -11.57491019534,  6, -133,  1.28178306799966E-01
  13.55182666921,   -0.00551425737,    4.77329280115,  7, -489,  1.41740263913067E-03
  13.57891428673,    0.00213989656,    1.88155551032,  8,  65,  1.29555306345175E-03
  26.99594871373,   -0.04582119939,   -3.63335656697,  9, -2107,  2.28268787185689E-03
  27.55454988600,    0.07714227881,   -0.33803714461,  10, -10,  8.57620038125863E-02
  13.77727494300,    0.11373500902,    3.43979471933,  11,  748,  1.34109849025151E-02
  13.71880577217,    0.00275453192,    7.70654262131,  12,  412,  5.38051824950004E-04
  27.09267692660,   -0.04546698247,   -2.93034521970,  13, -2101,  2.27221694417265E-03
---- LTE ----
   0.00000000000 :trend:
   0.00000000000 :accel:
  -0.00913882289 :K0:
   0.11826550609 :level:
   0.77531139540,    0.54366621062,    2.45489086156 0
  -0.32530380355,    0.51277736197,   -2.32583669218 0
   2.25081540116,    0.39572014405,   -2.12229070187 0
  -9.58559750580,    0.19557878873,    1.39917112781 0
  -0.60128184737,    0.65872484256,    2.08592018762 0
  -3.87662661018,    0.69285379322,    1.74841632952 0
 739.52497264164,    0.39094470040,    0.85798422334 1
13311.44950754958,    0.08800459200,    2.66088214567 18
102793.97119718844,    0.07736401872,   -2.52164259470 139

DTW 0.7879817789 0.4618589130 7 1
PS C:\Users\pp\scratch\drac\run> ..\backup tropAMO_ENSO_forcing_scaled1_darwin_trial2cc1c-1950-2000

AMO

image

  10.50941710905 :offset:
  -9.06877382604 :bg:
   1.58264160132 :impA:
   0.02560449809 :impB:
  -3.07394293441 :impC:
  -0.44466458003:delA:
   0.25000212351:delB:
   0.00000000000:asym:
   0.09390941470:ann1:
  -2.56131028196:ann2:
   0.02168838402:sem1:
  -2.06165176070:sem2:
  -0.00165567545:year:
  -0.54287259252:IR:
  -0.00228980012 :mA:
   0.00148473552 :mP:
  -0.10001864470 :shiftT:
   0.29397398481 :init:
---- Tidal ----
  27.32166155400,    0.01951440897,    4.88381957512,  1,  3866,  4.92043575392418E-04
  27.21222081500,   -0.04450543979,    1.01998486375,  2, -2813,  1.64073093446322E-03
  27.10365333842,    0.04086697067,    6.42791192990,  3,  1328,  2.86165535307149E-03
  13.66083077700,   -0.56387549783,   -2.30269298762,  4, -278,  3.15919149301349E-01
  13.60611040750,   -0.07276601740,    4.52597767918,  5, -829,  9.98077709582378E-03
  13.63341568476,   -0.04375228448,  -11.38312345747,  6, -134,  1.28178306799966E-01
  13.55182666921,   -0.00803905249,    4.80245941102,  7, -667,  1.41740263913067E-03
  13.57891428673,    0.00228262013,    1.18454477436,  8,  76,  1.29555306345175E-03
  26.99594871373,   -0.04011558878,   -3.34609582639,  9, -1857,  2.28268787185689E-03
  27.55454988600,    0.07529403966,   -0.40615119427,  10, -12,  8.57620038125863E-02
  13.77727494300,    0.11785852452,    3.41827966678,  11,  779,  1.34109849025151E-02
  13.71880577217,    0.00105340237,   -0.00000000004,  12,  96,  5.38051824950004E-04
  27.09267692660,   -0.03931354016,   -3.16369498220,  13, -1830,  2.27221694417265E-03
---- LTE ----
   0.00000000000 :trend:
   0.00000000000 :accel:
   0.00051843483 :K0:
  -0.01715456081 :level:
   0.83686598391,    0.10388952059,   -1.03767759111 0
   0.39515843224,    0.07267673186,   -0.65346125452 0
   0.27750165989,    0.06149549878,    2.44179150801 0
   1.07615033197,    0.07338850822,    2.19549026579 0
   0.61430037141,    0.03326885080,   -2.31885958895 0
   6.50351781549,    0.04917548297,    0.15615922115 0
   4.63714328958,    0.04428043025,   -1.21102781956 0
 673.52062985926,    0.16849949655,    2.67307669383 1

DTW 0.7741631477 0.4679637461 1 1
PS C:\Users\pp\scratch\drac\run> ..\backup tropAMO_ENSO_forcing_scaled1_nino34bamo_wow1-allnight

Darwin

image

  10.69143953263 :offset:
  -9.10655493063 :bg:
   0.90467735447 :impA:
  -0.20266976424 :impB:
  -2.30406955610 :impC:
  -0.46979537476:delA:
   0.24508596064:delB:
   0.00000015476:asym:
   0.37823817636:ann1:
  -1.86991676759:ann2:
   0.15074040530:sem1:
  -1.09666010501:sem2:
  -0.00165871443:year:
  -0.42000825390:IR:
  -0.00133664624 :mA:
   0.00135223477 :mP:
  -0.10030004013 :shiftT:
   0.63767249839 :init:
---- Tidal ----
  27.32166155400,    0.01789927872,    5.18971224616,  1,  3538,  4.92043575392418E-04
  27.21222081500,   -0.04464451840,    0.90304305697,  2, -2821,  1.64073093446322E-03
  27.10365333842,    0.04414195303,    5.85085679460,  3,  1443,  2.86165535307149E-03
  13.66083077700,   -0.55961557370,   -2.30355260739,  4, -277,  3.15919149301349E-01
  13.60611040750,   -0.07258667758,    4.51570518505,  5, -827,  9.98077709582378E-03
  13.63341568476,   -0.04172740308,  -11.57458127853,  6, -133,  1.28178306799966E-01
  13.55182666921,   -0.00551656365,    4.77183747311,  7, -489,  1.41740263913067E-03
  13.57891428673,    0.00226342382,    1.88206981349,  8,  75,  1.29555306345175E-03
  26.99594871373,   -0.04579175431,   -3.63424339351,  9, -2106,  2.28268787185689E-03
  27.55454988600,    0.07713866894,   -0.33800843893,  10, -10,  8.57620038125863E-02
  13.77727494300,    0.11373782990,    3.43971263572,  11,  748,  1.34109849025151E-02
  13.71880577217,    0.00254065284,    7.70442543235,  12,  372,  5.38051824950004E-04
  27.09267692660,   -0.04544827666,   -2.93026609074,  13, -2100,  2.27221694417265E-03
---- LTE ----
   0.00000000000 :trend:
   0.00000000000 :accel:
   0.00450648911 :K0:
  -0.05274738476 :level:
   0.79084951612,    0.54114052903,    2.50276948305 0
  -0.27002247547,    0.40360545199,   -2.74401257244 0
   3.36135912361,    0.30127716627,   -0.80222900629 0
   8.93550254717,    0.25380086444,    1.92636509266 0
   0.55550518257,    0.27936058857,    1.46040775882 0
   3.89449484932,    0.60609659990,    1.95306362563 0
 739.51655856950,    0.50887067741,   -1.12506740287 1
13311.29805425102,    0.26666304837,   -2.25374878679 18
39933.89416275305,    0.11347222968,    3.04863901754 54

DTW 0.7911507876 0.5428201716 7 1
PS C:\Users\pp\scratch\drac\run> ..\backup tropAMO_ENSO_forcing_scaled1_darwin_trial2cc1d_3harm

@pukpr
Copy link
Author

pukpr commented May 22, 2024

PDO

image

  10.69166905808 :offset:
  -9.10646580709 :bg:
   0.84054666135 :impA:
  -0.21792506012 :impB:
  -1.59733950503 :impC:
  -0.46979656241:delA:
   0.24508596064:delB:
  -0.00000013621:asym:
   0.36310591121:ann1:
  -2.30586880837:ann2:
   0.23067632591:sem1:
  -1.10447177422:sem2:
  -0.00165871705:year:
  -0.35701183884:IR:
  -0.00135243795 :mA:
   0.00135223259 :mP:
  -0.10029998930 :shiftT:
   0.61953937812 :init:
---- Tidal ----
  27.32166155400,    0.01790117102,    5.18972247203,  1,  3538,  4.92043575392418E-04
  27.21222081500,   -0.04465096858,    0.90316327437,  2, -2821,  1.64073093446322E-03
  27.10365333842,    0.04413019984,    5.85091189360,  3,  1442,  2.86165535307149E-03
  13.66083077700,   -0.55961827568,   -2.30356454067,  4, -277,  3.15919149301349E-01
  13.60611040750,   -0.07258264809,    4.51564127160,  5, -827,  9.98077709582378E-03
  13.63341568476,   -0.04171344447,  -11.57444605568,  6, -133,  1.28178306799966E-01
  13.55182666921,   -0.00551318194,    4.77208771049,  7, -489,  1.41740263913067E-03
  13.57891428673,    0.00226423169,    1.88634250009,  8,  75,  1.29555306345175E-03
  26.99594871373,   -0.04579446901,   -3.63281786635,  9, -2106,  2.28268787185689E-03
  27.55454988600,    0.07716556468,   -0.33795415662,  10, -10,  8.57620038125863E-02
  13.77727494300,    0.11373640109,    3.43966597829,  11,  748,  1.34109849025151E-02
  13.71880577217,    0.00255117017,    7.71097937611,  12,  374,  5.38051824950004E-04
  27.09267692660,   -0.04544282608,   -2.93052133698,  13, -2100,  2.27221694417265E-03
---- LTE ----
   0.00000000000 :trend:
   0.00000000000 :accel:
  -0.03143584272 :K0:
  -0.09380226994 :level:
   0.74303296929,    0.39148327933,    1.83776108693 0
   0.32323483006,    0.29741904143,   -0.73143342642 0
   3.03711939005,    0.37643879015,    0.30235420306 0
   6.94848088794,    0.41441873819,    2.80152227276 0
  -0.57322922453,    0.30398138322,    2.83171285964 0
   3.90833379254,    0.76705191438,    2.41426305064 0
 739.51774728029,    0.82716022439,    1.26312992094 1
13311.31945104524,    0.45861932501,   -2.41577570658 18

DTW 0.7712390670 0.3920946649 7 1
PS C:\Users\pp\scratch\drac\run> ..\backup tropAMO_ENSO_forcing_scaled1_pdo_trial2cc1d_2harm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment