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,8 @@ 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 )
3131
3232 // No predictions available
3333 if ( ! levels . predictions ) return
@@ -99,19 +99,11 @@ async function getStation(station: string) {
9999 try {
100100 return await fs . readFile ( filePath , 'utf-8' ) . then ( ( data ) => JSON . parse ( data ) )
101101 } 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- ] )
102+ const levels = await makeRequest (
103+ `https://api.tidesandcurrents.noaa.gov/api/prod/datagetter?date=recent&station=${ station } &product=predictions&datum=MTL&time_zone=gmt&units=metric&format=json`
104+ )
113105
114- const data = { harmonics , levels, info }
106+ const data = { levels }
115107 await fs . writeFile ( filePath , JSON . stringify ( data ) )
116108 return data
117109 }
You can’t perform that action at this time.
0 commit comments