@neaps/tide-predictor 0.3.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["coefficients: Coefficients","result: number[]","modulus","result: any","polynomials: Record<string, number[]>","coefficients","functions: Record<string, (N: number, i: number, omega: number) => number>","amplitudes: number[]","prediction: Prediction","results: Extreme[]","results: TimelinePoint[]","prediction: TimelinePoint","prediction","astro","baseValue: Record<string, number>","baseSpeed: Record<string, number>","u: Record<string, number>[]","f: Record<string, number>[]","uItem: Record<string, number>","fItem: Record<string, number>","corrections: NodeCorrections","results: number[]","astro","coefficients","constituent: Constituent","nodeCorrections","coefficients: number[]","coefficients","compoundConstituent: CompoundConstituent","astro","f: number[]","constituents: Partial<Constituents>","constituent","nc","compoundConstituent","items: Date[]","hours: number[]","constituents: InternalHarmonicConstituent[]","constituentModels","harmonics: Harmonics","prediction","constituents","harmonics"],"sources":["../src/astronomy/constants.ts","../src/astronomy/coefficients.ts","../src/astronomy/index.ts","../src/harmonics/prediction.ts","../src/node-corrections/index.ts","../src/constituents/constituent.ts","../src/constituents/compound-constituent.ts","../src/constituents/index.ts","../src/harmonics/index.ts","../src/index.ts"],"sourcesContent":["export const d2r = Math.PI / 180.0;\nexport const r2d = 180.0 / Math.PI;\n","// Convert a sexagesimal angle into decimal degrees\nconst sexagesimalToDecimal = (\n degrees: number,\n arcmins: number = 0,\n arcsecs: number = 0,\n mas: number = 0,\n muas: number = 0,\n): number => {\n return (\n degrees +\n arcmins / 60.0 +\n arcsecs / (60.0 * 60.0) +\n mas / (60.0 * 60.0 * 1e3) +\n muas / (60.0 * 60.0 * 1e6)\n );\n};\n\ninterface Coefficients {\n terrestrialObliquity: number[];\n solarPerigee: number[];\n solarLongitude: number[];\n lunarInclination: number[];\n lunarLongitude: number[];\n lunarNode: number[];\n lunarPerigee: number[];\n}\n\nconst coefficients: Coefficients = {\n // Meeus formula 21.3\n terrestrialObliquity: [\n sexagesimalToDecimal(23, 26, 21.448),\n -sexagesimalToDecimal(0, 0, 4680.93),\n -sexagesimalToDecimal(0, 0, 1.55),\n sexagesimalToDecimal(0, 0, 1999.25),\n -sexagesimalToDecimal(0, 0, 51.38),\n -sexagesimalToDecimal(0, 0, 249.67),\n -sexagesimalToDecimal(0, 0, 39.05),\n sexagesimalToDecimal(0, 0, 7.12),\n sexagesimalToDecimal(0, 0, 27.87),\n sexagesimalToDecimal(0, 0, 5.79),\n sexagesimalToDecimal(0, 0, 2.45),\n ].map((number, index) => {\n return number * Math.pow(1e-2, index);\n }),\n\n solarPerigee: [280.46645 - 357.5291, 36000.76932 - 35999.0503, 0.0003032 + 0.0001559, 0.00000048],\n\n solarLongitude: [280.46645, 36000.76983, 0.0003032],\n\n lunarInclination: [5.145],\n\n lunarLongitude: [218.3164591, 481267.88134236, -0.0013268, 1 / 538841.0 - 1 / 65194000.0],\n\n lunarNode: [125.044555, -1934.1361849, 0.0020762, 1 / 467410.0, -1 / 60616000.0],\n\n lunarPerigee: [83.353243, 4069.0137111, -0.0103238, -1 / 80053.0, 1 / 18999000.0],\n};\n\nexport default coefficients;\nexport { sexagesimalToDecimal };\nexport type { Coefficients };\n","import { d2r, r2d } from \"./constants.js\";\nimport coefficients from \"./coefficients.js\";\n\nexport interface AstroValue {\n value: number;\n speed: number;\n}\n\nexport interface AstroData {\n s: AstroValue;\n h: AstroValue;\n p: AstroValue;\n N: AstroValue;\n pp: AstroValue;\n \"90\": AstroValue;\n omega: AstroValue;\n i: AstroValue;\n I: AstroValue;\n xi: AstroValue;\n nu: AstroValue;\n nup: AstroValue;\n nupp: AstroValue;\n \"T+h-s\": AstroValue;\n P: AstroValue;\n}\n\n// Evaluates a polynomial at argument\nconst polynomial = (coefficients: number[], argument: number): number => {\n const result: number[] = [];\n coefficients.forEach((coefficient, index) => {\n result.push(coefficient * Math.pow(argument, index));\n });\n return result.reduce((a, b) => a + b);\n};\n\n// Evaluates a derivative polynomial at argument\nconst derivativePolynomial = (coefficients: number[], argument: number): number => {\n const result: number[] = [];\n coefficients.forEach((coefficient, index) => {\n result.push(coefficient * index * Math.pow(argument, index - 1));\n });\n return result.reduce((a, b) => a + b);\n};\n\n// Meeus formula 11.1\nconst T = (t: Date): number => {\n return (JD(t) - 2451545.0) / 36525;\n};\n\n// Meeus formula 7.1\nconst JD = (t: Date): number => {\n let Y = t.getUTCFullYear();\n let M = t.getUTCMonth() + 1;\n const D =\n t.getUTCDate() +\n t.getUTCHours() / 24.0 +\n t.getUTCMinutes() / (24.0 * 60.0) +\n t.getUTCSeconds() / (24.0 * 60.0 * 60.0) +\n t.getUTCMilliseconds() / (24.0 * 60.0 * 60.0 * 1e6);\n if (M <= 2) {\n Y = Y - 1;\n M = M + 12;\n }\n const A = Math.floor(Y / 100.0);\n const B = 2 - A + Math.floor(A / 4.0);\n return Math.floor(365.25 * (Y + 4716)) + Math.floor(30.6001 * (M + 1)) + D + B - 1524.5;\n};\n\nconst _I = (N: number, i: number, omega: number): number => {\n N = d2r * N;\n i = d2r * i;\n omega = d2r * omega;\n const cosI = Math.cos(i) * Math.cos(omega) - Math.sin(i) * Math.sin(omega) * Math.cos(N);\n return r2d * Math.acos(cosI);\n};\n\nconst _xi = (N: number, i: number, omega: number): number => {\n N = d2r * N;\n i = d2r * i;\n omega = d2r * omega;\n let e1 = (Math.cos(0.5 * (omega - i)) / Math.cos(0.5 * (omega + i))) * Math.tan(0.5 * N);\n let e2 = (Math.sin(0.5 * (omega - i)) / Math.sin(0.5 * (omega + i))) * Math.tan(0.5 * N);\n e1 = Math.atan(e1);\n e2 = Math.atan(e2);\n e1 = e1 - 0.5 * N;\n e2 = e2 - 0.5 * N;\n return -(e1 + e2) * r2d;\n};\n\nconst _nu = (N: number, i: number, omega: number): number => {\n N = d2r * N;\n i = d2r * i;\n omega = d2r * omega;\n let e1 = (Math.cos(0.5 * (omega - i)) / Math.cos(0.5 * (omega + i))) * Math.tan(0.5 * N);\n let e2 = (Math.sin(0.5 * (omega - i)) / Math.sin(0.5 * (omega + i))) * Math.tan(0.5 * N);\n e1 = Math.atan(e1);\n e2 = Math.atan(e2);\n e1 = e1 - 0.5 * N;\n e2 = e2 - 0.5 * N;\n return (e1 - e2) * r2d;\n};\n\n// Schureman equation 224\nconst _nup = (N: number, i: number, omega: number): number => {\n const I = d2r * _I(N, i, omega);\n const nu = d2r * _nu(N, i, omega);\n return (\n r2d * Math.atan((Math.sin(2 * I) * Math.sin(nu)) / (Math.sin(2 * I) * Math.cos(nu) + 0.3347))\n );\n};\n\n// Schureman equation 232\nconst _nupp = (N: number, i: number, omega: number): number => {\n const I = d2r * _I(N, i, omega);\n const nu = d2r * _nu(N, i, omega);\n const tan2nupp =\n (Math.sin(I) ** 2 * Math.sin(2 * nu)) / (Math.sin(I) ** 2 * Math.cos(2 * nu) + 0.0727);\n return r2d * 0.5 * Math.atan(tan2nupp);\n};\n\nconst modulus = (a: number, b: number): number => {\n return ((a % b) + b) % b;\n};\n\nconst astro = (time: Date): AstroData => {\n // This gets cast to `AstroData` later, but we build it up step by step here\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const result: any = {};\n\n const polynomials: Record<string, number[]> = {\n s: coefficients.lunarLongitude,\n h: coefficients.solarLongitude,\n p: coefficients.lunarPerigee,\n N: coefficients.lunarNode,\n pp: coefficients.solarPerigee,\n \"90\": [90.0],\n omega: coefficients.terrestrialObliquity,\n i: coefficients.lunarInclination,\n };\n\n // Polynomials are in T, that is Julian Centuries; we want our speeds to be\n // in the more convenient unit of degrees per hour.\n const dTdHour = 1 / (24 * 365.25 * 100);\n for (const name in polynomials) {\n result[name] = {\n value: modulus(polynomial(polynomials[name], T(time)), 360.0),\n speed: derivativePolynomial(polynomials[name], T(time)) * dTdHour,\n };\n }\n\n // Some other parameters defined by Schureman which are dependent on the\n // parameters N, i, omega for use in node factor calculations. We don't need\n // their speeds.\n const functions: Record<string, (N: number, i: number, omega: number) => number> = {\n I: _I,\n xi: _xi,\n nu: _nu,\n nup: _nup,\n nupp: _nupp,\n };\n Object.keys(functions).forEach((name) => {\n const functionCall = functions[name];\n result[name] = {\n value: modulus(functionCall(result.N.value, result.i.value, result.omega.value), 360.0),\n speed: null,\n };\n });\n\n // We don't work directly with the T (hours) parameter, instead our spanning\n // set for equilibrium arguments #is given by T+h-s, s, h, p, N, pp, 90.\n // This is in line with convention.\n const hour = {\n value: (JD(time) - Math.floor(JD(time))) * 360.0,\n speed: 15.0,\n };\n\n result[\"T+h-s\"] = {\n value: hour.value + result.h.value - result.s.value,\n speed: hour.speed + result.h.speed - result.s.speed,\n };\n\n // It is convenient to calculate Schureman's P here since several node\n // factors need it, although it could be argued that these\n // (along with I, xi, nu etc) belong somewhere else.\n result.P = {\n value: result.p.value - (result.xi.value % 360.0),\n speed: null,\n };\n\n return result as AstroData;\n};\n\nexport default astro;\nexport { polynomial, derivativePolynomial, T, JD, _I, _xi, _nu, _nup, _nupp };\n","import astro from \"../astronomy/index.js\";\nimport { d2r } from \"../astronomy/constants.js\";\nimport type { Constituent } from \"../constituents/constituent.js\";\nimport type { CompoundConstituent } from \"../constituents/compound-constituent.js\";\n\nexport interface Timeline {\n items: Date[];\n hours: number[];\n}\n\nexport interface HarmonicConstituent {\n name: string;\n amplitude: number;\n phase: number;\n speed?: number;\n description?: string;\n}\n\nexport interface InternalHarmonicConstituent extends HarmonicConstituent {\n _model: Constituent | CompoundConstituent;\n}\n\nexport interface TimelinePoint {\n time: Date;\n hour: number;\n level: number;\n}\n\nexport interface Extreme {\n time: Date;\n level: number;\n high: boolean;\n low: boolean;\n label: string;\n}\n\nexport interface ExtremeOffsets {\n height?: {\n high?: number;\n low?: number;\n type?: \"fixed\" | \"ratio\";\n };\n time?: {\n high?: number;\n low?: number;\n };\n}\n\nexport interface ExtremeLabels {\n high?: string;\n low?: string;\n}\n\nexport interface ExtremesOptions {\n labels?: ExtremeLabels;\n offsets?: ExtremeOffsets;\n}\n\nexport interface Prediction {\n getExtremesPrediction: (options?: ExtremesOptions) => Extreme[];\n getTimelinePrediction: () => TimelinePoint[];\n}\n\nconst modulus = (a: number, b: number): number => {\n return ((a % b) + b) % b;\n};\n\nconst addExtremesOffsets = (extreme: Extreme, offsets?: ExtremeOffsets): Extreme => {\n if (typeof offsets === \"undefined\" || !offsets) {\n return extreme;\n }\n\n if (extreme.high && offsets.height?.high) {\n if (offsets.height.type === \"fixed\") {\n extreme.level += offsets.height.high;\n } else {\n extreme.level *= offsets.height.high;\n }\n }\n if (extreme.low && offsets.height?.low) {\n if (offsets.height.type === \"fixed\") {\n extreme.level += offsets.height.low;\n } else {\n extreme.level *= offsets.height.low;\n }\n }\n if (extreme.high && offsets.time?.high) {\n extreme.time = new Date(extreme.time.getTime() + offsets.time.high * 60 * 1000);\n }\n if (extreme.low && offsets.time?.low) {\n extreme.time = new Date(extreme.time.getTime() + offsets.time.low * 60 * 1000);\n }\n return extreme;\n};\n\nconst getExtremeLabel = (label: \"high\" | \"low\", highLowLabels?: ExtremeLabels): string => {\n if (typeof highLowLabels !== \"undefined\" && typeof highLowLabels[label] !== \"undefined\") {\n return highLowLabels[label]!;\n }\n const labels = {\n high: \"High\",\n low: \"Low\",\n };\n return labels[label];\n};\n\ninterface PredictionFactoryParams {\n timeline: Timeline;\n constituents: InternalHarmonicConstituent[];\n start: Date;\n}\n\nconst predictionFactory = ({\n timeline,\n constituents,\n start,\n}: PredictionFactoryParams): Prediction => {\n const getLevel = (\n hour: number,\n modelBaseSpeed: Record<string, number>,\n modelU: Record<string, number>,\n modelF: Record<string, number>,\n modelBaseValue: Record<string, number>,\n ): number => {\n const amplitudes: number[] = [];\n let result = 0;\n\n constituents.forEach((constituent) => {\n const amplitude = constituent.amplitude;\n const phase = constituent.phase;\n const f = modelF[constituent.name];\n const speed = modelBaseSpeed[constituent.name];\n const u = modelU[constituent.name];\n const V0 = modelBaseValue[constituent.name];\n amplitudes.push(amplitude * f * Math.cos(speed * hour + (V0 + u) - phase));\n });\n // sum up each row\n amplitudes.forEach((item) => {\n result += item;\n });\n return result;\n };\n\n const prediction: Prediction = {} as Prediction;\n\n prediction.getExtremesPrediction = (options?: ExtremesOptions): Extreme[] => {\n const { labels, offsets } = typeof options !== \"undefined\" ? options : {};\n const results: Extreme[] = [];\n const { baseSpeed, u, f, baseValue } = prepare();\n let goingUp = false;\n let goingDown = false;\n let lastLevel = getLevel(0, baseSpeed, u[0], f[0], baseValue);\n timeline.items.forEach((time, index) => {\n const hour = timeline.hours[index];\n const level = getLevel(hour, baseSpeed, u[index], f[index], baseValue);\n // Compare this level to the last one, if we\n // are changing angle, then the last one was high or low\n if (level > lastLevel && goingDown) {\n results.push(\n addExtremesOffsets(\n {\n time: timeline.items[index - 1],\n level: lastLevel,\n high: false,\n low: true,\n label: getExtremeLabel(\"low\", labels),\n },\n offsets,\n ),\n );\n }\n if (level < lastLevel && goingUp) {\n results.push(\n addExtremesOffsets(\n {\n time: timeline.items[index - 1],\n level: lastLevel,\n high: true,\n low: false,\n label: getExtremeLabel(\"high\", labels),\n },\n offsets,\n ),\n );\n }\n if (level > lastLevel) {\n goingUp = true;\n goingDown = false;\n }\n if (level < lastLevel) {\n goingUp = false;\n goingDown = true;\n }\n lastLevel = level;\n });\n return results;\n };\n\n prediction.getTimelinePrediction = (): TimelinePoint[] => {\n const results: TimelinePoint[] = [];\n const { baseSpeed, u, f, baseValue } = prepare();\n timeline.items.forEach((time, index) => {\n const hour = timeline.hours[index];\n const prediction: TimelinePoint = {\n time,\n hour,\n level: getLevel(hour, baseSpeed, u[index], f[index], baseValue),\n };\n\n results.push(prediction);\n });\n return results;\n };\n\n const prepare = () => {\n const baseAstro = astro(start);\n\n const baseValue: Record<string, number> = {};\n const baseSpeed: Record<string, number> = {};\n const u: Record<string, number>[] = [];\n const f: Record<string, number>[] = [];\n constituents.forEach((constituent) => {\n const value = constituent._model.value(baseAstro);\n const speed = constituent._model.speed(baseAstro);\n baseValue[constituent.name] = d2r * value;\n baseSpeed[constituent.name] = d2r * speed;\n });\n timeline.items.forEach((time) => {\n const uItem: Record<string, number> = {};\n const fItem: Record<string, number> = {};\n const itemAstro = astro(time);\n constituents.forEach((constituent) => {\n const constituentU = modulus(constituent._model.u(itemAstro), 360);\n\n uItem[constituent.name] = d2r * constituentU;\n fItem[constituent.name] = modulus(constituent._model.f(itemAstro), 360);\n });\n u.push(uItem);\n f.push(fItem);\n });\n\n return {\n baseValue,\n baseSpeed,\n u,\n f,\n };\n };\n\n return Object.freeze(prediction);\n};\n\nexport default predictionFactory;\n","import { d2r, r2d } from \"../astronomy/constants.js\";\nimport type { AstroData } from \"../astronomy/index.js\";\n\nexport type NodeCorrectionFunction = (a: AstroData, ...args: unknown[]) => number;\n\nexport interface NodeCorrections {\n fUnity: () => number;\n fMm: (a: AstroData) => number;\n fMf: (a: AstroData) => number;\n fO1: (a: AstroData) => number;\n fJ1: (a: AstroData) => number;\n fOO1: (a: AstroData) => number;\n fM2: (a: AstroData) => number;\n fK1: (a: AstroData) => number;\n fL2: (a: AstroData) => number;\n fK2: (a: AstroData) => number;\n fM1: (a: AstroData) => number;\n fModd: (a: AstroData, n: number) => number;\n uZero: () => number;\n uMf: (a: AstroData) => number;\n uO1: (a: AstroData) => number;\n uJ1: (a: AstroData) => number;\n uOO1: (a: AstroData) => number;\n uM2: (a: AstroData) => number;\n uK1: (a: AstroData) => number;\n uL2: (a: AstroData) => number;\n uK2: (a: AstroData) => number;\n uM1: (a: AstroData) => number;\n uModd: (a: AstroData, n: number) => number;\n}\n\nconst corrections: NodeCorrections = {\n fUnity(): number {\n return 1;\n },\n\n // Schureman equations 73, 65\n fMm(a: AstroData): number {\n const omega = d2r * a.omega.value;\n const i = d2r * a.i.value;\n const I = d2r * a.I.value;\n const mean =\n (2 / 3.0 - Math.pow(Math.sin(omega), 2)) * (1 - (3 / 2.0) * Math.pow(Math.sin(i), 2));\n return (2 / 3.0 - Math.pow(Math.sin(I), 2)) / mean;\n },\n\n // Schureman equations 74, 66\n fMf(a: AstroData): number {\n const omega = d2r * a.omega.value;\n const i = d2r * a.i.value;\n const I = d2r * a.I.value;\n const mean = Math.pow(Math.sin(omega), 2) * Math.pow(Math.cos(0.5 * i), 4);\n return Math.pow(Math.sin(I), 2) / mean;\n },\n\n // Schureman equations 75, 67\n fO1(a: AstroData): number {\n const omega = d2r * a.omega.value;\n const i = d2r * a.i.value;\n const I = d2r * a.I.value;\n const mean =\n Math.sin(omega) * Math.pow(Math.cos(0.5 * omega), 2) * Math.pow(Math.cos(0.5 * i), 4);\n return (Math.sin(I) * Math.pow(Math.cos(0.5 * I), 2)) / mean;\n },\n\n // Schureman equations 76, 68\n fJ1(a: AstroData): number {\n const omega = d2r * a.omega.value;\n const i = d2r * a.i.value;\n const I = d2r * a.I.value;\n const mean = Math.sin(2 * omega) * (1 - (3 / 2.0) * Math.pow(Math.sin(i), 2));\n return Math.sin(2 * I) / mean;\n },\n\n // Schureman equations 77, 69\n fOO1(a: AstroData): number {\n const omega = d2r * a.omega.value;\n const i = d2r * a.i.value;\n const I = d2r * a.I.value;\n const mean =\n Math.sin(omega) * Math.pow(Math.sin(0.5 * omega), 2) * Math.pow(Math.cos(0.5 * i), 4);\n return (Math.sin(I) * Math.pow(Math.sin(0.5 * I), 2)) / mean;\n },\n\n // Schureman equations 78, 70\n fM2(a: AstroData): number {\n const omega = d2r * a.omega.value;\n const i = d2r * a.i.value;\n const I = d2r * a.I.value;\n const mean = Math.pow(Math.cos(0.5 * omega), 4) * Math.pow(Math.cos(0.5 * i), 4);\n return Math.pow(Math.cos(0.5 * I), 4) / mean;\n },\n\n // Schureman equations 227, 226, 68\n // Should probably eventually include the derivations of the magic numbers (0.5023 etc).\n fK1(a: AstroData): number {\n const omega = d2r * a.omega.value;\n const i = d2r * a.i.value;\n const I = d2r * a.I.value;\n const nu = d2r * a.nu.value;\n const sin2IcosnuMean = Math.sin(2 * omega) * (1 - (3 / 2.0) * Math.pow(Math.sin(i), 2));\n const mean = 0.5023 * sin2IcosnuMean + 0.1681;\n return (\n Math.pow(\n 0.2523 * Math.pow(Math.sin(2 * I), 2) + 0.1689 * Math.sin(2 * I) * Math.cos(nu) + 0.0283,\n 0.5,\n ) / mean\n );\n },\n\n // Schureman equations 215, 213, 204\n // It can be (and has been) confirmed that the exponent for R_a reads 1/2 via Schureman Table 7\n fL2(a: AstroData): number {\n const P = d2r * a.P.value;\n const I = d2r * a.I.value;\n const rAInv = Math.pow(\n 1 -\n 12 * Math.pow(Math.tan(0.5 * I), 2) * Math.cos(2 * P) +\n 36 * Math.pow(Math.tan(0.5 * I), 4),\n 0.5,\n );\n return corrections.fM2(a) * rAInv;\n },\n\n // Schureman equations 235, 234, 71\n // Again, magic numbers\n fK2(a: AstroData): number {\n const omega = d2r * a.omega.value;\n const i = d2r * a.i.value;\n const I = d2r * a.I.value;\n const nu = d2r * a.nu.value;\n const sinsqIcos2nuMean = Math.sin(omega) ** 2 * (1 - (3 / 2.0) * Math.sin(i) ** 2);\n const mean = 0.5023 * sinsqIcos2nuMean + 0.0365;\n return (\n Math.pow(\n 0.2523 * Math.pow(Math.sin(I), 4) +\n 0.0367 * Math.pow(Math.sin(I), 2) * Math.cos(2 * nu) +\n 0.0013,\n 0.5,\n ) / mean\n );\n },\n\n // Schureman equations 206, 207, 195\n fM1(a: AstroData): number {\n const P = d2r * a.P.value;\n const I = d2r * a.I.value;\n const qAInv = Math.pow(\n 0.25 +\n 1.5 * Math.cos(I) * Math.cos(2 * P) * Math.pow(Math.cos(0.5 * I), -0.5) +\n 2.25 * Math.pow(Math.cos(I), 2) * Math.pow(Math.cos(0.5 * I), -4),\n 0.5,\n );\n return corrections.fO1(a) * qAInv;\n },\n\n // See e.g. Schureman equation 149\n fModd(a: AstroData, n: number): number {\n return Math.pow(corrections.fM2(a), n / 2.0);\n },\n\n // Node factors u, see Table 2 of Schureman.\n\n uZero(): number {\n return 0.0;\n },\n\n uMf(a: AstroData): number {\n return -2.0 * a.xi.value;\n },\n\n uO1(a: AstroData): number {\n return 2.0 * a.xi.value - a.nu.value;\n },\n\n uJ1(a: AstroData): number {\n return -a.nu.value;\n },\n\n uOO1(a: AstroData): number {\n return -2.0 * a.xi.value - a.nu.value;\n },\n\n uM2(a: AstroData): number {\n return 2.0 * a.xi.value - 2.0 * a.nu.value;\n },\n\n uK1(a: AstroData): number {\n return -a.nup.value;\n },\n\n // Schureman 214\n uL2(a: AstroData): number {\n const I = d2r * a.I.value;\n const P = d2r * a.P.value;\n const R =\n r2d *\n Math.atan(Math.sin(2 * P) / ((1 / 6.0) * Math.pow(Math.tan(0.5 * I), -2) - Math.cos(2 * P)));\n return 2.0 * a.xi.value - 2.0 * a.nu.value - R;\n },\n\n uK2(a: AstroData): number {\n return -2.0 * a.nupp.value;\n },\n\n // Schureman 202\n uM1(a: AstroData): number {\n const I = d2r * a.I.value;\n const P = d2r * a.P.value;\n const Q = r2d * Math.atan(((5 * Math.cos(I) - 1) / (7 * Math.cos(I) + 1)) * Math.tan(P));\n return a.xi.value - a.nu.value + Q;\n },\n\n uModd(a: AstroData, n: number): number {\n return (n / 2.0) * corrections.uM2(a);\n },\n};\n\nexport default corrections;\n","import nodeCorrections from \"../node-corrections/index.js\";\nimport type { AstroData } from \"../astronomy/index.js\";\nimport type { NodeCorrectionFunction } from \"../node-corrections/index.js\";\n\n/**\n * Computes the dot notation of two arrays\n */\nconst dotArray = (a: number[], b: number[]): number => {\n const results: number[] = [];\n a.forEach((value, index) => {\n results.push(value * b[index]);\n });\n return results.reduce((total, value) => total + value);\n};\n\nconst astronimicDoodsonNumber = (astro: AstroData): AstroData[keyof AstroData][] => {\n return [astro[\"T+h-s\"], astro.s, astro.h, astro.p, astro.N, astro.pp, astro[\"90\"]];\n};\n\nconst astronomicSpeed = (astro: AstroData): number[] => {\n const results: number[] = [];\n astronimicDoodsonNumber(astro).forEach((number) => {\n results.push(number.speed);\n });\n return results;\n};\n\nconst astronomicValues = (astro: AstroData): number[] => {\n const results: number[] = [];\n astronimicDoodsonNumber(astro).forEach((number) => {\n results.push(number.value);\n });\n return results;\n};\n\nexport interface Constituent {\n name: string;\n coefficients: number[];\n value: (astro: AstroData) => number;\n speed: (astro: AstroData) => number;\n u: NodeCorrectionFunction;\n f: NodeCorrectionFunction;\n}\n\nconst constituentFactory = (\n name: string,\n coefficients: number[],\n u?: NodeCorrectionFunction,\n f?: NodeCorrectionFunction,\n): Constituent => {\n if (!coefficients) {\n throw new Error(\"Coefficient must be defined for a constituent\");\n }\n\n const constituent: Constituent = {\n name,\n coefficients,\n\n value: (astro: AstroData): number => {\n return dotArray(coefficients, astronomicValues(astro));\n },\n\n speed(astro: AstroData): number {\n return dotArray(coefficients, astronomicSpeed(astro));\n },\n\n u: typeof u !== \"undefined\" ? u : nodeCorrections.uZero,\n\n f: typeof f !== \"undefined\" ? f : nodeCorrections.fUnity,\n };\n\n return Object.freeze(constituent);\n};\n\nexport default constituentFactory;\nexport { astronimicDoodsonNumber, astronomicSpeed, astronomicValues };\n","import type { Constituent } from \"./constituent.js\";\nimport type { AstroData } from \"../astronomy/index.js\";\n\nexport interface ConstituentMember {\n constituent: Constituent;\n factor: number;\n}\n\nexport interface CompoundConstituent {\n name: string;\n coefficients: number[];\n speed: (astro: AstroData) => number;\n value: (astro: AstroData) => number;\n u: (astro: AstroData) => number;\n f: (astro: AstroData) => number;\n}\n\nconst compoundConstituentFactory = (\n name: string,\n members: ConstituentMember[],\n): CompoundConstituent => {\n const coefficients: number[] = [];\n members.forEach(({ constituent, factor }) => {\n constituent.coefficients.forEach((coefficient, index) => {\n if (typeof coefficients[index] === \"undefined\") {\n coefficients[index] = 0;\n }\n coefficients[index] += coefficient * factor;\n });\n });\n\n const compoundConstituent: CompoundConstituent = {\n name,\n coefficients,\n\n speed: (astro: AstroData): number => {\n let speed = 0;\n members.forEach(({ constituent, factor }) => {\n speed += constituent.speed(astro) * factor;\n });\n return speed;\n },\n\n value: (astro: AstroData): number => {\n let value = 0;\n members.forEach(({ constituent, factor }) => {\n value += constituent.value(astro) * factor;\n });\n return value;\n },\n\n u: (astro: AstroData): number => {\n let u = 0;\n members.forEach(({ constituent, factor }) => {\n u += constituent.u(astro) * factor;\n });\n return u;\n },\n\n f: (astro: AstroData): number => {\n const f: number[] = [];\n members.forEach(({ constituent, factor }) => {\n f.push(Math.pow(constituent.f(astro), Math.abs(factor)));\n });\n return f.reduce((previous, value) => previous * value);\n },\n };\n\n return Object.freeze(compoundConstituent);\n};\n\nexport default compoundConstituentFactory;\n","import constituent from \"./constituent.js\";\nimport compoundConstituent from \"./compound-constituent.js\";\nimport nc from \"../node-corrections/index.js\";\nimport type { Constituent } from \"./constituent.js\";\nimport type { CompoundConstituent } from \"./compound-constituent.js\";\n\nexport interface Constituents {\n Z0: Constituent;\n SA: Constituent;\n SSA: Constituent;\n MM: Constituent;\n MF: Constituent;\n Q1: Constituent;\n O1: Constituent;\n K1: Constituent;\n J1: Constituent;\n M1: Constituent;\n P1: Constituent;\n S1: Constituent;\n OO1: Constituent;\n \"2N2\": Constituent;\n N2: Constituent;\n NU2: Constituent;\n M2: Constituent;\n LAM2: Constituent;\n L2: Constituent;\n T2: Constituent;\n S2: Constituent;\n R2: Constituent;\n K2: Constituent;\n M3: Constituent;\n MSF: CompoundConstituent;\n \"2Q1\": CompoundConstituent;\n RHO: CompoundConstituent;\n MU2: CompoundConstituent;\n \"2SM2\": CompoundConstituent;\n \"2MK3\": CompoundConstituent;\n MK3: CompoundConstituent;\n MN4: CompoundConstituent;\n M4: CompoundConstituent;\n MS4: CompoundConstituent;\n S4: CompoundConstituent;\n M6: CompoundConstituent;\n S6: CompoundConstituent;\n M8: CompoundConstituent;\n [key: string]: Constituent | CompoundConstituent;\n}\n\nconst constituents: Partial<Constituents> = {};\n\n// Long Term\nconstituents.Z0 = constituent(\"Z0\", [0, 0, 0, 0, 0, 0, 0], nc.uZero, nc.fUnity);\nconstituents.SA = constituent(\"Sa\", [0, 0, 1, 0, 0, 0, 0], nc.uZero, nc.fUnity);\nconstituents.SSA = constituent(\"Ssa\", [0, 0, 2, 0, 0, 0, 0], nc.uZero, nc.fUnity);\nconstituents.MM = constituent(\"MM\", [0, 1, 0, -1, 0, 0, 0], nc.uZero, nc.fMm);\nconstituents.MF = constituent(\"MF\", [0, 2, 0, 0, 0, 0, 0], nc.uMf, nc.fMf);\n// Diurnals\nconstituents.Q1 = constituent(\"Q1\", [1, -2, 0, 1, 0, 0, 1], nc.uO1, nc.fO1);\nconstituents.O1 = constituent(\"O1\", [1, -1, 0, 0, 0, 0, 1], nc.uO1, nc.fO1);\nconstituents.K1 = constituent(\"K1\", [1, 1, 0, 0, 0, 0, -1], nc.uK1, nc.fK1);\nconstituents.J1 = constituent(\"J1\", [1, 2, 0, -1, 0, 0, -1], nc.uJ1, nc.fJ1);\nconstituents.M1 = constituent(\"M1\", [1, 0, 0, 0, 0, 0, 1], nc.uM1, nc.fM1);\nconstituents.P1 = constituent(\"P1\", [1, 1, -2, 0, 0, 0, 1], nc.uZero, nc.fUnity);\nconstituents.S1 = constituent(\"S1\", [1, 1, -1, 0, 0, 0, 0], nc.uZero, nc.fUnity);\nconstituents.OO1 = constituent(\"OO1\", [1, 3, 0, 0, 0, 0, -1], nc.uOO1, nc.fOO1);\n// Semi diurnals\nconstituents[\"2N2\"] = constituent(\"2N2\", [2, -2, 0, 2, 0, 0, 0], nc.uM2, nc.fM2);\nconstituents.N2 = constituent(\"N2\", [2, -1, 0, 1, 0, 0, 0], nc.uM2, nc.fM2);\nconstituents.NU2 = constituent(\"NU2\", [2, -1, 2, -1, 0, 0, 0], nc.uM2, nc.fM2);\nconstituents.M2 = constituent(\"M2\", [2, 0, 0, 0, 0, 0, 0], nc.uM2, nc.fM2);\nconstituents.LAM2 = constituent(\"LAM2\", [2, 1, -2, 1, 0, 0, 2], nc.uM2, nc.fM2);\nconstituents.L2 = constituent(\"L2\", [2, 1, 0, -1, 0, 0, 2], nc.uL2, nc.fL2);\nconstituents.T2 = constituent(\"T2\", [2, 2, -3, 0, 0, 1, 0], nc.uZero, nc.fUnity);\nconstituents.S2 = constituent(\"S2\", [2, 2, -2, 0, 0, 0, 0], nc.uZero, nc.fUnity);\nconstituents.R2 = constituent(\"R2\", [2, 2, -1, 0, 0, -1, 2], nc.uZero, nc.fUnity);\nconstituents.K2 = constituent(\"K2\", [2, 2, 0, 0, 0, 0, 0], nc.uK2, nc.fK2);\n// Third diurnal\nconstituents.M3 = constituent(\n \"M3\",\n [3, 0, 0, 0, 0, 0, 0],\n (a) => {\n return nc.uModd(a, 3);\n },\n (a) => {\n return nc.fModd(a, 3);\n },\n);\n// Compound\nconstituents.MSF = compoundConstituent(\"MSF\", [\n { constituent: constituents.S2!, factor: 1 },\n { constituent: constituents.M2!, factor: -1 },\n]);\n\n// Diurnal\nconstituents[\"2Q1\"] = compoundConstituent(\"2Q1\", [\n { constituent: constituents.N2!, factor: 1 },\n { constituent: constituents.J1!, factor: -1 },\n]);\nconstituents.RHO = compoundConstituent(\"RHO\", [\n { constituent: constituents.NU2!, factor: 1 },\n { constituent: constituents.K1!, factor: -1 },\n]);\n\n// Semi-Diurnal\n\nconstituents.MU2 = compoundConstituent(\"MU2\", [\n { constituent: constituents.M2!, factor: 2 },\n { constituent: constituents.S2!, factor: -1 },\n]);\nconstituents[\"2SM2\"] = compoundConstituent(\"2SM2\", [\n { constituent: constituents.S2!, factor: 2 },\n { constituent: constituents.M2!, factor: -1 },\n]);\n\n// Third-Diurnal\nconstituents[\"2MK3\"] = compoundConstituent(\"2MK3\", [\n { constituent: constituents.M2!, factor: 1 },\n { constituent: constituents.O1!, factor: 1 },\n]);\nconstituents.MK3 = compoundConstituent(\"MK3\", [\n { constituent: constituents.M2!, factor: 1 },\n { constituent: constituents.K1!, factor: 1 },\n]);\n\n// Quarter-Diurnal\nconstituents.MN4 = compoundConstituent(\"MN4\", [\n { constituent: constituents.M2!, factor: 1 },\n { constituent: constituents.N2!, factor: 1 },\n]);\nconstituents.M4 = compoundConstituent(\"M4\", [{ constituent: constituents.M2!, factor: 2 }]);\nconstituents.MS4 = compoundConstituent(\"MS4\", [\n { constituent: constituents.M2!, factor: 1 },\n { constituent: constituents.S2!, factor: 1 },\n]);\nconstituents.S4 = compoundConstituent(\"S4\", [{ constituent: constituents.S2!, factor: 2 }]);\n\n// Sixth-Diurnal\nconstituents.M6 = compoundConstituent(\"M6\", [{ constituent: constituents.M2!, factor: 3 }]);\nconstituents.S6 = compoundConstituent(\"S6\", [{ constituent: constituents.S2!, factor: 3 }]);\n\n// Eighth-Diurnals\nconstituents.M8 = compoundConstituent(\"M8\", [{ constituent: constituents.M2!, factor: 4 }]);\n\nexport default constituents as Constituents;\n","import prediction from \"./prediction.js\";\nimport constituentModels from \"../constituents/index.js\";\nimport { d2r } from \"../astronomy/constants.js\";\nimport type { HarmonicConstituent, InternalHarmonicConstituent, Prediction } from \"./prediction.js\";\n\nexport type * from \"./prediction.js\";\n\nexport interface HarmonicsOptions {\n harmonicConstituents: HarmonicConstituent[];\n offset: number | false;\n}\n\nexport interface PredictionOptions {\n timeFidelity?: number;\n}\n\nexport interface Harmonics {\n setTimeSpan: (startTime: Date | number, endTime: Date | number) => Harmonics;\n prediction: (options?: PredictionOptions) => Prediction;\n}\n\nconst getDate = (time: Date | number): Date => {\n if (time instanceof Date) {\n return time;\n }\n if (typeof time === \"number\") {\n return new Date(time * 1000);\n }\n throw new Error(\"Invalid date format, should be a Date object, or timestamp\");\n};\n\nconst getTimeline = (start: Date, end: Date, seconds: number = 10 * 60) => {\n const items: Date[] = [];\n const endTime = end.getTime() / 1000;\n let lastTime = start.getTime() / 1000;\n const startTime = lastTime;\n const hours: number[] = [];\n while (lastTime <= endTime) {\n items.push(new Date(lastTime * 1000));\n hours.push((lastTime - startTime) / (60 * 60));\n lastTime += seconds;\n }\n\n return {\n items,\n hours,\n };\n};\n\nconst harmonicsFactory = ({ harmonicConstituents, offset }: HarmonicsOptions): Harmonics => {\n if (!Array.isArray(harmonicConstituents)) {\n throw new Error(\"Harmonic constituents are not an array\");\n }\n const constituents: InternalHarmonicConstituent[] = [];\n harmonicConstituents.forEach((constituent) => {\n if (typeof constituent.name === \"undefined\") {\n throw new Error(\"Harmonic constituents must have a name property\");\n }\n if (constituentModels[constituent.name] !== undefined) {\n constituents.push({\n ...constituent,\n _model: constituentModels[constituent.name],\n phase: d2r * constituent.phase,\n });\n }\n });\n\n if (offset !== false) {\n constituents.push({\n name: \"Z0\",\n _model: constituentModels.Z0,\n phase: 0,\n amplitude: offset,\n });\n }\n\n let start = new Date();\n let end = new Date();\n\n const harmonics: Harmonics = {} as Harmonics;\n\n harmonics.setTimeSpan = (startTime: Date | number, endTime: Date | number): Harmonics => {\n start = getDate(startTime);\n end = getDate(endTime);\n if (start.getTime() >= end.getTime()) {\n throw new Error(\"Start time must be before end time\");\n }\n return harmonics;\n };\n\n harmonics.prediction = (options?: PredictionOptions): Prediction => {\n const opts = typeof options !== \"undefined\" ? options : { timeFidelity: 10 * 60 };\n return prediction({\n timeline: getTimeline(start, end, opts.timeFidelity),\n constituents,\n start,\n });\n };\n\n return Object.freeze(harmonics);\n};\n\nexport default harmonicsFactory;\nexport { getDate, getTimeline };\n","import harmonics from \"./harmonics/index.js\";\nimport { default as constituents } from \"./constituents/index.js\";\nimport type { HarmonicConstituent } from \"./harmonics/index.js\";\nimport type { TimelinePoint, Extreme, ExtremeOffsets } from \"./harmonics/prediction.js\";\n\nexport interface TidePredictionOptions {\n offset?: number | false;\n}\n\nexport interface TimeSpan {\n start: Date;\n end: Date;\n timeFidelity?: number;\n}\n\nexport interface ExtremesInput extends TimeSpan {\n labels?: {\n high?: string;\n low?: string;\n };\n offsets?: ExtremeOffsets;\n}\n\nexport interface TidePrediction {\n getTimelinePrediction: (params: TimeSpan) => TimelinePoint[];\n getExtremesPrediction: (params: ExtremesInput) => Extreme[];\n getWaterLevelAtTime: (params: { time: Date }) => TimelinePoint;\n}\n\nconst tidePredictionFactory = (\n constituents: HarmonicConstituent[],\n options: TidePredictionOptions = {},\n): TidePrediction => {\n const harmonicsOptions = {\n harmonicConstituents: constituents,\n offset: false as number | false,\n ...options,\n };\n\n const tidePrediction: TidePrediction = {\n getTimelinePrediction: ({ start, end, timeFidelity }: TimeSpan): TimelinePoint[] => {\n return harmonics(harmonicsOptions)\n .setTimeSpan(start, end)\n .prediction({ timeFidelity })\n .getTimelinePrediction();\n },\n\n getExtremesPrediction: ({\n start,\n end,\n labels,\n offsets,\n timeFidelity,\n }: ExtremesInput): Extreme[] => {\n return harmonics(harmonicsOptions)\n .setTimeSpan(start, end)\n .prediction({ timeFidelity })\n .getExtremesPrediction({ labels, offsets });\n },\n\n getWaterLevelAtTime: ({ time }: { time: Date }): TimelinePoint => {\n const endDate = new Date(time.getTime() + 10 * 60 * 1000);\n return harmonics(harmonicsOptions)\n .setTimeSpan(time, endDate)\n .prediction()\n .getTimelinePrediction()[0];\n },\n };\n\n return tidePrediction;\n};\n\n// Make constituents available on factory for reference\ntidePredictionFactory.constituents = constituents;\n\nexport default tidePredictionFactory;\nexport type { HarmonicConstituent, TimelinePoint, Extreme };\n"],"mappings":";;AAAA,MAAa,MAAM,KAAK,KAAK;AAC7B,MAAa,MAAM,MAAQ,KAAK;;;;ACAhC,MAAM,wBACJ,SACA,UAAkB,GAClB,UAAkB,GAClB,MAAc,GACd,OAAe,MACJ;AACX,QACE,UACA,UAAU,KACV,UAAW,OACX,OAAO,OAAc,OACrB,QAAQ,OAAc;;AAc1B,MAAMA,eAA6B;CAEjC,sBAAsB;EACpB,qBAAqB,IAAI,IAAI,OAAO;EACpC,CAAC,qBAAqB,GAAG,GAAG,QAAQ;EACpC,CAAC,qBAAqB,GAAG,GAAG,KAAK;EACjC,qBAAqB,GAAG,GAAG,QAAQ;EACnC,CAAC,qBAAqB,GAAG,GAAG,MAAM;EAClC,CAAC,qBAAqB,GAAG,GAAG,OAAO;EACnC,CAAC,qBAAqB,GAAG,GAAG,MAAM;EAClC,qBAAqB,GAAG,GAAG,KAAK;EAChC,qBAAqB,GAAG,GAAG,MAAM;EACjC,qBAAqB,GAAG,GAAG,KAAK;EAChC,qB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E,cAAc,CAAC,CAC5B,sBAAsB;IAAE;IAAQ;IAAS,CAAC;;EAG/C,sBAAsB,EAAE,WAA0C;GAChE,MAAM,UAAU,IAAI,KAAK,KAAK,SAAS,GAAG,MAAU,IAAK;AACzD,UAAOA,kBAAU,iBAAiB,CAC/B,YAAY,MAAM,QAAQ,CAC1B,YAAY,CACZ,uBAAuB,CAAC;;EAE9B;;AAMH,sBAAsB,eAAeD;AAErC,kBAAe"}
1
+ {"version":3,"file":"index.cjs","names":["coefficients: Coefficients","result: number[]","modulus","result: any","polynomials: Record<string, number[]>","coefficients","functions: Record<string, (N: number, i: number, omega: number) => number>","coefficients","astro","nodeCorrections","coefficients: number[]","f: number[]","results: number[]","nc","nc","M2","O1","nc","M2","K1","M2","O1","nc","M2","S2","nc","nc","nc","N2","J1","S2","M2","nc","L2","N2","nc","nc","nc","nc","nc","M2","M2","M2","nc","nc","nc","M2","K1","M2","K1","S2","nc","M2","N2","M2","S2","S2","M2","M2","S2","K1","nc","M2","T2","M2","S2","N2","nc","nc","nc","nc","nc","R2","NU2","K1","nc","S2","S2","S2","nc","nc","nc","T2","nc","constituents: Record<string, Constituent>","module","amplitudes: number[]","prediction: Prediction","results: Extreme[]","results: TimelinePoint[]","prediction: TimelinePoint","prediction","astro","baseValue: Record<string, number>","baseSpeed: Record<string, number>","u: Record<string, number>[]","f: Record<string, number>[]","constituentModels","uItem: Record<string, number>","fItem: Record<string, number>","items: Date[]","hours: number[]","constituents: HarmonicConstituent[]","constituentModels","harmonics: Harmonics","prediction","constituents","harmonics"],"sources":["../src/astronomy/constants.ts","../src/astronomy/coefficients.ts","../src/astronomy/index.ts","../src/node-corrections/index.ts","../src/constituents/definition.ts","../src/constituents/M2.ts","../src/constituents/O1.ts","../src/constituents/2MK3.ts","../src/constituents/K1.ts","../src/constituents/2MK5.ts","../src/constituents/2MO5.ts","../src/constituents/S2.ts","../src/constituents/2MS6.ts","../src/constituents/2N2.ts","../src/constituents/N2.ts","../src/constituents/J1.ts","../src/constituents/2Q1.ts","../src/constituents/2SM2.ts","../src/constituents/L2.ts","../src/constituents/3L2.ts","../src/constituents/3N2.ts","../src/constituents/EP2.ts","../src/constituents/K2.ts","../src/constituents/LAMBDA2.ts","../src/constituents/M1.ts","../src/constituents/M3.ts","../src/constituents/M4.ts","../src/constituents/M6.ts","../src/constituents/M8.ts","../src/constituents/MA2.ts","../src/constituents/MB2.ts","../src/constituents/MF.ts","../src/constituents/MK3.ts","../src/constituents/MKS2.ts","../src/constituents/MM.ts","../src/constituents/MN4.ts","../src/constituents/MS4.ts","../src/constituents/MSF.ts","../src/constituents/MSQM.ts","../src/constituents/T2.ts","../src/constituents/MTM.ts","../src/constituents/MU2.ts","../src/constituents/N4.ts","../src/constituents/NU2.ts","../src/constituents/OO1.ts","../src/constituents/P1.ts","../src/constituents/Q1.ts","../src/constituents/R2.ts","../src/constituents/R3.ts","../src/constituents/RHO1.ts","../src/constituents/S1.ts","../src/constituents/S3.ts","../src/constituents/S4.ts","../src/constituents/S6.ts","../src/constituents/SA.ts","../src/constituents/SGM.ts","../src/constituents/SSA.ts","../src/constituents/T3.ts","../src/constituents/Z0.ts","../src/constituents/index.ts","../src/harmonics/prediction.ts","../src/harmonics/index.ts","../src/index.ts"],"sourcesContent":["export const d2r = Math.PI / 180.0;\nexport const r2d = 180.0 / Math.PI;\n","// Convert a sexagesimal angle into decimal degrees\nconst sexagesimalToDecimal = (\n degrees: number,\n arcmins: number = 0,\n arcsecs: number = 0,\n mas: number = 0,\n muas: number = 0,\n): number => {\n return (\n degrees +\n arcmins / 60.0 +\n arcsecs / (60.0 * 60.0) +\n mas / (60.0 * 60.0 * 1e3) +\n muas / (60.0 * 60.0 * 1e6)\n );\n};\n\ninterface Coefficients {\n terrestrialObliquity: number[];\n solarPerigee: number[];\n solarLongitude: number[];\n lunarInclination: number[];\n lunarLongitude: number[];\n lunarNode: number[];\n lunarPerigee: number[];\n}\n\nconst coefficients: Coefficients = {\n // Meeus formula 21.3\n terrestrialObliquity: [\n sexagesimalToDecimal(23, 26, 21.448),\n -sexagesimalToDecimal(0, 0, 4680.93),\n -sexagesimalToDecimal(0, 0, 1.55),\n sexagesimalToDecimal(0, 0, 1999.25),\n -sexagesimalToDecimal(0, 0, 51.38),\n -sexagesimalToDecimal(0, 0, 249.67),\n -sexagesimalToDecimal(0, 0, 39.05),\n sexagesimalToDecimal(0, 0, 7.12),\n sexagesimalToDecimal(0, 0, 27.87),\n sexagesimalToDecimal(0, 0, 5.79),\n sexagesimalToDecimal(0, 0, 2.45),\n ].map((number, index) => {\n return number * Math.pow(1e-2, index);\n }),\n\n solarPerigee: [280.46645 - 357.5291, 36000.76932 - 35999.0503, 0.0003032 + 0.0001559, 0.00000048],\n\n solarLongitude: [280.46645, 36000.76983, 0.0003032],\n\n lunarInclination: [5.145],\n\n lunarLongitude: [218.3164591, 481267.88134236, -0.0013268, 1 / 538841.0 - 1 / 65194000.0],\n\n lunarNode: [125.044555, -1934.1361849, 0.0020762, 1 / 467410.0, -1 / 60616000.0],\n\n lunarPerigee: [83.353243, 4069.0137111, -0.0103238, -1 / 80053.0, 1 / 18999000.0],\n};\n\nexport default coefficients;\nexport { sexagesimalToDecimal };\nexport type { Coefficients };\n","import { d2r, r2d } from \"./constants.js\";\nimport coefficients from \"./coefficients.js\";\n\nexport interface AstroValue {\n value: number;\n speed: number;\n}\n\nexport interface AstroData {\n s: AstroValue;\n h: AstroValue;\n p: AstroValue;\n N: AstroValue;\n pp: AstroValue;\n \"90\": AstroValue;\n omega: AstroValue;\n i: AstroValue;\n I: AstroValue;\n xi: AstroValue;\n nu: AstroValue;\n nup: AstroValue;\n nupp: AstroValue;\n \"T+h-s\": AstroValue;\n P: AstroValue;\n}\n\n// Evaluates a polynomial at argument\nconst polynomial = (coefficients: number[], argument: number): number => {\n const result: number[] = [];\n coefficients.forEach((coefficient, index) => {\n result.push(coefficient * Math.pow(argument, index));\n });\n return result.reduce((a, b) => a + b);\n};\n\n// Evaluates a derivative polynomial at argument\nconst derivativePolynomial = (coefficients: number[], argument: number): number => {\n const result: number[] = [];\n coefficients.forEach((coefficient, index) => {\n result.push(coefficient * index * Math.pow(argument, index - 1));\n });\n return result.reduce((a, b) => a + b);\n};\n\n// Meeus formula 11.1\nconst T = (t: Date): number => {\n return (JD(t) - 2451545.0) / 36525;\n};\n\n// Meeus formula 7.1\nconst JD = (t: Date): number => {\n let Y = t.getUTCFullYear();\n let M = t.getUTCMonth() + 1;\n const D =\n t.getUTCDate() +\n t.getUTCHours() / 24.0 +\n t.getUTCMinutes() / (24.0 * 60.0) +\n t.getUTCSeconds() / (24.0 * 60.0 * 60.0) +\n t.getUTCMilliseconds() / (24.0 * 60.0 * 60.0 * 1e6);\n if (M <= 2) {\n Y = Y - 1;\n M = M + 12;\n }\n const A = Math.floor(Y / 100.0);\n const B = 2 - A + Math.floor(A / 4.0);\n return Math.floor(365.25 * (Y + 4716)) + Math.floor(30.6001 * (M + 1)) + D + B - 1524.5;\n};\n\nconst _I = (N: number, i: number, omega: number): number => {\n N = d2r * N;\n i = d2r * i;\n omega = d2r * omega;\n const cosI = Math.cos(i) * Math.cos(omega) - Math.sin(i) * Math.sin(omega) * Math.cos(N);\n return r2d * Math.acos(cosI);\n};\n\nconst _xi = (N: number, i: number, omega: number): number => {\n N = d2r * N;\n i = d2r * i;\n omega = d2r * omega;\n let e1 = (Math.cos(0.5 * (omega - i)) / Math.cos(0.5 * (omega + i))) * Math.tan(0.5 * N);\n let e2 = (Math.sin(0.5 * (omega - i)) / Math.sin(0.5 * (omega + i))) * Math.tan(0.5 * N);\n e1 = Math.atan(e1);\n e2 = Math.atan(e2);\n e1 = e1 - 0.5 * N;\n e2 = e2 - 0.5 * N;\n return -(e1 + e2) * r2d;\n};\n\nconst _nu = (N: number, i: number, omega: number): number => {\n N = d2r * N;\n i = d2r * i;\n omega = d2r * omega;\n let e1 = (Math.cos(0.5 * (omega - i)) / Math.cos(0.5 * (omega + i))) * Math.tan(0.5 * N);\n let e2 = (Math.sin(0.5 * (omega - i)) / Math.sin(0.5 * (omega + i))) * Math.tan(0.5 * N);\n e1 = Math.atan(e1);\n e2 = Math.atan(e2);\n e1 = e1 - 0.5 * N;\n e2 = e2 - 0.5 * N;\n return (e1 - e2) * r2d;\n};\n\n// Schureman equation 224\nconst _nup = (N: number, i: number, omega: number): number => {\n const I = d2r * _I(N, i, omega);\n const nu = d2r * _nu(N, i, omega);\n return (\n r2d * Math.atan((Math.sin(2 * I) * Math.sin(nu)) / (Math.sin(2 * I) * Math.cos(nu) + 0.3347))\n );\n};\n\n// Schureman equation 232\nconst _nupp = (N: number, i: number, omega: number): number => {\n const I = d2r * _I(N, i, omega);\n const nu = d2r * _nu(N, i, omega);\n const tan2nupp =\n (Math.sin(I) ** 2 * Math.sin(2 * nu)) / (Math.sin(I) ** 2 * Math.cos(2 * nu) + 0.0727);\n return r2d * 0.5 * Math.atan(tan2nupp);\n};\n\nconst modulus = (a: number, b: number): number => {\n return ((a % b) + b) % b;\n};\n\nconst astro = (time: Date): AstroData => {\n // This gets cast to `AstroData` later, but we build it up step by step here\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const result: any = {};\n\n const polynomials: Record<string, number[]> = {\n s: coefficients.lunarLongitude,\n h: coefficients.solarLongitude,\n p: coefficients.lunarPerigee,\n N: coefficients.lunarNode,\n pp: coefficients.solarPerigee,\n \"90\": [90.0],\n omega: coefficients.terrestrialObliquity,\n i: coefficients.lunarInclination,\n };\n\n // Polynomials are in T, that is Julian Centuries; we want our speeds to be\n // in the more convenient unit of degrees per hour.\n const dTdHour = 1 / (24 * 365.25 * 100);\n for (const name in polynomials) {\n result[name] = {\n value: modulus(polynomial(polynomials[name], T(time)), 360.0),\n speed: derivativePolynomial(polynomials[name], T(time)) * dTdHour,\n };\n }\n\n // Some other parameters defined by Schureman which are dependent on the\n // parameters N, i, omega for use in node factor calculations. We don't need\n // their speeds.\n const functions: Record<string, (N: number, i: number, omega: number) => number> = {\n I: _I,\n xi: _xi,\n nu: _nu,\n nup: _nup,\n nupp: _nupp,\n };\n Object.keys(functions).forEach((name) => {\n const functionCall = functions[name];\n result[name] = {\n value: modulus(functionCall(result.N.value, result.i.value, result.omega.value), 360.0),\n speed: null,\n };\n });\n\n // We don't work directly with the T (hours) parameter, instead our spanning\n // set for equilibrium arguments #is given by T+h-s, s, h, p, N, pp, 90.\n // This is in line with convention.\n const hour = {\n value: (JD(time) - Math.floor(JD(time))) * 360.0,\n speed: 15.0,\n };\n\n result[\"T+h-s\"] = {\n value: hour.value + result.h.value - result.s.value,\n speed: hour.speed + result.h.speed - result.s.speed,\n };\n\n // It is convenient to calculate Schureman's P here since several node\n // factors need it, although it could be argued that these\n // (along with I, xi, nu etc) belong somewhere else.\n result.P = {\n value: result.p.value - (result.xi.value % 360.0),\n speed: null,\n };\n\n return result as AstroData;\n};\n\nexport default astro;\nexport { polynomial, derivativePolynomial, T, JD, _I, _xi, _nu, _nup, _nupp };\n","import { d2r, r2d } from \"../astronomy/constants.js\";\nimport type { AstroData } from \"../astronomy/index.js\";\n\nexport type NodeCorrectionFunction = (a: AstroData, ...args: unknown[]) => number;\n\nconst corrections = {\n fUnity(): number {\n return 1;\n },\n\n // Schureman equations 73, 65\n fMm(a: AstroData): number {\n const omega = d2r * a.omega.value;\n const i = d2r * a.i.value;\n const I = d2r * a.I.value;\n const mean =\n (2 / 3.0 - Math.pow(Math.sin(omega), 2)) * (1 - (3 / 2.0) * Math.pow(Math.sin(i), 2));\n return (2 / 3.0 - Math.pow(Math.sin(I), 2)) / mean;\n },\n\n // Schureman equations 74, 66\n fMf(a: AstroData): number {\n const omega = d2r * a.omega.value;\n const i = d2r * a.i.value;\n const I = d2r * a.I.value;\n const mean = Math.pow(Math.sin(omega), 2) * Math.pow(Math.cos(0.5 * i), 4);\n return Math.pow(Math.sin(I), 2) / mean;\n },\n\n // Schureman equations 75, 67\n fO1(a: AstroData): number {\n const omega = d2r * a.omega.value;\n const i = d2r * a.i.value;\n const I = d2r * a.I.value;\n const mean =\n Math.sin(omega) * Math.pow(Math.cos(0.5 * omega), 2) * Math.pow(Math.cos(0.5 * i), 4);\n return (Math.sin(I) * Math.pow(Math.cos(0.5 * I), 2)) / mean;\n },\n\n // Schureman equations 76, 68\n fJ1(a: AstroData): number {\n const omega = d2r * a.omega.value;\n const i = d2r * a.i.value;\n const I = d2r * a.I.value;\n const mean = Math.sin(2 * omega) * (1 - (3 / 2.0) * Math.pow(Math.sin(i), 2));\n return Math.sin(2 * I) / mean;\n },\n\n // Schureman equations 77, 69\n fOO1(a: AstroData): number {\n const omega = d2r * a.omega.value;\n const i = d2r * a.i.value;\n const I = d2r * a.I.value;\n const mean =\n Math.sin(omega) * Math.pow(Math.sin(0.5 * omega), 2) * Math.pow(Math.cos(0.5 * i), 4);\n return (Math.sin(I) * Math.pow(Math.sin(0.5 * I), 2)) / mean;\n },\n\n // Schureman equations 78, 70\n fM2(a: AstroData): number {\n const omega = d2r * a.omega.value;\n const i = d2r * a.i.value;\n const I = d2r * a.I.value;\n const mean = Math.pow(Math.cos(0.5 * omega), 4) * Math.pow(Math.cos(0.5 * i), 4);\n return Math.pow(Math.cos(0.5 * I), 4) / mean;\n },\n\n // Schureman equations 227, 226, 68\n // Should probably eventually include the derivations of the magic numbers (0.5023 etc).\n fK1(a: AstroData): number {\n const omega = d2r * a.omega.value;\n const i = d2r * a.i.value;\n const I = d2r * a.I.value;\n const nu = d2r * a.nu.value;\n const sin2IcosnuMean = Math.sin(2 * omega) * (1 - (3 / 2.0) * Math.pow(Math.sin(i), 2));\n const mean = 0.5023 * sin2IcosnuMean + 0.1681;\n return (\n Math.pow(\n 0.2523 * Math.pow(Math.sin(2 * I), 2) + 0.1689 * Math.sin(2 * I) * Math.cos(nu) + 0.0283,\n 0.5,\n ) / mean\n );\n },\n\n // Schureman equations 215, 213, 204\n // It can be (and has been) confirmed that the exponent for R_a reads 1/2 via Schureman Table 7\n fL2(a: AstroData): number {\n const P = d2r * a.P.value;\n const I = d2r * a.I.value;\n const rAInv = Math.pow(\n 1 -\n 12 * Math.pow(Math.tan(0.5 * I), 2) * Math.cos(2 * P) +\n 36 * Math.pow(Math.tan(0.5 * I), 4),\n 0.5,\n );\n return corrections.fM2(a) * rAInv;\n },\n\n // Schureman equations 235, 234, 71\n // Again, magic numbers\n fK2(a: AstroData): number {\n const omega = d2r * a.omega.value;\n const i = d2r * a.i.value;\n const I = d2r * a.I.value;\n const nu = d2r * a.nu.value;\n const sinsqIcos2nuMean = Math.sin(omega) ** 2 * (1 - (3 / 2.0) * Math.sin(i) ** 2);\n const mean = 0.5023 * sinsqIcos2nuMean + 0.0365;\n return (\n Math.pow(\n 0.2523 * Math.pow(Math.sin(I), 4) +\n 0.0367 * Math.pow(Math.sin(I), 2) * Math.cos(2 * nu) +\n 0.0013,\n 0.5,\n ) / mean\n );\n },\n\n // Schureman equations 206, 207, 195\n fM1(a: AstroData): number {\n const P = d2r * a.P.value;\n const I = d2r * a.I.value;\n const qAInv = Math.pow(\n 0.25 +\n 1.5 * Math.cos(I) * Math.cos(2 * P) * Math.pow(Math.cos(0.5 * I), -0.5) +\n 2.25 * Math.pow(Math.cos(I), 2) * Math.pow(Math.cos(0.5 * I), -4),\n 0.5,\n );\n return corrections.fO1(a) * qAInv;\n },\n\n // See e.g. Schureman equation 149\n fModd(a: AstroData, n: number): number {\n return Math.pow(corrections.fM2(a), n / 2.0);\n },\n\n // Node factors u, see Table 2 of Schureman.\n\n uZero(): number {\n return 0.0;\n },\n\n uMf(a: AstroData): number {\n return -2.0 * a.xi.value;\n },\n\n uO1(a: AstroData): number {\n return 2.0 * a.xi.value - a.nu.value;\n },\n\n uJ1(a: AstroData): number {\n return -a.nu.value;\n },\n\n uOO1(a: AstroData): number {\n return -2.0 * a.xi.value - a.nu.value;\n },\n\n uM2(a: AstroData): number {\n return 2.0 * a.xi.value - 2.0 * a.nu.value;\n },\n\n uK1(a: AstroData): number {\n return -a.nup.value;\n },\n\n // Schureman 214\n uL2(a: AstroData): number {\n const I = d2r * a.I.value;\n const P = d2r * a.P.value;\n const R =\n r2d *\n Math.atan(Math.sin(2 * P) / ((1 / 6.0) * Math.pow(Math.tan(0.5 * I), -2) - Math.cos(2 * P)));\n return 2.0 * a.xi.value - 2.0 * a.nu.value - R;\n },\n\n uK2(a: AstroData): number {\n return -2.0 * a.nupp.value;\n },\n\n // Schureman 202\n uM1(a: AstroData): number {\n const I = d2r * a.I.value;\n const P = d2r * a.P.value;\n const Q = r2d * Math.atan(((5 * Math.cos(I) - 1) / (7 * Math.cos(I) + 1)) * Math.tan(P));\n return a.xi.value - a.nu.value + Q;\n },\n\n uModd(a: AstroData, n: number): number {\n return (n / 2.0) * corrections.uM2(a);\n },\n};\n\nexport default corrections;\n","import type { AstroData } from \"../astronomy/index.js\";\nimport nodeCorrections, { type NodeCorrectionFunction } from \"../node-corrections/index.js\";\n\nexport interface Constituent {\n names: string[];\n coefficients: number[];\n value: (astro: AstroData) => number;\n speed: (astro: AstroData) => number;\n u: NodeCorrectionFunction;\n f: NodeCorrectionFunction;\n}\n\nexport function defineConstituent(\n names: string | string[],\n coefficients: number[],\n u?: NodeCorrectionFunction,\n f?: NodeCorrectionFunction,\n): Constituent {\n if (!coefficients) {\n throw new Error(\"Coefficient must be defined for a constituent\");\n }\n\n return Object.freeze({\n names: Array.isArray(names) ? names : [names],\n\n coefficients,\n\n value: (astro: AstroData): number => {\n return dotArray(coefficients, astronomicValues(astro));\n },\n\n speed(astro: AstroData): number {\n return dotArray(coefficients, astronomicSpeed(astro));\n },\n\n u: typeof u !== \"undefined\" ? u : nodeCorrections.uZero,\n\n f: typeof f !== \"undefined\" ? f : nodeCorrections.fUnity,\n });\n}\n\nexport interface ConstituentMember {\n constituent: Constituent;\n factor: number;\n}\n\nexport function defineCompoundConstituent(\n names: string | string[],\n members: ConstituentMember[],\n): Constituent {\n const coefficients: number[] = [];\n members.forEach(({ constituent, factor }) => {\n constituent.coefficients.forEach((coefficient, index) => {\n if (typeof coefficients[index] === \"undefined\") {\n coefficients[index] = 0;\n }\n coefficients[index] += coefficient * factor;\n });\n });\n\n return Object.freeze({\n names: Array.isArray(names) ? names : [names],\n coefficients,\n\n speed: (astro: AstroData): number => {\n let speed = 0;\n members.forEach(({ constituent, factor }) => {\n speed += constituent.speed(astro) * factor;\n });\n return speed;\n },\n\n value: (astro: AstroData): number => {\n let value = 0;\n members.forEach(({ constituent, factor }) => {\n value += constituent.value(astro) * factor;\n });\n return value;\n },\n\n u: (astro: AstroData): number => {\n let u = 0;\n members.forEach(({ constituent, factor }) => {\n u += constituent.u(astro) * factor;\n });\n return u;\n },\n\n f: (astro: AstroData): number => {\n const f: number[] = [];\n members.forEach(({ constituent, factor }) => {\n f.push(Math.pow(constituent.f(astro), Math.abs(factor)));\n });\n return f.reduce((previous, value) => previous * value);\n },\n });\n}\n\n/**\n * Computes the dot notation of two arrays\n */\nfunction dotArray(a: number[], b: number[]): number {\n const results: number[] = [];\n a.forEach((value, index) => {\n results.push(value * b[index]);\n });\n return results.reduce((total, value) => total + value);\n}\n\nexport function astronimicDoodsonNumber(astro: AstroData): AstroData[keyof AstroData][] {\n return [astro[\"T+h-s\"], astro.s, astro.h, astro.p, astro.N, astro.pp, astro[\"90\"]];\n}\n\nexport function astronomicSpeed(astro: AstroData): number[] {\n const results: number[] = [];\n astronimicDoodsonNumber(astro).forEach((number) => {\n results.push(number.speed);\n });\n return results;\n}\n\nexport function astronomicValues(astro: AstroData): number[] {\n const results: number[] = [];\n astronimicDoodsonNumber(astro).forEach((number) => {\n results.push(number.value);\n });\n return results;\n}\n\n// Silence TS warning for empty module\nexport default {};\n","import { defineConstituent } from \"./definition.js\";\nimport nc from \"../node-corrections/index.js\";\n\n/**\n * Lunar semi-diurnal (M2).\n * Primary principal lunar constituent; largest semi-diurnal tidal component globally.\n * Amplitude varies 10-20% over lunar node cycle; typically 0.2-0.5m in coastal areas.\n * Base constituent for many compound shallow-water constituents.\n */\nexport default defineConstituent(\"M2\", [2, 0, 0, 0, 0, 0, 0], nc.uM2, nc.fM2);\n","import { defineConstituent } from \"./definition.js\";\nimport nc from \"../node-corrections/index.js\";\n\n/**\n * Lunar diurnal (O1).\n * Primary lunar diurnal constituent; one-per-lunar-day oscillation.\n * Amplitude varies 10-20% due to lunar node effects.\n */\nexport default defineConstituent(\"O1\", [1, -1, 0, 0, 0, 0, 1], nc.uO1, nc.fO1);\n","import { defineCompoundConstituent } from \"./definition.js\";\nimport M2 from \"./M2.js\";\nimport O1 from \"./O1.js\";\n\n/**\n * Shallow-water terdiurnal (2MK3 = M2 + O1).\n * Lunar-lunar interaction from M2 semi-diurnal and O1 diurnal components.\n * Generated in shallow-water environments; typical amplitude <1 cm.\n */\nexport default defineCompoundConstituent(\"2MK3\", [\n { constituent: M2, factor: 1 },\n { constituent: O1, factor: 1 },\n]);\n","import { defineConstituent } from \"./definition.js\";\nimport nc from \"../node-corrections/index.js\";\n\n/**\n * Lunisolar diurnal (K1).\n * Combined lunar and solar diurnal constituent; strongest diurnal tide in many regions.\n * Often comparable in amplitude to O1; amplitude ratio K1/O1 varies with latitude.\n */\nexport default defineConstituent(\"K1\", [1, 1, 0, 0, 0, 0, -1], nc.uK1, nc.fK1);\n","import { defineCompoundConstituent } from \"./definition.js\";\nimport M2 from \"./M2.js\";\nimport K1 from \"./K1.js\";\n\n/**\n * Shallow-water fifth-diurnal from M2-K1 interaction.\n *\n * Note: Found in coastal tide predictions, especially in enclosed bays and harbors.\n * Amplitude typically 0.1-0.5 cm depending on location and water depth.\n * Shallow-water constituent only; not present in deep ocean.\n *\n * @see NOAA CO-OPS\n */\nexport default defineCompoundConstituent(\"2MK5\", [\n { constituent: M2, factor: 2 },\n { constituent: K1, factor: 1 },\n]);\n","import { defineCompoundConstituent } from \"./definition.js\";\nimport M2 from \"./M2.js\";\nimport O1 from \"./O1.js\";\n\n/**\n * Shallow-water fifth-diurnal from M2-O1 interaction.\n *\n * Note: Primarily shallow-water coastal phenomenon, not present in deep ocean.\n * Amplitude typically <0.5 cm except in extreme shallow-water or enclosed basins.\n * Found in coastal tide predictions alongside other shallow-water constituents.\n *\n * @see NOAA CO-OPS\n */\nexport default defineCompoundConstituent(\"2MO5\", [\n { constituent: M2, factor: 2 },\n { constituent: O1, factor: 1 },\n]);\n","import { defineConstituent } from \"./definition.js\";\nimport nc from \"../node-corrections/index.js\";\n\n/**\n * Solar semi-diurnal (S2).\n * Principal solar semi-diurnal constituent; largest solar tide component.\n * Amplitude typically 20-50% of M2; varies with geographic location and latitude.\n * Ratio M2/S2 determines tidal form factor (diurnal vs semi-diurnal regimes).\n * Base constituent for many compound shallow-water constituents.\n */\nexport default defineConstituent(\"S2\", [2, 2, -2, 0, 0, 0, 0], nc.uZero, nc.fUnity);\n","import { defineCompoundConstituent } from \"./definition.js\";\nimport M2 from \"./M2.js\";\nimport S2 from \"./S2.js\";\n\n/**\n * Sixth-diurnal shallow-water interaction: 2×M2 + S2.\n *\n * Generated only in shallow water; typical amplitude 0.01-0.2 meters depending on depth.\n * Included in IHO shallow-water constituent tables and NOAA analysis (order #37).\n */\nexport default defineCompoundConstituent(\"2MS6\", [\n { constituent: M2, factor: 2 },\n { constituent: S2, factor: 1 },\n]);\n","import { defineConstituent } from \"./definition.js\";\nimport nc from \"../node-corrections/index.js\";\n\n/**\n * Lunar semi-diurnal (2N2).\n * Second-order lunar semi-diurnal from Moon's orbital ellipticity.\n * Amplitude typically 5-10% of M2; significant in semi-diurnal analysis.\n */\nexport default defineConstituent(\"2N2\", [2, -2, 0, 2, 0, 0, 0], nc.uM2, nc.fM2);\n","import { defineConstituent } from \"./definition.js\";\nimport nc from \"../node-corrections/index.js\";\n\n/**\n * Lunar elliptic semi-diurnal (N2).\n * Primary lunar elliptic semi-diurnal constituent from Moon's orbital variations.\n * Amplitude typically 5-15% of M2; third-largest semi-diurnal constituent.\n */\nexport default defineConstituent(\"N2\", [2, -1, 0, 1, 0, 0, 0], nc.uM2, nc.fM2);\n","import { defineConstituent } from \"./definition.js\";\nimport nc from \"../node-corrections/index.js\";\n\n/**\n * Lunar diurnal (J1).\n * Shallow-water lunar diurnal constituent; generally much smaller than O1 and K1.\n * Typically important only in shallow-water systems and enclosed basins.\n * Amplitude usually <5% of O1; rarely significant in routine predictions.\n */\nexport default defineConstituent(\"J1\", [1, 2, 0, -1, 0, 0, -1], nc.uJ1, nc.fJ1);\n","import { defineCompoundConstituent } from \"./definition.js\";\nimport N2 from \"./N2.js\";\nimport J1 from \"./J1.js\";\n\n/**\n * Shallow-water diurnal (2Q1 = N2-J1).\n * Derived from interaction of semi-diurnal N2 and diurnal J1 constituents.\n * Amplitude typically very small; rarely significant.\n * Found only in shallow-water regions with strong tidal distortion.\n */\nexport default defineCompoundConstituent(\"2Q1\", [\n { constituent: N2, factor: 1 },\n { constituent: J1, factor: -1 },\n]);\n","import { defineCompoundConstituent } from \"./definition.js\";\nimport S2 from \"./S2.js\";\nimport M2 from \"./M2.js\";\n\n/**\n * Shallow-water semi-diurnal (2SM2).\n * Compound constituent: 2×S2 - M2\n * Solar-lunar interaction constituent generated in shallow-water environments.\n * Amplitude typically <2% of M2; complementary to MU2.\n */\nexport default defineCompoundConstituent(\"2SM2\", [\n { constituent: S2, factor: 2 },\n { constituent: M2, factor: -1 },\n]);\n","import { defineConstituent } from \"./definition.js\";\nimport nc from \"../node-corrections/index.js\";\n\n/**\n * Lunar elliptic semi-diurnal (L2).\n * Secondary lunar elliptic semi-diurnal from Moon's orbital variations and perigee effects.\n * Amplitude typically 1-3% of M2; often grouped with other lunar elliptic constituents.\n * Important in detailed harmonic analyses of semi-diurnal tides.\n */\nexport default defineConstituent(\"L2\", [2, 1, 0, -1, 0, 0, 2], nc.uL2, nc.fL2);\n","import { defineCompoundConstituent } from \"./definition.js\";\nimport L2 from \"./L2.js\";\n\n/**\n * Triple lunar elliptic; 3 times L2 interaction.\n *\n * Warning: Not in standard IHO constituent bank. Mainly historical/theoretical interest.\n * Very small amplitude (<0.1 cm); found only in extreme shallow water or enclosed basins.\n * Often ignored in routine tide predictions.\n *\n * @see Schureman, P. (1958). Manual of Harmonic Analysis and Prediction of Tides\n */\nexport default defineCompoundConstituent(\"3L2\", [{ constituent: L2, factor: 3 }]);\n","import { defineCompoundConstituent } from \"./definition.js\";\nimport N2 from \"./N2.js\";\n\n/**\n * Triple N2 shallow-water harmonic (3 × N2).\n *\n * Note: Shallow-water constituent with definition based on compound frequency estimates.\n * Typical amplitude <0.5 cm; often <0.1 cm except in extreme shallow-water or enclosed basins.\n * Rarely significant in routine tide predictions.\n *\n * @see NOAA CO-OPS shallow-water constituents\n */\nexport default defineCompoundConstituent(\"3N2\", [{ constituent: N2, factor: 3 }]);\n","import { defineConstituent } from \"./definition.js\";\nimport nc from \"../node-corrections/index.js\";\n\n/**\n * Lunar elliptic semi-diurnal constituent (ε2).\n */\nexport default defineConstituent(\"EP2\", [2, -3, 2, 1, 0, 0, 0], nc.uM2, nc.fM2);\n","import { defineConstituent } from \"./definition.js\";\nimport nc from \"../node-corrections/index.js\";\n\n/**\n * Lunisolar semi-diurnal (K2).\n * Combined lunar and solar semi-diurnal constituent from declination effects.\n * Amplitude typically 10-30% of S2; second-largest solar-related semi-diurnal component.\n * Important in semi-diurnal tidal analysis, especially at mid-latitudes.\n */\nexport default defineConstituent(\"K2\", [2, 2, 0, 0, 0, 0, 0], nc.uK2, nc.fK2);\n","import { defineConstituent } from \"./definition.js\";\nimport nc from \"../node-corrections/index.js\";\n\n/**\n * Lunar semi-diurnal (λ2, lambda2).\n * Lunar semi-diurnal constituent from Moon's perigee effects.\n * Amplitude typically <5% of M2; important in detailed constituent analysis.\n * IHO standard designation (previously abbreviated as LAM2).\n */\nexport default defineConstituent([\"LAM2\", \"LAMBDA2\"], [2, 1, -2, 1, 0, 0, 2], nc.uM2, nc.fM2);\n","import { defineConstituent } from \"./definition.js\";\nimport nc from \"../node-corrections/index.js\";\n\n/**\n * Lunar diurnal elliptic (M1).\n * Secondary lunar diurnal constituent from Moon's elliptical orbit.\n * Typically very small amplitude; usually <1% of O1.\n * Rarely significant except in detailed harmonic analyses.\n */\nexport default defineConstituent(\"M1\", [1, 0, 0, 0, 0, 0, 1], nc.uM1, nc.fM1);\n","import { defineConstituent } from \"./definition.js\";\nimport nc from \"../node-corrections/index.js\";\n\n/**\n * Lunar terdiurnal (M3).\n * Third-diurnal lunar constituent from Moon's orbital motion.\n * Typically found in shallow water and resonant systems.\n * Amplitude usually <2% of M2; important in some shallow-water analyses.\n */\n// Third diurnal\nexport default defineConstituent(\n \"M3\",\n [3, 0, 0, 0, 0, 0, 0],\n (a) => {\n return nc.uModd(a, 3);\n },\n (a) => {\n return nc.fModd(a, 3);\n },\n);\n","import { defineCompoundConstituent } from \"./definition.js\";\nimport M2 from \"./M2.js\";\n\n/**\n * Shallow-water quarter-diurnal (M4 = 2×M2).\n * First overtide of M2; generated in shallow-water environments.\n * Amplitude typically 2-10% of M2; largest of the quarter-diurnal constituents.\n * Important indicator of shallow-water tidal distortion.\n */\nexport default defineCompoundConstituent(\"M4\", [{ constituent: M2, factor: 2 }]);\n","import { defineCompoundConstituent } from \"./definition.js\";\nimport M2 from \"./M2.js\";\n\n/**\n * Shallow-water sixth-diurnal (M6 = 3×M2).\n * Second overtide of M2; generated in shallow-water environments.\n * Amplitude typically 0.5-3% of M2; important in extreme shallow water.\n * Indicator of significant tidal distortion and non-linear effects.\n */\nexport default defineCompoundConstituent(\"M6\", [{ constituent: M2, factor: 3 }]);\n","import { defineCompoundConstituent } from \"./definition.js\";\nimport M2 from \"./M2.js\";\n\n/**\n * Shallow-water eighth-diurnal (M8 = 4×M2).\n * Third overtide of M2; generated in extreme shallow-water environments.\n * Amplitude typically <0.5% of M2; very rarely significant.\n * Found only in highly distorted tidal regimes (extreme shallow water, enclosed basins).\n */\nexport default defineCompoundConstituent(\"M8\", [{ constituent: M2, factor: 4 }]);\n","import { defineConstituent } from \"./definition.js\";\nimport nc from \"../node-corrections/index.js\";\n\n/**\n * Lunar variational semi-diurnal constituent (μ2, mu2).\n * Derived from Moon's orbital parameter variations.\n *\n * Note: Often included with M2 family in modern analysis. Minor constituent with\n * location-dependent amplitude.\n */\nexport default defineConstituent(\"MA2\", [2, 0, -1, 0, 0, 0, 0], nc.uM2, nc.fM2);\n","import { defineConstituent } from \"./definition.js\";\nimport nc from \"../node-corrections/index.js\";\n\n/**\n * Lunar elliptic constituent from parameter variations.\n *\n * From https://iho.int/mtg_docs/com_wg/IHOTC/IHOTC_Misc/TWCWG_Constituent_list.pdf:\n *\n * > MB2 was originally called Ma2 but this became ambiguous when spoken, or typed on\n * > computers without lower case, and so it was initially changed to MA2*. However, this\n * > in turn was thought to be clumsy and hence MB2 was finally adopted. Although\n * > theoretically they should have the same values of u and f as M2, they are so small\n * > that they are commonly treated as having values of u = 0 and f = 1.\n *\n * @see Schureman, P. (1958). Manual of Harmonic Analysis and Prediction of Tides\n */\nexport default defineConstituent(\"MB2\", [2, 0, 1, 0, 0, 0, 0], nc.uM2, nc.fM2);\n","import { defineConstituent } from \"./definition.js\";\nimport nc from \"../node-corrections/index.js\";\n\n/**\n * Lunar fortnightly (MF).\n * Long-period constituent from lunar inequality interactions.\n * Significant in long-term water level records and coastal resonances.\n */\nexport default defineConstituent(\"MF\", [0, 2, 0, 0, 0, 0, 0], nc.uMf, nc.fMf);\n","import { defineCompoundConstituent } from \"./definition.js\";\nimport M2 from \"./M2.js\";\nimport K1 from \"./K1.js\";\n\n/**\n * Shallow-water terdiurnal (MK3).\n * Compound constituent: M2 + K1\n * Lunisolar interaction from M2 semi-diurnal and K1 diurnal components.\n * Generated in shallow-water environments; typical amplitude 0.5-2 cm.\n * Often paired with 2MK3 in terdiurnal tide analysis.\n */\nexport default defineCompoundConstituent(\"MK3\", [\n { constituent: M2, factor: 1 },\n { constituent: K1, factor: 1 },\n]);\n","import { defineCompoundConstituent } from \"./definition.js\";\nimport M2 from \"./M2.js\";\nimport K1 from \"./K1.js\";\nimport S2 from \"./S2.js\";\n\n/**\n * Three-way shallow-water interaction of M2, K1, and S2.\n *\n * Warning: Not in standard IHO constituent bank. Shallow-water specific constituent\n * with definition varying by application and water depth. Use with caution and document\n * the specific convention used in your analysis.\n *\n * @see NOAA CO-OPS shallow-water constituents\n */\nexport default defineCompoundConstituent(\"MKS2\", [\n { constituent: M2, factor: 1 },\n { constituent: K1, factor: 1 },\n { constituent: S2, factor: -1 },\n]);\n","import { defineConstituent } from \"./definition.js\";\nimport nc from \"../node-corrections/index.js\";\n\n/**\n * Lunar monthly (MM).\n * Long-period constituent from lunar declination variations.\n * Important for long-term water level studies.\n */\nexport default defineConstituent(\"MM\", [0, 1, 0, -1, 0, 0, 0], nc.uZero, nc.fMm);\n","import { defineCompoundConstituent } from \"./definition.js\";\nimport M2 from \"./M2.js\";\nimport N2 from \"./N2.js\";\n\n/**\n * Shallow-water quarter-diurnal (MN4).\n * Compound constituent: M2 + N2\n * Lunar-lunar elliptic interaction from M2 and N2 semi-diurnal components.\n * Generated in shallow-water environments; typical amplitude 1-5 cm.\n * Often significant in shallow seas and estuaries.\n */\nexport default defineCompoundConstituent(\"MN4\", [\n { constituent: M2, factor: 1 },\n { constituent: N2, factor: 1 },\n]);\n","import { defineCompoundConstituent } from \"./definition.js\";\nimport M2 from \"./M2.js\";\nimport S2 from \"./S2.js\";\n\n/**\n * Shallow-water quarter-diurnal (MS4).\n * Compound constituent: M2 + S2\n * Lunar-solar interaction from M2 and S2 semi-diurnal components.\n * Generated in shallow-water environments; typical amplitude 1-5 cm.\n * Often second-largest quarter-diurnal component after M4.\n */\nexport default defineCompoundConstituent(\"MS4\", [\n { constituent: M2, factor: 1 },\n { constituent: S2, factor: 1 },\n]);\n","import { defineCompoundConstituent } from \"./definition.js\";\nimport S2 from \"./S2.js\";\nimport M2 from \"./M2.js\";\n\n/**\n * Lunisolar synodic fortnightly (MSF = S2-M2).\n * Long-period constituent representing beat frequency between solar S2 and lunar M2.\n * Manifests as fortnightly modulation of tidal range (spring-neap cycle).\n * Amplitude typically 5-15% of M2; represents the primary spring-neap variation.\n * Important for tidal range predictions and coastal flooding assessments.\n */\nexport default defineCompoundConstituent(\"MSF\", [\n { constituent: S2, factor: 1 },\n { constituent: M2, factor: -1 },\n]);\n","import { defineCompoundConstituent } from \"./definition.js\";\nimport M2 from \"./M2.js\";\nimport S2 from \"./S2.js\";\nimport K1 from \"./K1.js\";\n\n/**\n * Lunar-solar interaction compound constituent.\n *\n * Warning: Non-standard constituent not in IHO or modern NOAA standard tables.\n * Definition varies significantly across sources. Rarely used in modern tide prediction.\n * Appears in Schureman's tables as variant shallow-water interaction.\n *\n * @see NOAA CO-OPS shallow-water constituents\n * @see Schureman shallow-water analysis tables\n */\nexport default defineCompoundConstituent(\"MSQM\", [\n { constituent: M2, factor: 1 },\n { constituent: S2, factor: 1 },\n { constituent: K1, factor: 1 },\n]);\n","import { defineConstituent } from \"./definition.js\";\nimport nc from \"../node-corrections/index.js\";\n\n/**\n * Solar elliptic semi-diurnal (T2).\n * Larger solar elliptic semi-diurnal constituent from solar declination effects.\n * Amplitude typically <5% of S2; increases at higher latitudes.\n * Forms part of solar semi-diurnal analysis alongside S2 and R2.\n */\nexport default defineConstituent(\"T2\", [2, 2, -3, 0, 0, 1, 0], nc.uZero, nc.fUnity);\n","import { defineCompoundConstituent } from \"./definition.js\";\nimport M2 from \"./M2.js\";\nimport T2 from \"./T2.js\";\n\n/**\n * Lunar-solar shallow-water interaction (M2 modulated by lunar orbit).\n *\n * Warning: Not in modern IHO standard constituents; mostly historical interest.\n * Often replaced by specific ν2, λ2, or other lunar elliptic terms in modern analysis.\n * Amplitude is location and depth-dependent.\n *\n * @see NOAA CO-OPS shallow-water variants\n * @see Schureman Manual\n */\nexport default defineCompoundConstituent(\"MTM\", [\n { constituent: M2, factor: 1 },\n { constituent: T2, factor: 1 },\n]);\n","import { defineCompoundConstituent } from \"./definition.js\";\nimport M2 from \"./M2.js\";\nimport S2 from \"./S2.js\";\n\n/**\n * Shallow-water semi-diurnal (MU2 or μ2).\n * Compound constituent: 2×M2 - S2\n * Lunar variational constituent generated in shallow-water environments.\n * Amplitude typically <2% of M2; found in coastal shallow-water predictions.\n */\nexport default defineCompoundConstituent(\"MU2\", [\n { constituent: M2, factor: 2 },\n { constituent: S2, factor: -1 },\n]);\n","import { defineCompoundConstituent } from \"./definition.js\";\nimport N2 from \"./N2.js\";\n\n/**\n * Second overtide of N2; shallow-water quarter-diurnal harmonic.\n * Amplitude ranges 0.25 to 2.25 times mean due to 18.613-year lunar node cycle.\n *\n * Note: Shallow-water constituent, typically found in tide predictions for coastal areas.\n */\nexport default defineCompoundConstituent(\"N4\", [{ constituent: N2, factor: 2 }]);\n","import { defineConstituent } from \"./definition.js\";\nimport nc from \"../node-corrections/index.js\";\n\n/**\n * Lunar elliptic semi-diurnal (NU2).\n * Secondary lunar elliptic semi-diurnal from Moon's orbital variations.\n * Amplitude typically 2-5% of M2; smaller than N2.\n * Important in detailed semi-diurnal constituent analysis.\n */\nexport default defineConstituent(\"NU2\", [2, -1, 2, -1, 0, 0, 0], nc.uM2, nc.fM2);\n","import { defineConstituent } from \"./definition.js\";\nimport nc from \"../node-corrections/index.js\";\n\n/**\n * Lunar diurnal (OO1).\n * Second-order lunar diurnal constituent from Moon's orbital eccentricity.\n * Typically very small amplitude; <2% of O1 in most locations.\n * Important for detailed harmonic analysis in some regions.\n */\nexport default defineConstituent(\"OO1\", [1, 3, 0, 0, 0, 0, -1], nc.uOO1, nc.fOO1);\n","import { defineConstituent } from \"./definition.js\";\nimport nc from \"../node-corrections/index.js\";\n\n/**\n * Solar diurnal (P1).\n * Principal solar diurnal constituent; one-per-solar-day oscillation.\n * Amplitude typically 1/3 of K1; varies with latitude.\n * Forms key component of diurnal tidal analysis alongside K1 and O1.\n */\nexport default defineConstituent(\"P1\", [1, 1, -2, 0, 0, 0, 1], nc.uZero, nc.fUnity);\n","import { defineConstituent } from \"./definition.js\";\nimport nc from \"../node-corrections/index.js\";\n\n/**\n * Elliptic lunar diurnal (Q1).\n * One solar day and one lunar day modulation interaction.\n * Amplitude typically 2-5% of O1; important in diurnal constituent analysis.\n */\nexport default defineConstituent(\"Q1\", [1, -2, 0, 1, 0, 0, 1], nc.uO1, nc.fO1);\n","import { defineConstituent } from \"./definition.js\";\nimport nc from \"../node-corrections/index.js\";\n\n/**\n * Solar elliptic semi-diurnal (R2).\n * Smaller solar elliptic semi-diurnal constituent from solar declination effects.\n * Amplitude typically <2% of S2; smallest of the solar semi-diurnal group.\n * Rarely significant except in very detailed analyses.\n */\nexport default defineConstituent(\"R2\", [2, 2, -1, 0, 0, -1, 2], nc.uZero, nc.fUnity);\n","import { defineCompoundConstituent } from \"./definition.js\";\nimport R2 from \"./R2.js\";\n\n/**\n * Solar elliptic terdiurnal; 1.5 times R2 (smaller solar elliptic semi-diurnal).\n *\n * Note: Generated only in shallow water; very small amplitude (<0.05 cm typical).\n * Usually negligible except in extreme shallow-water environments.\n *\n * @see NOAA CO-OPS\n */\nexport default defineCompoundConstituent(\"R3\", [{ constituent: R2, factor: 1.5 }]);\n","import { defineCompoundConstituent } from \"./definition.js\";\nimport NU2 from \"./NU2.js\";\nimport K1 from \"./K1.js\";\n\n/**\n * Shallow-water diurnal (RHO1, ρ1).\n * Compound constituent: NU2-K1 (ν2-K1)\n * Derived from interaction of semi-diurnal NU2 and diurnal K1 constituents.\n * Amplitude typically very small; rarely significant.\n * Found only in shallow-water regions with strong tidal distortion.\n */\nexport default defineCompoundConstituent(\n [\"RHO\", \"RHO1\"],\n [\n { constituent: NU2, factor: 1 },\n { constituent: K1, factor: -1 },\n ],\n);\n","import { defineConstituent } from \"./definition.js\";\nimport nc from \"../node-corrections/index.js\";\n\n/**\n * Solar diurnal (S1).\n * Secondary solar diurnal constituent related to solar declination inequality.\n * Usually very small amplitude; typically dominated by K1 and P1 in diurnal analysis.\n * Rarely included in routine harmonic analyses.\n */\nexport default defineConstituent(\"S1\", [1, 1, -1, 0, 0, 0, 0], nc.uZero, nc.fUnity);\n","import { defineCompoundConstituent } from \"./definition.js\";\nimport S2 from \"./S2.js\";\n\n/**\n * Solar terdiurnal overtide; shallow-water only.\n *\n * Note: Generated only in shallow water; not found in deep ocean.\n * Typical amplitude <1 cm except in extreme shallow-water environments.\n *\n * @see NOAA CO-OPS\n */\nexport default defineCompoundConstituent(\"S3\", [{ constituent: S2, factor: 1.5 }]);\n","import { defineCompoundConstituent } from \"./definition.js\";\nimport S2 from \"./S2.js\";\n\n/**\n * Shallow-water quarter-diurnal (S4).\n * Compound constituent: 2×S2\n * First overtide of S2; generated in shallow-water environments.\n * Amplitude typically 1-3% of S2; smallest of the common quarter-diurnal constituents.\n * Purely solar, so has fixed amplitude and phase at any location.\n */\nexport default defineCompoundConstituent(\"S4\", [{ constituent: S2, factor: 2 }]);\n","import { defineCompoundConstituent } from \"./definition.js\";\nimport S2 from \"./S2.js\";\n\n/**\n * Shallow-water sixth-diurnal (S6).\n * Compound constituent: 3×S2\n * Second overtide of S2; generated in shallow-water environments.\n * Amplitude typically 0.5-1% of S2; smallest of the common overtides.\n * Rarely significant except in extreme shallow water or resonant systems.\n */\nexport default defineCompoundConstituent(\"S6\", [{ constituent: S2, factor: 3 }]);\n","import { defineConstituent } from \"./definition.js\";\nimport nc from \"../node-corrections/index.js\";\n\n/**\n * Solar annual (Sa).\n * Long-term constituent driven by solar declination variations over the year.\n */\nexport default defineConstituent([\"SA\", \"Sa\"], [0, 0, 1, 0, 0, 0, 0], nc.uZero, nc.fUnity);\n","import { defineConstituent } from \"./definition.js\";\nimport nc from \"../node-corrections/index.js\";\n\n/**\n * Lunar diurnal variational constituent (σ1, sigma1).\n * Derived from Moon's declination variations.\n *\n * Note: Often has small amplitude; closely related to K1 and O1 variations.\n */\nexport default defineConstituent([\"SGM\", \"SIGMA1\"], [1, -3, 2, 0, 0, 0, -1], nc.uO1, nc.fO1);\n","import { defineConstituent } from \"./definition.js\";\nimport nc from \"../node-corrections/index.js\";\n\n/**\n * Solar semi-annual (Ssa).\n * Semi-annual constituent from solar declination with twice-yearly periodicity.\n */\nexport default defineConstituent([\"Ssa\", \"SSA\"], [0, 0, 2, 0, 0, 0, 0], nc.uZero, nc.fUnity);\n","import { defineCompoundConstituent } from \"./definition.js\";\nimport T2 from \"./T2.js\";\n\n/**\n * Solar elliptic terdiurnal; 1.5 times T2 (larger solar elliptic semi-diurnal).\n *\n * Note: Generated only in shallow water; minimal amplitude (<0.1 cm typical).\n * Rarely significant except in extreme shallow-water or enclosed basins.\n *\n * @see NOAA CO-OPS\n */\nexport default defineCompoundConstituent(\"T3\", [{ constituent: T2, factor: 1.5 }]);\n","import { defineConstituent } from \"./definition.js\";\nimport nc from \"../node-corrections/index.js\";\n\n/**\n * Mean sea level (Z0).\n * Not a tidal constituent in the strict sense, but represents the mean sea level offset\n * or the \"zero\" reference level used in tidal predictions.\n * No astronomical forcing; typically determined from harmonic analysis of observed data.\n */\nexport default defineConstituent(\"Z0\", [0, 0, 0, 0, 0, 0, 0], nc.uZero, nc.fUnity);\n","import { type Constituent } from \"./definition\";\n\n// Dynamically import all constituent files\nconst constituentModules = import.meta.glob<Constituent>(\"./*.ts\", {\n eager: true,\n import: \"default\",\n});\n\nconst constituents: Record<string, Constituent> = {};\n\n// Extract constituent name from file path and populate the constituents object\nfor (const [path, module] of Object.entries(constituentModules)) {\n // Skip the index and definition files\n if (path.match(/index|definition/)) continue;\n\n module.names.forEach((name) => {\n constituents[name] = module;\n });\n}\n\nexport default constituents;\n","import astro from \"../astronomy/index.js\";\nimport { d2r } from \"../astronomy/constants.js\";\nimport constituentModels from \"../constituents/index.js\";\n\nexport interface Timeline {\n items: Date[];\n hours: number[];\n}\n\nexport interface HarmonicConstituent {\n name: string;\n amplitude: number;\n phase: number;\n speed?: number;\n description?: string;\n}\n\nexport interface TimelinePoint {\n time: Date;\n hour: number;\n level: number;\n}\n\nexport interface Extreme {\n time: Date;\n level: number;\n high: boolean;\n low: boolean;\n label: string;\n}\n\nexport interface ExtremeOffsets {\n height?: {\n high?: number;\n low?: number;\n type?: \"fixed\" | \"ratio\";\n };\n time?: {\n high?: number;\n low?: number;\n };\n}\n\nexport interface ExtremeLabels {\n high?: string;\n low?: string;\n}\n\nexport interface ExtremesOptions {\n labels?: ExtremeLabels;\n offsets?: ExtremeOffsets;\n}\n\nexport interface Prediction {\n getExtremesPrediction: (options?: ExtremesOptions) => Extreme[];\n getTimelinePrediction: () => TimelinePoint[];\n}\n\nconst modulus = (a: number, b: number): number => {\n return ((a % b) + b) % b;\n};\n\nconst addExtremesOffsets = (extreme: Extreme, offsets?: ExtremeOffsets): Extreme => {\n if (typeof offsets === \"undefined\" || !offsets) {\n return extreme;\n }\n\n if (extreme.high && offsets.height?.high) {\n if (offsets.height.type === \"fixed\") {\n extreme.level += offsets.height.high;\n } else {\n extreme.level *= offsets.height.high;\n }\n }\n if (extreme.low && offsets.height?.low) {\n if (offsets.height.type === \"fixed\") {\n extreme.level += offsets.height.low;\n } else {\n extreme.level *= offsets.height.low;\n }\n }\n if (extreme.high && offsets.time?.high) {\n extreme.time = new Date(extreme.time.getTime() + offsets.time.high * 60 * 1000);\n }\n if (extreme.low && offsets.time?.low) {\n extreme.time = new Date(extreme.time.getTime() + offsets.time.low * 60 * 1000);\n }\n return extreme;\n};\n\nconst getExtremeLabel = (label: \"high\" | \"low\", highLowLabels?: ExtremeLabels): string => {\n if (typeof highLowLabels !== \"undefined\" && typeof highLowLabels[label] !== \"undefined\") {\n return highLowLabels[label]!;\n }\n const labels = {\n high: \"High\",\n low: \"Low\",\n };\n return labels[label];\n};\n\ninterface PredictionFactoryParams {\n timeline: Timeline;\n constituents: HarmonicConstituent[];\n start: Date;\n}\n\nconst predictionFactory = ({\n timeline,\n constituents,\n start,\n}: PredictionFactoryParams): Prediction => {\n const getLevel = (\n hour: number,\n modelBaseSpeed: Record<string, number>,\n modelU: Record<string, number>,\n modelF: Record<string, number>,\n modelBaseValue: Record<string, number>,\n ): number => {\n const amplitudes: number[] = [];\n let result = 0;\n\n constituents.forEach((constituent) => {\n const amplitude = constituent.amplitude;\n const phase = constituent.phase;\n const f = modelF[constituent.name];\n const speed = modelBaseSpeed[constituent.name];\n const u = modelU[constituent.name];\n const V0 = modelBaseValue[constituent.name];\n amplitudes.push(amplitude * f * Math.cos(speed * hour + (V0 + u) - phase));\n });\n // sum up each row\n amplitudes.forEach((item) => {\n result += item;\n });\n return result;\n };\n\n const prediction: Prediction = {} as Prediction;\n\n prediction.getExtremesPrediction = (options?: ExtremesOptions): Extreme[] => {\n const { labels, offsets } = typeof options !== \"undefined\" ? options : {};\n const results: Extreme[] = [];\n const { baseSpeed, u, f, baseValue } = prepare();\n let goingUp = false;\n let goingDown = false;\n let lastLevel = getLevel(0, baseSpeed, u[0], f[0], baseValue);\n timeline.items.forEach((time, index) => {\n const hour = timeline.hours[index];\n const level = getLevel(hour, baseSpeed, u[index], f[index], baseValue);\n // Compare this level to the last one, if we\n // are changing angle, then the last one was high or low\n if (level > lastLevel && goingDown) {\n results.push(\n addExtremesOffsets(\n {\n time: timeline.items[index - 1],\n level: lastLevel,\n high: false,\n low: true,\n label: getExtremeLabel(\"low\", labels),\n },\n offsets,\n ),\n );\n }\n if (level < lastLevel && goingUp) {\n results.push(\n addExtremesOffsets(\n {\n time: timeline.items[index - 1],\n level: lastLevel,\n high: true,\n low: false,\n label: getExtremeLabel(\"high\", labels),\n },\n offsets,\n ),\n );\n }\n if (level > lastLevel) {\n goingUp = true;\n goingDown = false;\n }\n if (level < lastLevel) {\n goingUp = false;\n goingDown = true;\n }\n lastLevel = level;\n });\n return results;\n };\n\n prediction.getTimelinePrediction = (): TimelinePoint[] => {\n const results: TimelinePoint[] = [];\n const { baseSpeed, u, f, baseValue } = prepare();\n timeline.items.forEach((time, index) => {\n const hour = timeline.hours[index];\n const prediction: TimelinePoint = {\n time,\n hour,\n level: getLevel(hour, baseSpeed, u[index], f[index], baseValue),\n };\n\n results.push(prediction);\n });\n return results;\n };\n\n const prepare = () => {\n const baseAstro = astro(start);\n\n const baseValue: Record<string, number> = {};\n const baseSpeed: Record<string, number> = {};\n const u: Record<string, number>[] = [];\n const f: Record<string, number>[] = [];\n constituents.forEach((constituent) => {\n const model = constituentModels[constituent.name];\n if (!model) return;\n\n const value = model.value(baseAstro);\n const speed = model.speed(baseAstro);\n baseValue[constituent.name] = d2r * value;\n baseSpeed[constituent.name] = d2r * speed;\n });\n timeline.items.forEach((time) => {\n const uItem: Record<string, number> = {};\n const fItem: Record<string, number> = {};\n const itemAstro = astro(time);\n constituents.forEach((constituent) => {\n const model = constituentModels[constituent.name];\n if (!model) return;\n\n const constituentU = modulus(model.u(itemAstro), 360);\n uItem[constituent.name] = d2r * constituentU;\n fItem[constituent.name] = modulus(model.f(itemAstro), 360);\n });\n\n u.push(uItem);\n f.push(fItem);\n });\n\n return {\n baseValue,\n baseSpeed,\n u,\n f,\n };\n };\n\n return Object.freeze(prediction);\n};\n\nexport default predictionFactory;\n","import prediction from \"./prediction.js\";\nimport constituentModels from \"../constituents/index.js\";\nimport { d2r } from \"../astronomy/constants.js\";\nimport type { HarmonicConstituent, Prediction } from \"./prediction.js\";\n\nexport type * from \"./prediction.js\";\n\nexport interface HarmonicsOptions {\n harmonicConstituents: HarmonicConstituent[];\n offset: number | false;\n}\n\nexport interface PredictionOptions {\n timeFidelity?: number;\n}\n\nexport interface Harmonics {\n setTimeSpan: (startTime: Date | number, endTime: Date | number) => Harmonics;\n prediction: (options?: PredictionOptions) => Prediction;\n}\n\nconst getDate = (time: Date | number): Date => {\n if (time instanceof Date) {\n return time;\n }\n if (typeof time === \"number\") {\n return new Date(time * 1000);\n }\n throw new Error(\"Invalid date format, should be a Date object, or timestamp\");\n};\n\nconst getTimeline = (start: Date, end: Date, seconds: number = 10 * 60) => {\n const items: Date[] = [];\n const endTime = end.getTime() / 1000;\n let lastTime = start.getTime() / 1000;\n const startTime = lastTime;\n const hours: number[] = [];\n while (lastTime <= endTime) {\n items.push(new Date(lastTime * 1000));\n hours.push((lastTime - startTime) / (60 * 60));\n lastTime += seconds;\n }\n\n return {\n items,\n hours,\n };\n};\n\nconst harmonicsFactory = ({ harmonicConstituents, offset }: HarmonicsOptions): Harmonics => {\n if (!Array.isArray(harmonicConstituents)) {\n throw new Error(\"Harmonic constituents are not an array\");\n }\n const constituents: HarmonicConstituent[] = [];\n harmonicConstituents.forEach((constituent) => {\n if (typeof constituent.name === \"undefined\") {\n throw new Error(\"Harmonic constituents must have a name property\");\n }\n if (constituentModels[constituent.name] !== undefined) {\n constituents.push({\n ...constituent,\n phase: d2r * constituent.phase,\n });\n }\n });\n\n if (offset !== false) {\n constituents.push({\n name: \"Z0\",\n phase: 0,\n amplitude: offset,\n });\n }\n\n let start = new Date();\n let end = new Date();\n\n const harmonics: Harmonics = {} as Harmonics;\n\n harmonics.setTimeSpan = (startTime: Date | number, endTime: Date | number): Harmonics => {\n start = getDate(startTime);\n end = getDate(endTime);\n if (start.getTime() >= end.getTime()) {\n throw new Error(\"Start time must be before end time\");\n }\n return harmonics;\n };\n\n harmonics.prediction = (options?: PredictionOptions): Prediction => {\n const opts = typeof options !== \"undefined\" ? options : { timeFidelity: 10 * 60 };\n return prediction({\n timeline: getTimeline(start, end, opts.timeFidelity),\n constituents,\n start,\n });\n };\n\n return Object.freeze(harmonics);\n};\n\nexport default harmonicsFactory;\nexport { getDate, getTimeline };\n","import harmonics from \"./harmonics/index.js\";\nimport { default as constituents } from \"./constituents/index.js\";\nimport type { HarmonicConstituent } from \"./harmonics/index.js\";\nimport type { TimelinePoint, Extreme, ExtremeOffsets } from \"./harmonics/prediction.js\";\n\nexport interface TidePredictionOptions {\n offset?: number | false;\n}\n\nexport interface TimeSpan {\n start: Date;\n end: Date;\n timeFidelity?: number;\n}\n\nexport interface ExtremesInput extends TimeSpan {\n labels?: {\n high?: string;\n low?: string;\n };\n offsets?: ExtremeOffsets;\n}\n\nexport interface TidePrediction {\n getTimelinePrediction: (params: TimeSpan) => TimelinePoint[];\n getExtremesPrediction: (params: ExtremesInput) => Extreme[];\n getWaterLevelAtTime: (params: { time: Date }) => TimelinePoint;\n}\n\nconst tidePredictionFactory = (\n constituents: HarmonicConstituent[],\n options: TidePredictionOptions = {},\n): TidePrediction => {\n const harmonicsOptions = {\n harmonicConstituents: constituents,\n offset: false as number | false,\n ...options,\n };\n\n const tidePrediction: TidePrediction = {\n getTimelinePrediction: ({ start, end, timeFidelity }: TimeSpan): TimelinePoint[] => {\n return harmonics(harmonicsOptions)\n .setTimeSpan(start, end)\n .prediction({ timeFidelity })\n .getTimelinePrediction();\n },\n\n getExtremesPrediction: ({\n start,\n end,\n labels,\n offsets,\n timeFidelity,\n }: ExtremesInput): Extreme[] => {\n return harmonics(harmonicsOptions)\n .setTimeSpan(start, end)\n .prediction({ timeFidelity })\n .getExtremesPrediction({ labels, offsets });\n },\n\n getWaterLevelAtTime: ({ time }: { time: Date }): TimelinePoint => {\n const endDate = new Date(time.getTime() + 10 * 60 * 1000);\n return harmonics(harmonicsOptions)\n .setTimeSpan(time, endDate)\n .prediction()\n .getTimelinePrediction()[0];\n },\n };\n\n return tidePrediction;\n};\n\n// Make constituents available on factory for reference\ntidePredictionFactory.constituents = constituents;\n\nexport default tidePredictionFactory;\nexport type { HarmonicConstituent, TimelinePoint, Extreme };\n"],"mappings":";;AAAA,MAAa,MAAM,KAAK,KAAK;AAC7B,MAAa,MAAM,MAAQ,KAAK;;;;ACAhC,MAAM,wBACJ,SACA,UAAkB,GAClB,UAAkB,GAClB,MAAc,GACd,OAAe,MACJ;AACX,QACE,UACA,UAAU,KACV,UAAW,OACX,OAAO,OAAc,OACrB,QAAQ,OAAc;;AAc1B,MAAMA,eAA6B;CAEjC,sBAAsB;EACpB,qBAAqB,IAAI,IAAI,OAAO;EACpC,CAAC,qBAAqB,GAAG,GAAG,QAAQ;EACpC,CAAC,qBAAqB,GAAG,GAAG,KAAK;EACjC,qBAAqB,GAAG,GAAG,QAAQ;EACnC,CAAC,qBAAqB,GAAG,GAAG,MAAM;EAClC,CAAC,qBAAqB,GAAG,GAAG,OAAO;EACnC,CAAC,qBAAqB,GAAG,GAAG,MAAM;EAClC,qBAAqB,GAAG,GAAG,KAAK;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,EACtB,OACA,KACA,QACA,SACA,mBAC8B;AAC9B,UAAOA,kBAAU,iBAAiB,CAC/B,YAAY,OAAO,IAAI,CACvB,WAAW,EAAE,cAAc,CAAC,CAC5B,sBAAsB;IAAE;IAAQ;IAAS,CAAC;;EAG/C,sBAAsB,EAAE,WAA0C;GAChE,MAAM,UAAU,IAAI,KAAK,KAAK,SAAS,GAAG,MAAU,IAAK;AACzD,UAAOA,kBAAU,iBAAiB,CAC/B,YAAY,MAAM,QAAQ,CAC1B,YAAY,CACZ,uBAAuB,CAAC;;EAE9B;;AAMH,sBAAsB,eAAeD;AAErC,kBAAe"}
package/dist/index.d.cts CHANGED
@@ -24,9 +24,9 @@ interface AstroData {
24
24
  //#region src/node-corrections/index.d.ts
25
25
  type NodeCorrectionFunction = (a: AstroData, ...args: unknown[]) => number;
26
26
  //#endregion
27
- //#region src/constituents/constituent.d.ts
27
+ //#region src/constituents/definition.d.ts
28
28
  interface Constituent {
29
- name: string;
29
+ names: string[];
30
30
  coefficients: number[];
31
31
  value: (astro: AstroData) => number;
32
32
  speed: (astro: AstroData) => number;
@@ -34,59 +34,6 @@ interface Constituent {
34
34
  f: NodeCorrectionFunction;
35
35
  }
36
36
  //#endregion
37
- //#region src/constituents/compound-constituent.d.ts
38
- interface CompoundConstituent {
39
- name: string;
40
- coefficients: number[];
41
- speed: (astro: AstroData) => number;
42
- value: (astro: AstroData) => number;
43
- u: (astro: AstroData) => number;
44
- f: (astro: AstroData) => number;
45
- }
46
- //#endregion
47
- //#region src/constituents/index.d.ts
48
- interface Constituents {
49
- Z0: Constituent;
50
- SA: Constituent;
51
- SSA: Constituent;
52
- MM: Constituent;
53
- MF: Constituent;
54
- Q1: Constituent;
55
- O1: Constituent;
56
- K1: Constituent;
57
- J1: Constituent;
58
- M1: Constituent;
59
- P1: Constituent;
60
- S1: Constituent;
61
- OO1: Constituent;
62
- "2N2": Constituent;
63
- N2: Constituent;
64
- NU2: Constituent;
65
- M2: Constituent;
66
- LAM2: Constituent;
67
- L2: Constituent;
68
- T2: Constituent;
69
- S2: Constituent;
70
- R2: Constituent;
71
- K2: Constituent;
72
- M3: Constituent;
73
- MSF: CompoundConstituent;
74
- "2Q1": CompoundConstituent;
75
- RHO: CompoundConstituent;
76
- MU2: CompoundConstituent;
77
- "2SM2": CompoundConstituent;
78
- "2MK3": CompoundConstituent;
79
- MK3: CompoundConstituent;
80
- MN4: CompoundConstituent;
81
- M4: CompoundConstituent;
82
- MS4: CompoundConstituent;
83
- S4: CompoundConstituent;
84
- M6: CompoundConstituent;
85
- S6: CompoundConstituent;
86
- M8: CompoundConstituent;
87
- [key: string]: Constituent | CompoundConstituent;
88
- }
89
- //#endregion
90
37
  //#region src/harmonics/prediction.d.ts
91
38
  interface HarmonicConstituent {
92
39
  name: string;
@@ -144,7 +91,7 @@ interface TidePrediction {
144
91
  }
145
92
  declare const tidePredictionFactory: {
146
93
  (constituents: HarmonicConstituent[], options?: TidePredictionOptions): TidePrediction;
147
- constituents: Constituents;
94
+ constituents: Record<string, Constituent>;
148
95
  };
149
96
  //#endregion
150
97
  export { type Extreme, ExtremesInput, type HarmonicConstituent, TidePrediction, TidePredictionOptions, TimeSpan, type TimelinePoint, tidePredictionFactory as default };
package/dist/index.d.ts CHANGED
@@ -24,9 +24,9 @@ interface AstroData {
24
24
  //#region src/node-corrections/index.d.ts
25
25
  type NodeCorrectionFunction = (a: AstroData, ...args: unknown[]) => number;
26
26
  //#endregion
27
- //#region src/constituents/constituent.d.ts
27
+ //#region src/constituents/definition.d.ts
28
28
  interface Constituent {
29
- name: string;
29
+ names: string[];
30
30
  coefficients: number[];
31
31
  value: (astro: AstroData) => number;
32
32
  speed: (astro: AstroData) => number;
@@ -34,59 +34,6 @@ interface Constituent {
34
34
  f: NodeCorrectionFunction;
35
35
  }
36
36
  //#endregion
37
- //#region src/constituents/compound-constituent.d.ts
38
- interface CompoundConstituent {
39
- name: string;
40
- coefficients: number[];
41
- speed: (astro: AstroData) => number;
42
- value: (astro: AstroData) => number;
43
- u: (astro: AstroData) => number;
44
- f: (astro: AstroData) => number;
45
- }
46
- //#endregion
47
- //#region src/constituents/index.d.ts
48
- interface Constituents {
49
- Z0: Constituent;
50
- SA: Constituent;
51
- SSA: Constituent;
52
- MM: Constituent;
53
- MF: Constituent;
54
- Q1: Constituent;
55
- O1: Constituent;
56
- K1: Constituent;
57
- J1: Constituent;
58
- M1: Constituent;
59
- P1: Constituent;
60
- S1: Constituent;
61
- OO1: Constituent;
62
- "2N2": Constituent;
63
- N2: Constituent;
64
- NU2: Constituent;
65
- M2: Constituent;
66
- LAM2: Constituent;
67
- L2: Constituent;
68
- T2: Constituent;
69
- S2: Constituent;
70
- R2: Constituent;
71
- K2: Constituent;
72
- M3: Constituent;
73
- MSF: CompoundConstituent;
74
- "2Q1": CompoundConstituent;
75
- RHO: CompoundConstituent;
76
- MU2: CompoundConstituent;
77
- "2SM2": CompoundConstituent;
78
- "2MK3": CompoundConstituent;
79
- MK3: CompoundConstituent;
80
- MN4: CompoundConstituent;
81
- M4: CompoundConstituent;
82
- MS4: CompoundConstituent;
83
- S4: CompoundConstituent;
84
- M6: CompoundConstituent;
85
- S6: CompoundConstituent;
86
- M8: CompoundConstituent;
87
- [key: string]: Constituent | CompoundConstituent;
88
- }
89
- //#endregion
90
37
  //#region src/harmonics/prediction.d.ts
91
38
  interface HarmonicConstituent {
92
39
  name: string;
@@ -144,7 +91,7 @@ interface TidePrediction {
144
91
  }
145
92
  declare const tidePredictionFactory: {
146
93
  (constituents: HarmonicConstituent[], options?: TidePredictionOptions): TidePrediction;
147
- constituents: Constituents;
94
+ constituents: Record<string, Constituent>;
148
95
  };
149
96
  //#endregion
150
97
  export { type Extreme, ExtremesInput, type HarmonicConstituent, TidePrediction, TidePredictionOptions, TimeSpan, type TimelinePoint, tidePredictionFactory as default };