diff --git a/siphon/tests/fixtures/ndbc_buoy_data_types b/siphon/tests/fixtures/ndbc_buoy_data_types new file mode 100644 index 000000000..a25ab2bc4 --- /dev/null +++ b/siphon/tests/fixtures/ndbc_buoy_data_types @@ -0,0 +1,389 @@ +interactions: +- request: + body: null + headers: + Accept: ['*/*'] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.19.1] + method: HEAD + uri: https://www.ndbc.noaa.gov/data/realtime2/41002.txt + response: + body: {string: ''} + headers: + Accept-Ranges: [bytes] + Cache-Control: [must-revalidate] + Connection: [close] + Content-Encoding: [gzip] + Content-Length: ['59218'] + Content-Security-Policy: [frame-ancestors 'self'] + Content-Type: [text/plain; charset=ISO-8859-1] + Date: ['Wed, 01 Aug 2018 16:36:52 GMT'] + Last-Modified: ['Wed, 01 Aug 2018 16:27:46 GMT'] + Server: [Apache] + Strict-Transport-Security: [max-age=31536000;] + Vary: [Accept-Encoding] + X-Content-Type-Options: [nosniff] + X-Frame-Options: [SAMEORIGIN] + X-XSS-Protection: [1; mode=block] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: ['*/*'] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.19.1] + method: HEAD + uri: https://www.ndbc.noaa.gov/data/realtime2/41002.drift + response: + body: {string: ''} + headers: + Connection: [close] + Content-Encoding: [gzip] + Content-Length: ['20'] + Content-Type: [text/html; charset=iso-8859-1] + Date: ['Wed, 01 Aug 2018 16:36:52 GMT'] + Server: [Apache] + Strict-Transport-Security: [max-age=31536000;] + Vary: [Accept-Encoding] + status: {code: 404, message: Not Found} +- request: + body: null + headers: + Accept: ['*/*'] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.19.1] + method: HEAD + uri: https://www.ndbc.noaa.gov/data/realtime2/41002.cwind + response: + body: {string: ''} + headers: + Connection: [close] + Content-Encoding: [gzip] + Content-Length: ['20'] + Content-Type: [text/html; charset=iso-8859-1] + Date: ['Wed, 01 Aug 2018 16:36:53 GMT'] + Server: [Apache] + Strict-Transport-Security: [max-age=31536000;] + Vary: [Accept-Encoding] + status: {code: 404, message: Not Found} +- request: + body: null + headers: + Accept: ['*/*'] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.19.1] + method: HEAD + uri: https://www.ndbc.noaa.gov/data/realtime2/41002.spec + response: + body: {string: ''} + headers: + Accept-Ranges: [bytes] + Cache-Control: [must-revalidate] + Connection: [close] + Content-Encoding: [gzip] + Content-Length: ['13600'] + Content-Security-Policy: [frame-ancestors 'self'] + Content-Type: [text/plain; charset=ISO-8859-1] + Date: ['Wed, 01 Aug 2018 16:36:53 GMT'] + Last-Modified: ['Wed, 01 Aug 2018 16:06:06 GMT'] + Server: [Apache] + Strict-Transport-Security: [max-age=31536000;] + Vary: [Accept-Encoding] + X-Content-Type-Options: [nosniff] + X-Frame-Options: [SAMEORIGIN] + X-XSS-Protection: [1; mode=block] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: ['*/*'] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.19.1] + method: HEAD + uri: https://www.ndbc.noaa.gov/data/realtime2/41002.data_spec + response: + body: {string: ''} + headers: + Accept-Ranges: [bytes] + Cache-Control: [must-revalidate] + Connection: [close] + Content-Encoding: [gzip] + Content-Security-Policy: [frame-ancestors 'self'] + Content-Type: [text/plain; charset=ISO-8859-1] + Date: ['Wed, 01 Aug 2018 16:36:54 GMT'] + Last-Modified: ['Wed, 01 Aug 2018 16:06:08 GMT'] + Server: [Apache] + Strict-Transport-Security: [max-age=31536000;] + Vary: [Accept-Encoding] + X-Content-Type-Options: [nosniff] + X-Frame-Options: [SAMEORIGIN] + X-XSS-Protection: [1; mode=block] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: ['*/*'] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.19.1] + method: HEAD + uri: https://www.ndbc.noaa.gov/data/realtime2/41002.swdir + response: + body: {string: ''} + headers: + Accept-Ranges: [bytes] + Cache-Control: [must-revalidate] + Connection: [close] + Content-Encoding: [gzip] + Content-Security-Policy: [frame-ancestors 'self'] + Content-Type: [text/plain; charset=ISO-8859-1] + Date: ['Wed, 01 Aug 2018 16:36:54 GMT'] + Last-Modified: ['Wed, 01 Aug 2018 16:06:10 GMT'] + Server: [Apache] + Strict-Transport-Security: [max-age=31536000;] + Vary: [Accept-Encoding] + X-Content-Type-Options: [nosniff] + X-Frame-Options: [SAMEORIGIN] + X-XSS-Protection: [1; mode=block] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: ['*/*'] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.19.1] + method: HEAD + uri: https://www.ndbc.noaa.gov/data/realtime2/41002.swdir2 + response: + body: {string: ''} + headers: + Accept-Ranges: [bytes] + Cache-Control: [must-revalidate] + Connection: [close] + Content-Encoding: [gzip] + Content-Security-Policy: [frame-ancestors 'self'] + Content-Type: [text/plain; charset=ISO-8859-1] + Date: ['Wed, 01 Aug 2018 16:36:55 GMT'] + Last-Modified: ['Wed, 01 Aug 2018 16:06:11 GMT'] + Server: [Apache] + Strict-Transport-Security: [max-age=31536000;] + Vary: [Accept-Encoding] + X-Content-Type-Options: [nosniff] + X-Frame-Options: [SAMEORIGIN] + X-XSS-Protection: [1; mode=block] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: ['*/*'] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.19.1] + method: HEAD + uri: https://www.ndbc.noaa.gov/data/realtime2/41002.swr1 + response: + body: {string: ''} + headers: + Accept-Ranges: [bytes] + Cache-Control: [must-revalidate] + Connection: [close] + Content-Encoding: [gzip] + Content-Security-Policy: [frame-ancestors 'self'] + Content-Type: [text/plain; charset=ISO-8859-1] + Date: ['Wed, 01 Aug 2018 16:36:55 GMT'] + Last-Modified: ['Wed, 01 Aug 2018 16:06:13 GMT'] + Server: [Apache] + Strict-Transport-Security: [max-age=31536000;] + Vary: [Accept-Encoding] + X-Content-Type-Options: [nosniff] + X-Frame-Options: [SAMEORIGIN] + X-XSS-Protection: [1; mode=block] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: ['*/*'] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.19.1] + method: HEAD + uri: https://www.ndbc.noaa.gov/data/realtime2/41002.swr2 + response: + body: {string: ''} + headers: + Accept-Ranges: [bytes] + Cache-Control: [must-revalidate] + Connection: [close] + Content-Encoding: [gzip] + Content-Security-Policy: [frame-ancestors 'self'] + Content-Type: [text/plain; charset=ISO-8859-1] + Date: ['Wed, 01 Aug 2018 16:36:56 GMT'] + Last-Modified: ['Wed, 01 Aug 2018 16:06:15 GMT'] + Server: [Apache] + Strict-Transport-Security: [max-age=31536000;] + Vary: [Accept-Encoding] + X-Content-Type-Options: [nosniff] + X-Frame-Options: [SAMEORIGIN] + X-XSS-Protection: [1; mode=block] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: ['*/*'] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.19.1] + method: HEAD + uri: https://www.ndbc.noaa.gov/data/realtime2/41002.adcp + response: + body: {string: ''} + headers: + Connection: [close] + Content-Encoding: [gzip] + Content-Length: ['20'] + Content-Type: [text/html; charset=iso-8859-1] + Date: ['Wed, 01 Aug 2018 16:36:57 GMT'] + Server: [Apache] + Strict-Transport-Security: [max-age=31536000;] + Vary: [Accept-Encoding] + status: {code: 404, message: Not Found} +- request: + body: null + headers: + Accept: ['*/*'] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.19.1] + method: HEAD + uri: https://www.ndbc.noaa.gov/data/realtime2/41002.ocean + response: + body: {string: ''} + headers: + Connection: [close] + Content-Encoding: [gzip] + Content-Length: ['20'] + Content-Type: [text/html; charset=iso-8859-1] + Date: ['Wed, 01 Aug 2018 16:36:57 GMT'] + Server: [Apache] + Strict-Transport-Security: [max-age=31536000;] + Vary: [Accept-Encoding] + status: {code: 404, message: Not Found} +- request: + body: null + headers: + Accept: ['*/*'] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.19.1] + method: HEAD + uri: https://www.ndbc.noaa.gov/data/realtime2/41002.tide + response: + body: {string: ''} + headers: + Connection: [close] + Content-Encoding: [gzip] + Content-Length: ['20'] + Content-Type: [text/html; charset=iso-8859-1] + Date: ['Wed, 01 Aug 2018 16:36:58 GMT'] + Server: [Apache] + Strict-Transport-Security: [max-age=31536000;] + Vary: [Accept-Encoding] + status: {code: 404, message: Not Found} +- request: + body: null + headers: + Accept: ['*/*'] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.19.1] + method: HEAD + uri: https://www.ndbc.noaa.gov/data/realtime2/41002.srad + response: + body: {string: ''} + headers: + Connection: [close] + Content-Encoding: [gzip] + Content-Length: ['20'] + Content-Type: [text/html; charset=iso-8859-1] + Date: ['Wed, 01 Aug 2018 16:36:58 GMT'] + Server: [Apache] + Strict-Transport-Security: [max-age=31536000;] + Vary: [Accept-Encoding] + status: {code: 404, message: Not Found} +- request: + body: null + headers: + Accept: ['*/*'] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.19.1] + method: HEAD + uri: https://www.ndbc.noaa.gov/data/realtime2/41002.dart + response: + body: {string: ''} + headers: + Connection: [close] + Content-Encoding: [gzip] + Content-Length: ['20'] + Content-Type: [text/html; charset=iso-8859-1] + Date: ['Wed, 01 Aug 2018 16:36:59 GMT'] + Server: [Apache] + Strict-Transport-Security: [max-age=31536000;] + Vary: [Accept-Encoding] + status: {code: 404, message: Not Found} +- request: + body: null + headers: + Accept: ['*/*'] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.19.1] + method: HEAD + uri: https://www.ndbc.noaa.gov/data/realtime2/41002.supl + response: + body: {string: ''} + headers: + Accept-Ranges: [bytes] + Cache-Control: [must-revalidate] + Connection: [close] + Content-Encoding: [gzip] + Content-Length: ['36974'] + Content-Security-Policy: [frame-ancestors 'self'] + Content-Type: [text/plain; charset=ISO-8859-1] + Date: ['Wed, 01 Aug 2018 16:36:59 GMT'] + Last-Modified: ['Wed, 01 Aug 2018 16:27:25 GMT'] + Server: [Apache] + Strict-Transport-Security: [max-age=31536000;] + Vary: [Accept-Encoding] + X-Content-Type-Options: [nosniff] + X-Frame-Options: [SAMEORIGIN] + X-XSS-Protection: [1; mode=block] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: ['*/*'] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [python-requests/2.19.1] + method: HEAD + uri: https://www.ndbc.noaa.gov/data/realtime2/41002.rain + response: + body: {string: ''} + headers: + Connection: [close] + Content-Encoding: [gzip] + Content-Length: ['20'] + Content-Type: [text/html; charset=iso-8859-1] + Date: ['Wed, 01 Aug 2018 16:37:00 GMT'] + Server: [Apache] + Strict-Transport-Security: [max-age=31536000;] + Vary: [Accept-Encoding] + status: {code: 404, message: Not Found} +version: 1 diff --git a/siphon/tests/test_ndbc.py b/siphon/tests/test_ndbc.py index e0a0e5139..332d3cf60 100644 --- a/siphon/tests/test_ndbc.py +++ b/siphon/tests/test_ndbc.py @@ -266,3 +266,18 @@ def test_ndbc_latest(): assert(df.units['3hr_pressure_tendency'] == 'hPa') assert(df.units['water_level_above_mean'] == 'feet') assert(df.units['time'] is None) + + +@recorder.use_cassette('ndbc_buoy_data_types') +def test_ndbc_buoy_data_types(): + """Test determination of available buoy data.""" + resp = NDBC.buoy_data_types('41002') + truth = {'txt': 'standard meteorological data', + 'spec': 'spectral wave summaries', + 'data_spec': 'raw spectral wave data', + 'swdir': 'spectral wave data (alpha1)', + 'swdir2': 'spectral wave data (alpha2)', + 'swr1': 'spectral wave data (r1)', + 'swr2': 'spectral wave data (r2)', + 'supl': 'supplemental measurements data'} + assert(resp == truth)