Skip to content

Commit

Permalink
Create graphDataGenerator.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
Jbithell committed Jul 15, 2024
1 parent daf05fc commit 1726a91
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/components/tideGraph/graphDataGenerator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* Calculates a tidal curve for a given location
* According to "TIME & HEIGHT DIFFERENCES FOR PREDICTING THE TIDE AT SECONDARY PORTS" (https://assets.admiralty.co.uk/public/2022-04/5609%202022%20Feb.pdf)
* For Milford Haven:
* MHWS 7.0
* MHWN 5.2
* MLWN 2.5
* MLWS 0.7
* Midpoint therefore 3.85 (calculated as average of MHWS-((MHWS-MLWS)/2) & MHWN-((MHWN-MLWN)/2) )
*
* For Criccieth:
* MHWS -2 5.0
* MHWN -1.8 3.4
* MLWN -0.7 1.8
* MLWS -0.3 0.4
* Midpoint therefore = 2.65
*
* For Porthmadog:
* MHWS -1.9 5.1
* MHWN -1.8 3.4
* MLWN ??? so we assume 1.8
* MLWS ??? so we assume 0.3
* Midpoint therefore assumed = 2.65
*
* Using the midpoint we can derive the lowest height for a given time and high tide to be MIDPOINT - (HEIGHT - MIDPOINT)
*
* This isn't very acurate because of the river Glaslyn, so the admiralty do not therefore publish tidal curves for this location, or low tide times - we have just derived them from their data
*
*/
import { TidesJson_ScheduleObject } from "../../types";
// According to "TIME & HEIGHT DIFFERENCES FOR PREDICTING THE TIDE AT SECONDARY PORTS"
const generateTideGraphData = (tideData: Array<{ date: Date, height: number }>): Array<{ timestamp: number, height: number }> => {
return []
}

0 comments on commit 1726a91

Please sign in to comment.