Skip to content

Instantly share code, notes, and snippets.

View pukpr's full-sized avatar

Paul Pukite pukpr

View GitHub Profile
@pukpr
pukpr / Tide_sum_minus_offset.adb
Created May 28, 2024 12:17
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
@pukpr
pukpr / Tide_cos.adb
Created May 23, 2024 03:30
Cosine version of tide_sum.adb
-- 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
@pukpr
pukpr / Tide_sum.adb
Last active May 22, 2024 13:53
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
# The command you want to execute
$command = " .\eexp.exe 0.8"
# The name of the output file generated by the command
$generatedFileName = "lte_results.csv"
$generatedDataName = "dlod_compare.csv"
# The base name for the renamed output files
$baseFileName = "lte_results"
$baseDataName = "dlod_compare"
with GNAT.Expect; use GNAT.Expect;
with GNAT.Os_Lib; use GNAT.OS_Lib;
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Exceptions;
with Ada.Integer_Text_IO;
with Ada.Long_Float_Text_IO;
with Ada.Command_Line;
procedure eexp is
Command : constant String := ".\enso_opt.exe r";
@pukpr
pukpr / DTW_Distance.adb
Created December 8, 2023 17:14
Dynamic Time Warping Distance
function DTW_Distance(X, Y: in Data_Pairs; Window_Size: Positive) return Long_Float is
N : Positive := X'Length;
type Real_Array is array(X'First - Window_Size .. X'Last + Window_Size) of Long_Float;
DTW_Current, DTW_Previous : Real_Array := (others => Long_Float'Last);
begin
DTW_Previous(X'First) := 0.0;
for I in X'First .. X'Last loop
DTW_Current(X'First) := Long_Float'Last; -- Reset current row
@pukpr
pukpr / Tide_sum.adb
Created November 2, 2023 00:06
Analytic Tidal Forcing
-- Conventional tidal series summation or superposition of cycles
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
@pukpr
pukpr / MmBasedTidalForcing.json
Created October 20, 2023 04:32
Used for creating a starting forcing for LTE models of ENSO, AMO, PDO, IOD
[
{"tidalPeriod": 9.108, "amplitude": -0.014820348, "phase": 3.84391957},
{"tidalPeriod": 29.531, "amplitude": 0.048620043, "phase": 4.198826064},
{"tidalPeriod": 27.093, "amplitude": 0.039209078, "phase": 2.386027085},
{"tidalPeriod": 7.088, "amplitude": -0.0081541, "phase": 0.534672975},
{"tidalPeriod": 6.852, "amplitude": 0.015271563, "phase": 3.326916493},
{"tidalPeriod": 13.606, "amplitude": 0.00806555, "phase": 1.03909827},
{"tidalPeriod": 13.661, "amplitude": 0.035114496, "phase": 4.264089268},
{"tidalPeriod": 3396.738, "amplitude": 0.017186474, "phase": 3.440142493},
{"tidalPeriod": 9.121, "amplitude": -0.009720772, "phase": 5.684767105},
@pukpr
pukpr / amo_title.html
Last active September 19, 2023 15:20
AMO redefinition
<!DOCTYPE html>
<html>
<head>
<title> Morphing Text Animation </title>
<style>
canvas {
border: 1 px solid black;
} </style>
</head>
<body>
https://chat.openai.com/share/7555f139-f9dc-4788-abbd-6e4b57b86a46