Skip to content

Instantly share code, notes, and snippets.

@pukpr
Created May 28, 2024 12:17
Show Gist options
  • Save pukpr/2326fba3f5061ed2a8cec58b43db8308 to your computer and use it in GitHub Desktop.
Save pukpr/2326fba3f5061ed2a8cec58b43db8308 to your computer and use it in GitHub Desktop.
Simple multiplicative Tidal factor
-- 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;
@pukpr
Copy link
Author

pukpr commented Jun 16, 2024

M2

AMO
image

   0.00000000000 :offset:
   0.00003021883 :bg:
   0.02192491718 :impA:
   0.14520935545 :impB:
 -14.58674217362 :impC:
  -0.12965885363:delA:
   0.46957103552:delB:
   0.03699635957:asym:
  -0.02584779255:ann1:
  11.94503952723:ann2:
   0.00502680520:sem1:
  -0.39308848540:sem2:
  -0.00001619644:year:
  -0.05008996555:IR:
  -0.31160774369 :mA:
  -0.00358983814 :mP:
  -0.54392521777 :shiftT:
   0.00773555875 :init:
---- Tidal ----
  27.32166155400,   -0.26234557402,   -0.10283234196,  1, -148629,  1.76628953531850E-04
  27.21222081500,   -1.32316215345,   14.04542009695,  2, -100304,  1.32047425097857E-03
  27.10365333842,    0.24681972753,   28.69357131898,  3,  10794,  2.26569924321020E-03
6793.47648813065,   -1.24059259212,    4.87439036410,  4, -156965,  7.90867249242066E-04
3396.73824406533,   -0.38399181608,    2.14288020859,  5, -39149,  9.83370612492222E-04
  27.55454988600,   -0.10567957432,    3.97983977373,  6, -223,  8.56289947134097E-02
  13.77727494300,    0.20514876061,   -0.29727809447,  7,  1439,  1.33274573071050E-02
   9.18484996200,    0.00583885690,    1.21123318542,  8,  152,  2.31918283471700E-03
  13.63341568476,    0.51300396561,    2.01085074397,  9,  303,  1.27448455896301E-01
3232.60542850251,    0.21065121103,   -6.95805418884,  10,  20681,  1.01366789012042E-03
  27.09267692660,   -0.21575396347,   46.70132203840,  11, -7073,  3.09392634878083E-03
  13.66083077700,    0.36655325560,    1.07145202198,  12,  16,  3.15777097820916E-01
1616.30271425126,   -0.63633509525,    4.95166467876,  13, -384468,  1.65553462995255E-04
  13.60611040750,    1.31099168565,   -7.09645138974,  14,  13447,  9.67714118545784E-03
  27.44323926226,    0.43139066174,   -1.01428985572,  15,  9319,  4.57977530236714E-03
  27.66676714572,    0.51870497380,    2.12993213737,  16,  7075,  7.22901067260159E-03
---- LTE ----
  -0.01116729137 :trend:
   0.00008714517 :accel:
  -0.60560502487 :K0:
  21.37767865981 :level:
   0.88345741981,    1.21021061627,    1.86634935743 2
   4.78173874092,    0.07722339795,   -2.64638324882 9
   0.54713248842,    1.07065024335,   -0.97274450645 1
   1.09426497685,    0.65105227740,   -1.66462790736 2
   2.18852995369,    0.14263134312,    1.51000898127 4

CC 0.8097244150 0.7438342398 1 1
PS C:\Users\pp\scratch\na\run> ..\backup.bat bi_m2_adrac_1_wow_pt79_1920_1980excl-1870drac_flat2_modulation1Harm5dtw1dtw1cc

$env:TRIGGER="0.9"
$env:PART="true"
$env:NLOOPS="20"
$env:MODULATION="true"
$env:LOCKT="false"
$env:DTW="1"
$env:CLIMATE_INDEX=".\m2.dat"

EMI

image

status: 2 2 0.67296 0.58796 # 700

   0.00005937545 :bg:
   0.04140506408 :impA:
   0.03248969542 :impB:
 -14.10223869287 :impC:
  -0.12959070806:delA:
   0.46957103552:delB:
   0.04082716543:asym:
  -0.14683768633:ann1:
   9.68159788768:ann2:
   0.13862882827:sem1:
  -6.60776624802:sem2:
  -0.00002845250:year:
  -0.63529360675:IR:
  -0.25777823670 :mA:
  -0.00358434234 :mP:
   0.04180347711 :shiftT:
   0.11340597550 :init:
