LTE multiple linear regression on latent layers

Paul Pukite's climate and geosciences sites

LTE multiple linear regression on latent layers


πŸ“– About


πŸ› οΈ How to Use

  1. 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:


πŸ“ˆ 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:


🧭 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:


NINO34

description: NINO34 => NINO34 in PACIFIC

NINO34

config location

NINO4

description: NINO4 => NINO4 in PACIFIC

NINO4

config location

1

description: Brest => BREST in FRANCE

1

config location

127

description: Seattle => SEATTLE in UNITED STATES

127

config location

183

description: Portland (ME) => PORTLAND (MAINE) in UNITED STATES

183

config location

245

description: Los Angeles => LOS ANGELES in UNITED STATES

245

config location

76

description: Aarhus => AARHUS in DENMARK

76

config location

DARWIN

description: SOI at Darwin => Darwin SOI in PACIFIC

DARWIN

config location

IOD

description: Indian Ocean Dipole => IOD in INDIAN

IOD

config location

M6

description: M6, Atlantic Nino => M6, Atlantic Nino in ATLANTIC

M6

config location

TNA

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

TNA

config location

10

description: San Francisco => SAN FRANCISCO in UNITED STATES

10

config location

14

description: Helsinki => HELSINKI in FINLAND

14

config location

202

description: Newlyn => NEWLYN in UNITED KINGDOM

202

config location

246

description: Pensacola => PENSACOLA in UNITED STATES

246

config location

78

description: Stockholm => STOCKHOLM in SWEDEN

78

config location

DENISON

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

DENISON

config location

IODE

description: Indian Ocean Dipole East => IOD East in INDIAN

IODE

config location

NAO

description: North Atlantic Oscillation => NAO in ATLANTIC

NAO

config location

TSA

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

TSA

config location

11

description: Warnemunde => WARNEMUNDE 2 in GERMANY

11

config location

155

description: Honolulu => HONOLULU in UNITED STATES

155

config location

225

description: Ketchikan => KETCHIKAN in UNITED STATES

225

config location

154

description: Trieste => TRIESTE in ITALY

154

config location

229

description: Kemi => KEMI in FINLAND

229

config location

256

description: La Jolla => LA JOLLA (SCRIPPS PIER) in UNITED STATES

256

config location

AMO

description: Atlantic Multidecadal Oscillation => AMO in ATLANTIC

AMO

config location

EMI

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

EMI

config location

IODW

description: Indian Ocean Dipole West => IOD West in INDIAN

IODW

config location

NINO12

description: NINO12 => NINO12 in PACIFIC

NINO12

config location

PDO

description: Pacific Decadal Oscillation => PDO in PACIFIC

PDO

config location

111

description: Fremantle => FREMANTLE in AUSTRALIA

111

config location

161

description: Galveston => GALVESTON II, PIER 21, TX in UNITED STATES

161

config location

234

description: Charleston => CHARLESTON I in UNITED STATES

234

config location

41

description: Poti => POTI in GEORGIA

41

config location

AO

description: Arctic Oscillation => AO in ARCTIC

AO

config location

IC3TSFC

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

IC3TSFC

config location

M4

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

M4

config location

NINO3

description: NINO3 => NINO3 in PACIFIC

NINO3

config location

QBO30

description: Quasi Biennial Oscillation at 30hBar => QBO 30 Equatorial in WORLD

QBO30

config location

7

description: Cuxhaven => CUXHAVEN 2 in GERMANY

7

config location

8

description: Wismar => WISMAR 2 in GERMANY

8

config location

42

description: Sevastopol => in

42

config location

113

description: Korsor => KORSOR in DENMARK

113

config location

119

description: Hornbaek => HORNBAEK in DENMARK

119

config location

172

description: Mantyluo => MANTYLUOTO in FINLAND

172

config location

179

description: Smogen => SMOGEN in SWEDEN

179

config location

194

description: Pietarsaari => PIETARSAARI / JAKOBSTAD in FINLAND

194

config location

2

description: Swinoujscie => SWINOUJSCIE in POLAND

2

config location

20

description: Vlissingen => VLISSINGEN in NETHERLANDS

20

config location

203

description: Furuogrund => FURUOGRUND in SWEDEN

203

config location

22

description: Hoek Van Holland => HOEK VAN HOLLAND in NETHERLANDS

22

config location

23

description: Den Helder => DEN HELDER in NETHERLANDS

23

config location

236

description: West-Terschelling => WEST-TERSCHELLING in NETHERLANDS

236

config location

239

description: Turku => TURKU / ABO in FINLAND

239

config location

24

description: Delfzijl => DELFZIJL in NETHERLANDS

24

config location

240

description: Raahe => RAAHE / BRAHESTAD in FINLAND

240

config location

249

description: Foglo => FOGLO / DEGERBY in Ã…LAND ISLANDS

249

config location

25

description: Harlingen => HARLINGEN in NETHERLANDS

25

config location

285

description: Kaskinen => KASKINEN / KASKO in FINLAND

285

config location

302

description: Tregde => TREGDE in NORWAY

302

config location

32

description: Ijmuiden => IJMUIDEN in NETHERLANDS

32

config location

33

description: Oscarsborg => OSCARSBORG in NORWAY

33

config location

330

description: KLAGSHAMN => KLAGSHAMN in SWEDEN

330

config location

47

description: Stavanger => STAVANGER in NORWAY

47

config location

5

description: Holyhead => HOLYHEAD in UNITED KINGDOM

5

config location

57

description: Vaasa => VAASA / VASA in FINLAND

57

config location

58

description: Bergen => BERGEN in NORWAY

58

config location

62

description: Oslo => OSLO in NORWAY

62

config location

68

description: Landsort => LANDSORT in SWEDEN

68

config location

69

description: Olands => OLANDS NORRA UDDE in SWEDEN

69

config location

70

description: Kungholmsfort => KUNGSHOLMSFORT in SWEDEN

70

config location

71

description: Hanko => HANKO / HANGO in FINLAND

71

config location

72

description: Ystad => YSTAD in SWEDEN

72

config location

73

description: Varberg => VARBERG in SWEDEN

73

config location

79

description: Oulu => OULU / ULEABORG in FINLAND

79

config location

80

description: Esbjerg => ESBJERG in DENMARK

80

config location

81

description: Fredericia => FREDERICIA in DENMARK

81

config location

82

description: Kobenhavn => KOBENHAVN in DENMARK

82

config location

88

description: Ratan => RATAN in SWEDEN

88

config location

89

description: Hirtshals => HIRTSHALS in DENMARK

89

config location

91

description: Frederikshavn => FREDERIKSHAVN in DENMARK

91

config location

95

description: North Shields => NORTH SHIELDS in UNITED KINGDOM

95

config location

98

description: Slipshavn => SLIPSHAVN in DENMARK

98

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

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