ArtesiaWater / hydropandas

Module for loading observation data into custom DataFrames
https://hydropandas.readthedocs.io
MIT License
51 stars 11 forks source link

Test `test_get_wow_nearest` fails #234

Open OnnoEbbens opened 3 days ago

OnnoEbbens commented 3 days ago

See this action report: https://github.com/ArtesiaWater/hydropandas/actions/runs/10883569910/job/30197015796?pr=233

_____________________________ test_get_wow_nearest _____________________________

    def test_get_wow_nearest() -> None:
        lat = -35.4184
        lon = 149.0937
        xy = [lon, lat]
        start = pd.Timestamp(year=2023, month=6, day=4, hour=1, minute=34, second=0)
        end = pd.Timestamp(year=2023, month=6, day=5, hour=23, minute=54, second=0)
>       obs = hpd.PrecipitationObs.from_wow(xy=xy, start=start, end=end)

tests/test_012_wow.py:27: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.tox/py312/lib/python3.12/site-packages/hydropandas/observation.py:1417: in from_wow
    return super().from_wow(
.tox/py312/lib/python3.12/site-packages/hydropandas/observation.py:1169: in from_wow
    wow_df, meta = wow.get_wow(
.tox/py312/lib/python3.12/site-packages/hydropandas/io/wow.py:171: in get_wow
    measurements = get_wow_measurements(
.tox/py312/lib/python3.12/site-packages/hydropandas/io/wow.py:245: in get_wow_measurements
    meas = pd.read_csv(url, delimiter=";", index_col=["datum"])
.tox/py312/lib/python3.12/site-packages/pandas/io/parsers/readers.py:1026: in read_csv
    return _read(filepath_or_buffer, kwds)
.tox/py312/lib/python3.12/site-packages/pandas/io/parsers/readers.py:620: in _read
    parser = TextFileReader(filepath_or_buffer, **kwds)
.tox/py312/lib/python3.12/site-packages/pandas/io/parsers/readers.py:1620: in __init__
    self._engine = self._make_engine(f, self.engine)
.tox/py312/lib/python3.12/site-packages/pandas/io/parsers/readers.py:1880: in _make_engine
    self.handles = get_handle(
.tox/py312/lib/python3.12/site-packages/pandas/io/common.py:728: in get_handle
    ioargs = _get_filepath_or_buffer(
.tox/py312/lib/python3.12/site-packages/pandas/io/common.py:384: in _get_filepath_or_buffer
    with urlopen(req_info) as req:
.tox/py312/lib/python3.12/site-packages/pandas/io/common.py:289: in urlopen
    return urllib.request.urlopen(*args, **kwargs)
/opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/urllib/request.py:215: in urlopen
    return opener.open(url, data, timeout)
/opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/urllib/request.py:521: in open
    response = meth(req, response)
/opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/urllib/request.py:630: in http_response
    response = self.parent.error(
/opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/urllib/request.py:559: in error
    return self._call_chain(*args)
/opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/urllib/request.py:492: in _call_chain
    result = func(*args)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <urllib.request.HTTPDefaultErrorHandler object at 0x7f37ec5bfb90>
req = <urllib.request.Request object at 0x7f37ec2637d0>
fp = <http.client.HTTPResponse object at 0x7f37ebcee770>, code = 502
msg = 'Bad Gateway', hdrs = <http.client.HTTPMessage object at 0x7f37e8e42120>

    def http_error_default(self, req, fp, code, msg, hdrs):
>       raise HTTPError(req.full_url, code, msg, hdrs, fp)
E       urllib.error.HTTPError: HTTP Error 502: Bad Gateway

/opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/urllib/request.py:639: HTTPError
OnnoEbbens commented 3 days ago

I googled the error and it means: A 502 bad gateway message indicates that one server got an invalid response from another

It seems a bit random when the error occurs. I will disable the tests for now until we can solve this