---- Tidal ----
  27.32166155400,   -0.36352327914,   -0.48065731535,  1, -205912,  1.76628953531850E-04
  27.21222081500,   -1.29535915084,   14.28704494155,  2, -98198,  1.32047425097857E-03
  27.10365333842,    0.26192504989,   28.49951925160,  3,  11460,  2.26569924321020E-03
6793.47648813065,   -1.24720420885,    4.89767412583,  4, -157801,  7.90867249242066E-04
3396.73824406533,   -0.46349364239,    2.17697243049,  5, -47233,  9.83370612492222E-04
  27.55454988600,   -0.18871322407,    4.77421204805,  6, -320,  8.56289947134097E-02
  13.77727494300,   -0.21926260274,   -0.49038882323,  7, -1745,  1.33274573071050E-02
   9.18484996200,    0.01297223268,    0.05812223920,  8,  459,  2.31918283471700E-03
  13.63341568476,    0.51513815983,    2.11619933584,  9,  304,  1.27448455896301E-01
3232.60542850251,    0.24609111380,   -7.17664190787,  10,  24177,  1.01366789012042E-03
  27.09267692660,   -0.21544837329,   45.69452574269,  11, -7064,  3.09392634878083E-03
  13.66083077700,    0.44943107963,    1.35123898695,  12,  42,  3.15777097820916E-01
1616.30271425126,   -1.06290237968,    4.95455292617,  13, -642130,  1.65553462995255E-04
  13.60611040750,    1.41889927845,   -6.01773384094,  14,  14562,  9.67714118545784E-03
  27.44323926226,    0.38985818352,   -0.70667378746,  15,  8413,  4.57977530236714E-03
  27.66676714572,    0.30069469847,    1.86552255845,  16,  4060,  7.22901067260159E-03
---- LTE ----
   0.00401449535 :trend:
  -0.00002466737 :accel:
   0.19553628538 :K0:
  -7.63947072869 :level:
   1.17250383804,    0.09829620518,    2.45364545815 0
   6.67948085396,    0.05990485768,    3.08168856005 1
   4.44610866353,    0.11853470648,    1.80073716858 1
   5.48161736355,    0.12869240139,   -0.83208564134 1
  10.96323472710,    0.11013090565,   -1.12755453993 2
1397.81242770525,    0.08419452415,   -2.33719944123 255

DTW 0.5868714520 0.6732177690 2 1
PS C:\Users\pp\scratch\na\run> ..\backup bi_emi_adrac_1_wow_pt79_1920_1980excl-1870drac_flat2_modulation1Harm5dtw3

@pukpr
Copy link
Author

pukpr commented Jun 16, 2024

NINO4

image

Status: 4 2 0.68421 0.53629 # 1820

   0.00000000000 :offset:
   0.00005937545 :bg:
  -0.06091824845 :impA:
  -6.33626708030 :impC:
  -0.05486688115:delA:
   0.46957103552:delB:
   0.03518769242:asym:
  -0.07450214559:ann1:
   2.82260305466:ann2:
   0.10110990263:sem1:
  -0.95149943424:sem2:
  -0.00000932623:year:
  -0.00000000000:IR:
  -0.17923576796 :mA:
  -0.00347336967 :mP:
   0.08114354412 :shiftT:
  -0.03549419222 :init:
---- Tidal ----
  27.32166155400,   -0.02451516609,   -0.44952183269,  1, -13979,  1.76628953531850E-04
  27.21222081500,   -0.71932745213,   14.27682051930,  2, -54575,  1.32047425097857E-03
  27.10365333842,    0.00106879739,    4.33973872656,  3, -53,  2.26569924321020E-03
6793.47648813065,   -0.15898285092,    4.05136660932,  4, -20202,  7.90867249242066E-04
3396.73824406533,   -0.40249302293,    0.91293245037,  5, -41030,  9.83370612492222E-04
  27.55454988600,   -1.40062659315,    6.23101412628,  6, -1736,  8.56289947134097E-02
  13.77727494300,   -0.05209763236,   -0.24398330548,  7, -491,  1.33274573071050E-02
   9.18484996200,    0.01089369664,   -0.74357594475,  8,  370,  2.31918283471700E-03
  13.63341568476,    0.01337820325,   -0.69630075021,  9, -90,  1.27448455896301E-01
