Skip to content

Instantly share code, notes, and snippets.

@pukpr
Created June 7, 2024 17:40
Show Gist options
  • Save pukpr/84d52ab15c54674360e7d8eb57c52852 to your computer and use it in GitHub Desktop.
Save pukpr/84d52ab15c54674360e7d8eb57c52852 to your computer and use it in GitHub Desktop.
Integral/Derivative adjustment
if MLR_On or not (Forcing_Only or Is_Minimum_Entropy) then -- MLR_On
if Climate_Trend then
Secular_Trend := 1.0;
else
Secular_Trend := 0.0;
end if;
if Derivative then
DR(Data_Records'First).Value := Data_Records(Data_Records'First).Value;
for I in Data_Records'First+1 .. Data_Records'Last loop
DR(I).Value := DR(I-1).Value + Data_Records(I).Value;
end loop;
else
if Partial then
DR(Data_Records'First) := Data_Records(Data_Records'First);
for I in Data_Records'First+1 .. Data_Records'Last loop
DR(I).Value := Data_Records(I-1).Value + D.B.ShiftT*(Data_Records(I).Value - Data_Records(I-1).Value);
end loop;
else
DR := Data_Records;
end if;
end if;
DR := Annual_Add(DR, -1.0);
Regression_Factors (Data_Records => Excluded(DR), -- Time series
--First => First,
--Last => Last, -- Training Interval
Forcing => Excluded(Forcing), -- Value @ Time
NM => NM + NH, -- # modulations
DBLT => M, --D.B.LT,
DALTAP => MAP, --D.A.LTAP,
DALEVEL => D.A.LEVEL,
DAK0 => D.A.K0,
Secular_Trend => Secular_Trend,
Accel => Accel,
Singular => Singular
);
else
Singular := False;
end if;
CorrCoeff := 0.0;
Pareto_Scale := 1.0;
if Pareto then
Pareto_Start := 1;
else
Pareto_Start := NH+1;
end if;
for Pareto_Index in Pareto_Start .. NH+1 loop
if Forcing_Only or (Is_Minimum_Entropy and not MLR_On ) then
Model := Forcing;
else
Model := LTE(Forcing => Forcing,
Wave_Numbers => M(1 .. NM - 1 + Pareto_Index), --D.B.Lt(1..NM),
Amp_Phase => MAP(1 .. NM - 1 + Pareto_Index), --D.A.LTAP,
Offset => D.A.level,
K0 => D.A.K0,
Trend => Secular_Trend,
Accel => Accel,
NonLin => NonLin+D.B.IR); -- D.LT GEM.LTE.LT0
if Derivative then
for I in reverse Model'First+1 .. Model'Last loop
Model(I).Value := Model(I).Value - Model(I-1).Value;
end loop;
Model(Model'First).Value := Model(Model'First+1).Value;
end if;
if Partial then
for I in Model'First+1 .. Model'Last loop
Impulses(I).Value := Model(I).Value - Model(I-1).Value;
end loop;
Impulses(Model'First).Value := 0.0;
for I in Model'Range loop
Model(I).Value := Model(I).Value + D.B.ShiftT* Impulses(I).Value;
end loop;
end if;
Model := Annual_Add(Model);
end if;
@pukpr
Copy link
Author

pukpr commented Jun 12, 2024

Extra high harmonic

image

.\nino34_knmi_start_blank.dat for Thread # 8 1
Catchup mode enabled:TRUE

  -9.38688555514 :offset:
 105.64345246511 :bg:
   0.05734680321 :impA:
   3.01872690552 :impB:
  12.90669438673 :impC:
  -0.51994107250:delA:
   0.21881111535:delB:
  -0.51779139137:asym:
  -0.12921329893:ann1:
   8.60186683693:ann2:
  -0.05252616304:sem1:
   0.17910996584:sem2:
   0.00016105141:year:
  -0.21308558972:IR:
  -0.01528839665 :mA:
   0.00538241793 :mP:
  -0.52593875784 :shiftT:
   0.47906625939 :init:
---- Tidal ----
  27.32166155400,   -0.02335689226,  -16.27034554866,  1, -13344,  1.76356181782067E-04
  27.21222081500,   -0.04285514217,    3.55228256805,  2, -3346,  1.32018604870843E-03
  27.10365333842,    0.06145774885,  -12.47238819007,  3,  2611,  2.26683748305482E-03
6793.47648813065,   -0.01958034730,   -0.49069665574,  4, -2817,  7.20730041974031E-04
3396.73824406533,   -0.06924074952,    2.48881898582,  5, -52299,  1.32647102305794E-04
  27.55454988600,   -4.15572955856,   -0.96464005238,  6, -4953,  8.56291868681121E-02
  13.77727494300,   -0.59400940934,    1.53734365872,  7, -4550,  1.33483664215998E-02
   9.18484996200,   -0.04588601823,   13.58916999158,  8, -2078,  2.31927625303356E-03
  13.63341568476,   -0.23773931301,  -44.10220852494,  9, -287,  1.27459896645223E-01
  13.71880577217,    0.03711707904,    3.61233774140,  10,  6495,  5.62816955896931E-04
  27.09267692660,    0.06467716779,    0.56014062688,  11,  1991,  3.09295406008444E-03
  13.66083077700,    0.43919393727,    2.36000569034,  12,  39,  3.15782757230179E-01
1616.30271425126,   -0.04880377513,    4.81649450548,  13, -27194,  1.80130389316582E-04
  13.60611040750,    0.13223404763,    1.30015735049,  14,  1268,  9.66432079617568E-03
  27.44323926226,    0.09173475541,   -7.12170714280,  15,  1903,  4.57954183779169E-03
  27.66676714572,   -0.08490458014,   -3.40118646425,  16, -1274,  7.22943925364544E-03
---- LTE ----
   0.00380590812 :trend:
   0.00000796061 :accel:
   0.09086708544 :K0:
  -7.69461291679 :level:
   0.59161573661,    0.29568422118,   -0.18474635780 1
   1.18323147322,    0.69704181615,   -0.42133645279 2
   3.54969441966,    0.75266351413,    2.71714731388 6
  10.64908325898,    0.41198308505,   -0.90993253699 18
 153.22847578199,    0.26728477420,    0.01394377949 259

DTW 0.6131801911 0.7817081388 8 1
PS C:\Users\pp\scratch\na\run> ..\restore mono_nino34_part_1920_1980_excl_asym3

excluded
image

  -9.38689118723 :offset:
 105.67652811417 :bg:
   0.13153810119 :impA:
 -18.45727266410 :impB:
  12.89820510509 :impC:
  -0.51862602310:delA:
   0.21881111535:delB:
  -0.51778358862:asym:
  -0.19195103778:ann1:
   8.61042660640:ann2:
   0.19837540958:sem1:
   0.36897881357:sem2:
   0.00016144111:year:
  -0.45047513997:IR:
  -0.01402800800 :mA:
  -0.00545309083 :mP:
  -0.43462480671 :shiftT:
   0.12095879884 :init:
---- Tidal ----
  27.32166155400,   -0.02351385401,  -16.27125982768,  1, -13433,  1.76356181782067E-04
  27.21222081500,   -0.04288700357,    3.55047529524,  2, -3349,  1.32018604870843E-03
  27.10365333842,    0.06156500624,  -12.47937521118,  3,  2616,  2.26683748305482E-03
6793.47648813065,   -0.01941125618,   -0.52715546618,  4, -2793,  7.20730041974031E-04
3396.73824406533,   -0.06805964023,    2.49904379959,  5, -51409,  1.32647102305794E-04
  27.55454988600,   -4.18477650630,   -0.96461828207,  6, -4987,  8.56291868681121E-02
  13.77727494300,   -0.58536596702,    1.55658053507,  7, -4485,  1.33483664215998E-02
   9.18484996200,   -0.04885726874,   13.75277454642,  8, -2207,  2.31927625303356E-03
  13.63341568476,   -0.25875252935,  -44.09141189586,  9, -303,  1.27459896645223E-01
  13.71880577217,    0.04131489186,    3.26613204117,  10,  7241,  5.62816955896931E-04
  27.09267692660,    0.05865656004,    0.44240113967,  11,  1796,  3.09295406008444E-03
  13.66083077700,    0.43540489549,    2.35419947368,  12,  38,  3.15782757230179E-01
1616.30271425126,   -0.04416800046,    4.82934190333,  13, -24620,  1.80130389316582E-04
  13.60611040750,    0.13462664037,    1.29782197617,  14,  1293,  9.66432079617568E-03
  27.44323926226,    0.09167704313,   -7.10913391882,  15,  1902,  4.57954183779169E-03
  27.66676714572,   -0.08127619086,   -3.30254462450,  16, -1224,  7.22943925364544E-03
---- LTE ----
   0.00012719499 :trend:
  -0.00000617852 :accel:
   0.17845098581 :K0:
  -0.63487320249 :level:
   0.59300471091,    0.38699340129,    0.18825682514 1
   1.18600942181,    0.52810985758,   -0.11051974214 2
   3.55802826544,    0.31669154942,    2.68598190277 6
  10.67408479631,    0.34546879536,    0.04883882628 18
 153.58822012467,    0.25425588762,    1.80764856209 259

DTW 0.8003718688 0.6046423179 4 1
PS C:\Users\pp\scratch\na\run> ..\backup mono_nino34_part_1920_1980_excl_asym3_excl

image

  -9.38675420574 :offset:
 105.43172304182 :bg:
   0.23021287293 :impA:
  -5.65048372583 :impB:
  13.03688698639 :impC:
  -0.51981693623:delA:
   0.21881111535:delB:
  -0.51630944293:asym:
  -0.11904625750:ann1:
   8.24631636771:ann2:
   0.08634351413:sem1:
   0.65525206907:sem2:
   0.00015778224:year:
  -0.49633060440:IR:
  -0.02035330823 :mA:
   0.00545437307 :mP:
  -0.40228834320 :shiftT:
   0.06124349551 :init:
---- Tidal ----
  27.32166155400,   -0.02399066670,  -16.27641734459,  1, -13704,  1.76356181782067E-04
  27.21222081500,   -0.04307280956,    3.55698323265,  2, -3363,  1.32018604870843E-03
  27.10365333842,    0.06162551076,  -12.48046747738,  3,  2619,  2.26683748305482E-03
6793.47648813065,   -0.01944769202,   -0.56320805841,  4, -2798,  7.20730041974031E-04
3396.73824406533,   -0.06681593313,    2.49855910214,  5, -50471,  1.32647102305794E-04
  27.55454988600,   -4.18385727863,   -0.96431884470,  6, -4986,  8.56291868681121E-02
  13.77727494300,   -0.58628302595,    1.44914906544,  7, -4492,  1.33483664215998E-02
   9.18484996200,   -0.05197055423,   13.67617805277,  8, -2341,  2.31927625303356E-03
  13.63341568476,   -0.25918174518,  -44.07106722530,  9, -303,  1.27459896645223E-01
  13.71880577217,    0.04457390903,    3.37052279011,  10,  7820,  5.62816955896931E-04
  27.09267692660,    0.05026747034,    0.04331332799,  11,  1525,  3.09295406008444E-03
  13.66083077700,    0.43278938413,    2.34295527660,  12,  37,  3.15782757230179E-01
1616.30271425126,   -0.04178482787,    5.15921556671,  13, -23297,  1.80130389316582E-04
  13.60611040750,    0.13002695938,    1.27777222441,  14,  1245,  9.66432079617568E-03
  27.44323926226,    0.08833731523,   -7.22228181328,  15,  1829,  4.57954183779169E-03
  27.66676714572,   -0.08858491918,   -3.03967034730,  16, -1325,  7.22943925364544E-03
---- LTE ----
   0.00114789308 :trend:
  -0.00000812799 :accel:
   0.16900142887 :K0:
  -2.66638530350 :level:
  -0.59358222129,    0.41773594163,    2.92527417872 1
  -1.18716444258,    0.45404745181,   -2.73901061401 2
  -3.56149332774,    0.54795215828,    0.96119163614 6
 -10.68447998321,    0.42635705652,   -1.74627536885 18

DTW 0.7737300057 0.5512873675 7 1
PS C:\Users\pp\scratch\na\run> ..\backup mono_nino34_part_1920_1980_excl_asym3_exc2

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