LTE multiple linear regression on latent layers
📖 About
🛠️ How to Use
- Clone this repository:
git clone https://github.com/pukpr/pukpr.github.io
$env:max_iters=3
$env:align=1
$env:PYPATH=".."
python3 ..\lte_mlr.py ts.dat --cc --random --low 1940 --high 1970
📊 MLR common-mode analysis (model parameters)
The numbered subdirectories under examples/mlr/ contain optimized MLR model
parameters for each station. The script below summarizes the common-mode
parameter set shared across stations and the station-by-station excursions
relative to that common baseline. It works entirely from the model parameters
(not the raw data), which makes it easier to compare parametric excursions.
Run it from the repository root:
python3 examples/mlr/common_mode_analysis.py \
--params-root examples/mlr \
--station-metadata examples/IDCodeName.txt \
--out-dir results/common_mode_mlr
Outputs:
results/common_mode_mlr/common_mode_periods.csv— shared harmonic periods.results/common_mode_mlr/common_mode_params.csv— overall parameter means and spread.results/common_mode_mlr/station_excursions.csv— each station’s parameter deviations from the common-mode baseline.results/common_mode_mlr/top_excursions.csv— largest station excursions per parameter/period to highlight where deviations are strongest.
📈 Common-mode forcing time-series analysis
The fitted output CSVs include a latent forcing column that reflects the shared forcing contribution (the modeled latent layer used across stations). To visualize the shared forcing and group stations by similar MLR parameters, run:
python3 examples/mlr/common_mode_forcing_analysis.py \
--data-root examples/mlr \
--out-dir results/common_mode_forcing \
--groups 4 \
--low 1940 \
--high 1970
Outputs:
results/common_mode_forcing/common_mode_forcing.png— grouped forcing time-series plot.results/common_mode_forcing/common_mode_forcing_timeseries.csv— mean forcing per group.results/common_mode_forcing/forcing_group_assignments.csv— station-to-group mapping.
🧭 Common-mode forcing fit workflow
To fit station-specific g() responses against an analytic common forcing (sample-and-hold + alias), run the alternative common-mode forcing fit script:
python3 examples/mlr/common_mode_forcing_fit.py \
--data-root examples/mlr \
--out-dir results/common_mode_forcing_fit \
--low 1940 \
--high 1970 \
--shift-candidates "0.0 0.5 -0.5" \
--dtw-weight 0.0
Outputs:
results/common_mode_forcing_fit/*_common_forcing_fit.csv— per-station time, observed, model, forcing, residual.results/common_mode_forcing_fit/*_common_forcing_fit.json— fitted coefficients and metrics.results/common_mode_forcing_fit/common_mode_forcing_fit_summary.csv— summary of fitted metrics across stations.
NINO34
description: NINO34 => NINO34 in PACIFIC

| config | location |
NINO4
description: NINO4 => NINO4 in PACIFIC

| config | location |
1
description: Brest => BREST in FRANCE

| config | location |
127
description: Seattle => SEATTLE in UNITED STATES

| config | location |
183
description: Portland (ME) => PORTLAND (MAINE) in UNITED STATES

| config | location |
245
description: Los Angeles => LOS ANGELES in UNITED STATES

| config | location |
76
description: Aarhus => AARHUS in DENMARK

| config | location |
DARWIN
description: SOI at Darwin => Darwin SOI in PACIFIC

| config | location |
IOD
description: Indian Ocean Dipole => IOD in INDIAN

| config | location |
M6
description: M6, Atlantic Nino => M6, Atlantic Nino in ATLANTIC

| config | location |
TNA
description: Tropical North Atlantic Oscillation => TNA Tropical N. Atlantic in ATLANTIC

| config | location |
10
description: San Francisco => SAN FRANCISCO in UNITED STATES

| config | location |
14
description: Helsinki => HELSINKI in FINLAND

| config | location |
202
description: Newlyn => NEWLYN in UNITED KINGDOM

| config | location |
246
description: Pensacola => PENSACOLA in UNITED STATES

| config | location |
78
description: Stockholm => STOCKHOLM in SWEDEN

| config | location |
DENISON
description: MSL at Ft. Denison, Sydney – sites 196+65 => Ft Denison in PACIFIC

| config | location |
IODE
description: Indian Ocean Dipole East => IOD East in INDIAN

| config | location |
NAO
description: North Atlantic Oscillation => NAO in ATLANTIC

| config | location |
TSA
description: Tropical South Atlantic Oscillation => TSA Tropical S. Atlantic in ATLANTIC

| config | location |
11
description: Warnemunde => WARNEMUNDE 2 in GERMANY

| config | location |
155
description: Honolulu => HONOLULU in UNITED STATES

| config | location |
225
description: Ketchikan => KETCHIKAN in UNITED STATES

| config | location |
154
description: Trieste => TRIESTE in ITALY

| config | location |
229
description: Kemi => KEMI in FINLAND

| config | location |
256
description: La Jolla => LA JOLLA (SCRIPPS PIER) in UNITED STATES

| config | location |
AMO
description: Atlantic Multidecadal Oscillation => AMO in ATLANTIC

| config | location |
EMI
description: Wl Nino Modoki => EMI ENSO Modoki Index in PACIFIC

| config | location |
IODW
description: Indian Ocean Dipole West => IOD West in INDIAN

| config | location |
NINO12
description: NINO12 => NINO12 in PACIFIC

| config | location |
PDO
description: Pacific Decadal Oscillation => PDO in PACIFIC

| config | location |
111
description: Fremantle => FREMANTLE in AUSTRALIA

| config | location |
161
description: Galveston => GALVESTON II, PIER 21, TX in UNITED STATES

| config | location |
234
description: Charleston => CHARLESTON I in UNITED STATES

| config | location |
41
description: Poti => POTI in GEORGIA

| config | location |
AO
description: Arctic Oscillation => AO in ARCTIC

| config | location |
IC3TSFC
description: ENSO reconstruction between 210-220 longitude => ic3tsfc (Reconstruction) in PACIFIC

| config | location |
M4
description: M4, North Pacific Gyre Oscillation => M4, N. Pacific Gyre Oscillation in PACIFIC

| config | location |
NINO3
description: NINO3 => NINO3 in PACIFIC

| config | location |
QBO30
description: Quasi Biennial Oscillation at 30hBar => QBO 30 Equatorial in WORLD

| config | location |
7
description: Cuxhaven => CUXHAVEN 2 in GERMANY

| config | location |
8
description: Wismar => WISMAR 2 in GERMANY

| config | location |
42
description: Sevastopol => in

| config | location |
113
description: Korsor => KORSOR in DENMARK

| config | location |
119
description: Hornbaek => HORNBAEK in DENMARK

| config | location |
172
description: Mantyluo => MANTYLUOTO in FINLAND

| config | location |
179
description: Smogen => SMOGEN in SWEDEN

| config | location |
194
description: Pietarsaari => PIETARSAARI / JAKOBSTAD in FINLAND

| config | location |
2
description: Swinoujscie => SWINOUJSCIE in POLAND

| config | location |
20
description: Vlissingen => VLISSINGEN in NETHERLANDS

| config | location |
203
description: Furuogrund => FURUOGRUND in SWEDEN

| config | location |
22
description: Hoek Van Holland => HOEK VAN HOLLAND in NETHERLANDS

| config | location |
23
description: Den Helder => DEN HELDER in NETHERLANDS

| config | location |
236
description: West-Terschelling => WEST-TERSCHELLING in NETHERLANDS

| config | location |
239
description: Turku => TURKU / ABO in FINLAND

| config | location |
24
description: Delfzijl => DELFZIJL in NETHERLANDS

| config | location |
240
description: Raahe => RAAHE / BRAHESTAD in FINLAND

| config | location |
249
description: Foglo => FOGLO / DEGERBY in Ã…LAND ISLANDS

| config | location |
25
description: Harlingen => HARLINGEN in NETHERLANDS

| config | location |
285
description: Kaskinen => KASKINEN / KASKO in FINLAND

| config | location |
302
description: Tregde => TREGDE in NORWAY

| config | location |
32
description: Ijmuiden => IJMUIDEN in NETHERLANDS

| config | location |
33
description: Oscarsborg => OSCARSBORG in NORWAY

| config | location |
330
description: KLAGSHAMN => KLAGSHAMN in SWEDEN

| config | location |
47
description: Stavanger => STAVANGER in NORWAY

| config | location |
5
description: Holyhead => HOLYHEAD in UNITED KINGDOM

| config | location |
57
description: Vaasa => VAASA / VASA in FINLAND

| config | location |
58
description: Bergen => BERGEN in NORWAY

| config | location |
62
description: Oslo => OSLO in NORWAY

| config | location |
68
description: Landsort => LANDSORT in SWEDEN

| config | location |
69
description: Olands => OLANDS NORRA UDDE in SWEDEN

| config | location |
70
description: Kungholmsfort => KUNGSHOLMSFORT in SWEDEN

| config | location |
71
description: Hanko => HANKO / HANGO in FINLAND

| config | location |
72
description: Ystad => YSTAD in SWEDEN

| config | location |
73
description: Varberg => VARBERG in SWEDEN

| config | location |
79
description: Oulu => OULU / ULEABORG in FINLAND

| config | location |
80
description: Esbjerg => ESBJERG in DENMARK

| config | location |
81
description: Fredericia => FREDERICIA in DENMARK

| config | location |
82
description: Kobenhavn => KOBENHAVN in DENMARK

| config | location |
88
description: Ratan => RATAN in SWEDEN

| config | location |
89
description: Hirtshals => HIRTSHALS in DENMARK

| config | location |
91
description: Frederikshavn => FREDERIKSHAVN in DENMARK

| config | location |
95
description: North Shields => NORTH SHIELDS in UNITED KINGDOM

| config | location |
98
description: Slipshavn => SLIPSHAVN in DENMARK

| config | location |
$name="183"
$name1=$name + "d"
cp data\$name1.dat .\$name\ts.dat
cp data\$name1.dat.p .\$name\ts.dat.p
cd $name
python3 ..\lte_mlr.py ts.dat --cc --random --low 1940 --high 1970
cd ..
cp nino34\index.md $name
- nino34 — NINO34 (PACIFIC)
- nino4 — NINO4 (PACIFIC)
- amo — AMO (ATLANTIC)
- ao — AO (ARCTIC)
- denison — Ft Denison (PACIFIC)
- iod — IOD (INDIAN)
- iodw — IOD West (INDIAN)
- iode — IOD East (INDIAN)
- nao — NAO (ATLANTIC)
- tna — TNA Tropical N. Atlantic (ATLANTIC)
- tsa — TSA Tropical S. Atlantic (ATLANTIC)
- qbo30 — QBO 30 Equatorial (WORLD)
- darwin — Darwin SOI (PACIFIC)
- emi — EMI ENSO Modoki Index (PACIFIC)
- ic3tsfc — ic3tsfc (Reconstruction) (PACIFIC)
- m6 — M6, Atlantic Nino (ATLANTIC)
- m4 — M4, N. Pacific Gyre Oscillation (PACIFIC)
- pdo — PDO (PACIFIC)
- nino3 — NINO3 (PACIFIC)
- nino12 — NINO12 (PACIFIC)
- 1 — BREST (FRANCE)
- 7 — CUXHAVEN 2 (GERMANY)
- 8 — WISMAR 2 (GERMANY)
- 10 — SAN FRANCISCO (UNITED STATES)
- 11 — WARNEMUNDE 2 (GERMANY)
- 14 — HELSINKI (FINLAND)
- 41 — POTI (GEORGIA)
- 65 — SYDNEY, FORT DENISON (AUSTRALIA)
- 76 — AARHUS (DENMARK)
- 78 — STOCKHOLM (SWEDEN)
- 111 — FREMANTLE (AUSTRALIA)
- 127 — SEATTLE (UNITED STATES)
- 154 — TRIESTE (ITALY)
- 155 — HONOLULU (UNITED STATES)
- 158 — SAN DIEGO (QUARANTINE STATION) (UNITED STATES)
- 161 — GALVESTON II, PIER 21, TX (UNITED STATES)
- 163 — BALBOA (PANAMA)
- 183 — PORTLAND (MAINE) (UNITED STATES)
- 188 — KEY WEST (UNITED STATES)
- 196 — SYDNEY, FORT DENISON 2 (AUSTRALIA)
- 202 — NEWLYN (UNITED KINGDOM)
- 225 — KETCHIKAN (UNITED STATES)
- 229 — KEMI (FINLAND)
- 234 — CHARLESTON I (UNITED STATES)
- 235 — BOSTON (UNITED STATES)
- 245 — LOS ANGELES (UNITED STATES)
- 246 — PENSACOLA (UNITED STATES)
- 256 — LA JOLLA (SCRIPPS PIER) (UNITED STATES)
- 2 — SWINOUJSCIE (POLAND)
- 3 — SHEERNESS (UNITED KINGDOM)
- 5 — HOLYHEAD (UNITED KINGDOM)
- 9 — MAASSLUIS (NETHERLANDS)
- 12 — NEW YORK (THE BATTERY) (UNITED STATES)
- 13 — TRAVEMUNDE (GERMANY)
- 20 — VLISSINGEN (NETHERLANDS)
- 22 — HOEK VAN HOLLAND (NETHERLANDS)
- 23 — DEN HELDER (NETHERLANDS)
- 24 — DELFZIJL (NETHERLANDS)
- 25 — HARLINGEN (NETHERLANDS)
- 32 — IJMUIDEN (NETHERLANDS)
- 33 — OSCARSBORG (NORWAY)
- 34 — TRONDHEIM (NORWAY)
- 47 — STAVANGER (NORWAY)
- 57 — VAASA / VASA (FINLAND)
- 58 — BERGEN (NORWAY)
- 59 — GENOVA (ITALY)
- 62 — OSLO (NORWAY)
- 68 — LANDSORT (SWEDEN)
- 69 — OLANDS NORRA UDDE (SWEDEN)
- 70 — KUNGSHOLMSFORT (SWEDEN)
- 71 — HANKO / HANGO (FINLAND)
- 72 — YSTAD (SWEDEN)
- 73 — VARBERG (SWEDEN)
- 79 — OULU / ULEABORG (FINLAND)
- 80 — ESBJERG (DENMARK)
- 81 — FREDERICIA (DENMARK)
- 82 — KOBENHAVN (DENMARK)
- 88 — RATAN (SWEDEN)
- 89 — HIRTSHALS (DENMARK)
- 91 — FREDERIKSHAVN (DENMARK)
- 95 — NORTH SHIELDS (UNITED KINGDOM)
- 98 — SLIPSHAVN (DENMARK)
- 113 — KORSOR (DENMARK)
- 119 — HORNBAEK (DENMARK)
- 120 — GEDSER (DENMARK)
- 172 — MANTYLUOTO (FINLAND)
- 179 — SMOGEN (SWEDEN)
- 194 — PIETARSAARI / JAKOBSTAD (FINLAND)
- 203 — FURUOGRUND (SWEDEN)
- 236 — WEST-TERSCHELLING (NETHERLANDS)
- 239 — TURKU / ABO (FINLAND)
- 240 — RAAHE / BRAHESTAD (FINLAND)
- 249 — FOGLO / DEGERBY (Ã…LAND ISLANDS)
- 285 — KASKINEN / KASKO (FINLAND)
- 302 — TREGDE (NORWAY)
- 330 — KLAGSHAMN (SWEDEN)
- 413 — OOSTENDE (BELGIUM)
python3 ..\..\pysindy\plot_lte_scatter.py --header --out lte.png --lo 1940 --high 1970
python3 ..\..\..\..\python\plot_sinusoids_from_json_with_bars.py --out-ts ts-sin.png --out-bars ts-bar.png --start 1920-01 --end 2030-01 ..\warne.dat.p ts.dat.p
python3 ..\..\pysindy\cc.py --low 1940 --high 1970