File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,8 +26,10 @@ describe('NOAA benchmarks', () => {
2626 it (
2727 station . source . id ,
2828 async ( ) => {
29- const { harmonics, levels } = await getStation ( station . source . id )
30- const tideStation = tidePrediction ( harmonics . HarmonicConstituents )
29+ const { levels } = await getStation ( station . source . id )
30+ const tideStation = tidePrediction ( station . harmonic_constituents , {
31+ phaseKey : 'phase_UTC'
32+ } )
3133
3234 // No predictions available
3335 if ( ! levels . predictions ) return
@@ -99,19 +101,11 @@ async function getStation(station: string) {
99101 try {
100102 return await fs . readFile ( filePath , 'utf-8' ) . then ( ( data ) => JSON . parse ( data ) )
101103 } catch {
102- const [ harmonics , levels , info ] = await Promise . all ( [
103- makeRequest (
104- `https://api.tidesandcurrents.noaa.gov/mdapi/prod/webapi/stations/${ station } /harcon.json?units=metric`
105- ) ,
106- makeRequest (
107- `https://api.tidesandcurrents.noaa.gov/api/prod/datagetter?date=recent&station=${ station } &product=predictions&datum=MTL&time_zone=gmt&units=metric&format=json`
108- ) ,
109- makeRequest (
110- `https://api.tidesandcurrents.noaa.gov/mdapi/prod/webapi/stations/${ station } /datums.json?units=metric`
111- )
112- ] )
104+ const levels = await makeRequest (
105+ `https://api.tidesandcurrents.noaa.gov/api/prod/datagetter?date=recent&station=${ station } &product=predictions&datum=MTL&time_zone=gmt&units=metric&format=json`
106+ )
113107
114- const data = { harmonics , levels, info }
108+ const data = { levels }
115109 await fs . writeFile ( filePath , JSON . stringify ( data ) )
116110 return data
117111 }
You can’t perform that action at this time.
0 commit comments