3232.60542850251,    0.78734049546,   -2.87799934100,  10,  77572,  1.01366789012042E-03
  27.09267692660,   -0.14957406230,   21.84358138185,  11, -4934,  3.09392634878083E-03
  13.66083077700,   -0.00597517306,   11.69200670096,  12, -102,  3.15777097820916E-01
1616.30271425126,   -1.45186201374,    3.82398812675,  13, -877075,  1.65553462995255E-04
  13.60611040750,    2.19527301891,   -6.07176358225,  14,  22585,  9.67714118545784E-03
  27.44323926226,    0.00710409363,   -1.58366542712,  15,  55,  4.57977530236714E-03
  27.66676714572,    0.67970985082,    1.42284170210,  16,  9303,  7.22901067260159E-03
---- LTE ----
   0.00114335941 :trend:
   0.00001444546 :accel:
   2.04963492805 :K0:
  -2.38501971665 :level:
  10.13014167260,    0.14093342985,   -2.68782245753 1
   8.70885909097,    0.19080091157,    2.57732811406 1
  17.41771818193,    0.15210927684,   -1.71738633166 2
  34.83543636386,    0.08837788514,    0.92451360074 4
  43.54429545483,    0.11439583254,    1.82119862072 5
 548.65812273085,    0.10567904987,   -2.11629355603 63
  78.37973181869,    0.06373011599,    0.55512144068 9
3779.64484547916,    0.06666911563,    2.91619025091 434
3048.10068183803,    0.10942056257,   -0.68244712570 350

DTW 0.5363075264 0.6842148598 4 1
PS C:\Users\pp\scratch\na\run> ..\backup bi_nino4_adrac_1_wow_pt79_1920_1980excl-1870drac_flat2_modulation1Harm5dtw

NINO34

image

@pukpr
Copy link
Author

pukpr commented Jul 8, 2024

QBO

image

  -0.00000000000 :offset:
   0.00000000000 :bg:
  -0.09409837054 :impA:
 -20.87444476543 :impB:
 -85.07058458260 :impC:
  -0.87837055349:delA:
   0.36500000000:delB:
   0.74481804826:asym:
  -0.04963903635:ann1:
   1.89447805742:ann2:
  -0.02849161838:sem1:
  20.12174109245:sem2:
  -0.00231642390:year:
  -0.00407395177:IR:
   0.00507340616 :mA:
  -0.01592984598 :mP:
  -0.32346154288 :shiftT:
  -0.02891018512 :init:
---- Tidal ----
  27.32166155400,   -0.09600559637,   -0.01763515489,  1, -48799,  1.97141362358840E-04
  27.21222081500,   -1.75091405094,    2.95697494095,  2, -131888,  1.32857891933721E-03
1095.17502233364,   -0.03640400064,   -1.48308284052,  3, -32953,  1.10807095297658E-04
 346.61411888846,   -0.01520027431,    2.69758702125,  4, -2350,  6.75480455428567E-04
 173.30705944423,    0.06223914995,   -2.56839727821,  5,  5504,  1.11069772217238E-03
  13.63341568476,    0.03499516161,   -2.03467095279,  6, -73,  1.27519237842966E-01
  13.66083077700,    0.17582989482,   23.47296342113,  7, -44,  3.15871834215700E-01
  13.60611040750,    0.04320567223,    0.21004803974,  8,  351,  9.58576256141684E-03
  27.55454988600,   -0.05821053221,   -1.53179434785,  9, -168,  8.56270429060868E-02
  13.77727494300,    0.00000000000,    0.11133501891,  10, -100,  1.33923946433446E-02
  27.10365333842,    0.25782232602,   -0.06666814475,  11,  11663,  2.19180972938905E-03
-411.77602506657,    0.01035837411,  -57.06978954640,  12,  4935,  2.05741286843882E-04
  27.09267692660,   -0.19146439713,   -3.23599040980,  13, -6245,  3.11602478779971E-03
