seebuoy
seebuoy copied to clipboard
The data from buyo 46073 cannot be retreived.
I have pretty basic code (attached) which worked a month ago. It is mostly working now except https://www.ndbc.noaa.gov/station_page.php?station=46073. I'm getting an error ParserError: Error tokenizing data. C error: Expected 18 fields in line 2046, saw 35 anytime I try to get the data. Is it a problem with the seabuoy or NDBC did something wrong with his particular buoy?
Hi Paganelle76,
I wasn't able to reproduce the error. I tried the examples below for both real time and historical data and both returned without error. Would you be able to paste the full stack trace?
The working examples I tried:
REAL TIME
from seebuoy import NDBC
ndbc = NDBC(timeframe="real_time")
df_avail = ndbc.available_data(station_id="46073")
df = ndbc.get_data("46073")
The example above returns of data frame of shape (1080, 14)
.
HISTORICAL
ndbc = NDBC(timeframe="historical")
df_avail = ndbc.available_data(station_id="46073")
df = ndbc.get_data("46073")
The example above returns a data frame of shape (98335, 14)
.
Hi Nick,
This is the complete log. I've made the story even shorter:
Python 3.10.8 (main, Nov 24 2022, 14:13:03) [GCC 11.2.0] Type "copyright", "credits" or "license" for more information.
IPython 7.31.1 -- An enhanced Interactive Python.
from seebuoy import NDBCstation_id = "46071"ndbc = NDBC("historical")df_avail = ndbc.available_data(station_id=station_id)df_data = ndbc.get_data(station_id = station_id) Traceback (most recent call last):
File "/tmp/ipykernel_658626/2536812625.py", line 1, in
File "/home/ygonch/anaconda3/envs/seebuoy/lib/python3.10/site-packages/seebuoy/ndbc/ndbc.py", line 150, in get_data df = historical.get_dataset(txt_url, dataset, rename_cols=rename_cols)
File "/home/ygonch/anaconda3/envs/seebuoy/lib/python3.10/site-packages/seebuoy/ndbc/historical.py", line 300, in get_dataset df = parse_standard(txt, rename_cols=rename_cols)
File "/home/ygonch/anaconda3/envs/seebuoy/lib/python3.10/site-packages/seebuoy/ndbc/historical.py", line 160, in parse_standard df = base_parser(txt)
File "/home/ygonch/anaconda3/envs/seebuoy/lib/python3.10/site-packages/seebuoy/ndbc/historical.py", line 124, in base_parser df = pd.read_csv(
File "/home/ygonch/anaconda3/envs/seebuoy/lib/python3.10/site-packages/pandas/util/_decorators.py", line 211, in wrapper return func(*args, **kwargs)
File "/home/ygonch/anaconda3/envs/seebuoy/lib/python3.10/site-packages/pandas/util/_decorators.py", line 331, in wrapper return func(*args, **kwargs)
File "/home/ygonch/anaconda3/envs/seebuoy/lib/python3.10/site-packages/pandas/io/parsers/readers.py", line 950, in read_csv return _read(filepath_or_buffer, kwds)
File "/home/ygonch/anaconda3/envs/seebuoy/lib/python3.10/site-packages/pandas/io/parsers/readers.py", line 611, in _read return parser.read(nrows)
File "/home/ygonch/anaconda3/envs/seebuoy/lib/python3.10/site-packages/pandas/io/parsers/readers.py", line 1778, in read ) = self._engine.read( # type: ignore[attr-defined]
File "/home/ygonch/anaconda3/envs/seebuoy/lib/python3.10/site-packages/pandas/io/parsers/c_parser_wrapper.py", line 230, in read chunks = self._reader.read_low_memory(nrows)
File "pandas/_libs/parsers.pyx", line 808, in pandas._libs.parsers.TextReader.read_low_memory
File "pandas/_libs/parsers.pyx", line 866, in pandas._libs.parsers.TextReader._read_rows
File "pandas/_libs/parsers.pyx", line 852, in pandas._libs.parsers.TextReader._tokenize_rows
File "pandas/_libs/parsers.pyx", line 1973, in pandas._libs.parsers.raise_parser_error
ParserError: Error tokenizing data. C error: Expected 18 fields in line 2046, saw 35
On Mon, Mar 20, 2023 at 6:56 PM Nick Cortale @.***> wrote:
Hi Paganelle76,
I wasn't able to reproduce the error. I tried the examples below for both real time and historical data and both returned without error. Would you be able to paste the full stack trace?
The working examples I tried:
REAL TIME
from seebuoy import NDBC ndbc = NDBC(timeframe="real_time")df_avail = ndbc.available_data(station_id="46073") df = ndbc.get_data("46073")
The example above returns of data frame of shape (1080, 14).
HISTORICAL
ndbc = NDBC(timeframe="historical")df_avail = ndbc.available_data(station_id="46073") df = ndbc.get_data("46073")
The example above returns a data frame of shape (98335, 14).
— Reply to this email directly, view it on GitHub https://github.com/nickc1/seebuoy/issues/23#issuecomment-1477140719, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWEDJGZN5462D7PIZJVM5XDW5D4CNANCNFSM6AAAAAAWBPTI24 . You are receiving this because you authored the thread.Message ID: @.***>
Hey, I also have a problem with the get_data
function for dataset="raw_spectral"
. It seems like there's something wrong with the parse_raw_spectral()
function (or the wrong df is being called):
ValueError: time data '#yr mo dy hr mn' does not match format '%Y %m %d %H %M' (match)