-205.88801253329,   -0.01916099014,   -1.36423636535,  14, -2883,  6.88512067061880E-04
  13.69115772864,    0.04513664837,   22.52786391849,  15,  1400,  3.00966440226341E-03
   9.10846048884,    0.02121385760,   -1.74167406476,  16,  634,  2.89185464561847E-03
  27.44323926226,    0.02610594196,   -1.23650596949,  17,  470,  4.57605339746949E-03
  27.66676714572,    0.03339433934,   -2.19144989791,  18,  362,  7.23427343095432E-03
2190.35004466729,    0.07558770960,   -6.45277620379,  19,  13664,  5.49170263678697E-04
  26.87829334283,   -0.16288970950,    3.90753748751,  20, -20082,  8.15198513893674E-04
---- LTE ----
   0.00000000000 :trend:
   0.00000000000 :accel:
   0.25473595304 :K0:
  -0.18590491816 :level:
  -0.73653222958,    0.28829702379,    0.03247957524 1

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

image

50
image

Catchup mode enabled:TRUE

  -0.00000000000 :offset:
   0.00000000000 :bg:
  -0.10790160331 :impA:
 -21.32339934561 :impB:
  23.12824074346 :impC:
  -0.95224931857:delA:
   0.36500000000:delB:
   0.85142703877:asym:
  -0.05515422005:ann1:
   1.33747943784:ann2:
  -0.02426196313:sem1:
  17.46479258389:sem2:
  -0.00244857984:year:
  -0.00405876629:IR:
  -0.01673714371 :mA:
   0.01349810708 :mP:
  -0.34323108063 :shiftT:
  -0.03885832180 :init:
---- Tidal ----
  27.32166155400,   -0.14674126948,    0.00669046138,  1, -74535,  1.97141362358840E-04
  27.21222081500,   -1.53855486998,    2.01414115923,  2, -115905,  1.32857891933721E-03
1095.17502233364,   -0.05512079638,   -0.41803192944,  3, -49845,  1.10807095297658E-04
 346.61399987411,   -0.02491475930,    0.88069571398,  4, -3788,  6.75480455428567E-04
 173.30699993705,    0.14606076187,   -2.66804821557,  5,  13050,  1.11069772217238E-03
  13.63341568476,   -0.02618661971,   -2.95299973766,  6, -121,  1.27519237842966E-01
  13.66083077700,    0.12862976246,   23.70108387573,  7, -59,  3.15871834215700E-01
  13.60611040750,    0.06452846491,    0.16856592008,  8,  573,  9.58576256141684E-03
  27.55454988600,   -0.08126367100,   -2.48015156818,  9, -195,  8.56270429060868E-02
  13.77727494300,    0.00000000000,    0.11133330692,  10, -100,  1.33923946433446E-02
  27.10365333842,   -0.25453986809,    0.17621846176,  11, -11713,  2.19180972938905E-03
-411.77585709766,    0.02227056301,   53.11983590653,  12,  10725,  2.05741286843882E-04
  27.09267692660,    0.26358145090,   -1.61488260056,  13,  8359,  3.11602478779971E-03
-205.88792854883,    0.11438723214,    0.28128105007,  14,  16514,  6.88512067061880E-04
  13.69115772864,    0.02998449875,   19.20200773882,  15,  896,  3.00966440226341E-03
   9.10846048884,    0.07800709537,   -2.49116096418,  16,  2597,  2.89185464561847E-03
  27.44323926226,    0.03907604542,   -1.84889861710,  17,  754,  4.57605339746949E-03
  27.66676714572,   -0.04195644051,   -2.67065357175,  18, -680,  7.23427343095432E-03
2190.35004466729,    0.07552893203,    4.35168671522,  19,  13653,  5.49170263678697E-04
  26.87829334283,   -0.28182001826,    3.82623213377,  20, -34671,  8.15198513893674E-04
---- LTE ----
   0.00000000000 :trend:
   0.00000000000 :accel:
   0.24350190565 :K0:
   0.02871471559 :level:
   0.74241461378,    0.29844980276,    2.44193608852 1

CC 0.9241659569 0.4393720874 3 1
PS C:\Users\pp\scratch\anom\run> ..\backup qbo_30_kit_1960_1980oneB-50b

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