GithubHelp home page GithubHelp logo

Comments (7)

stcui007 avatar stcui007 commented on June 1, 2024 1

from hydrotools.

stcui007 avatar stcui007 commented on June 1, 2024 1

from hydrotools.

jarq6c avatar jarq6c commented on June 1, 2024

Thanks Shengting.

I successfully reproduced the error with the following:

from hydrotools.nwis_client.iv import IVDataService

service = IVDataService(value_time_label="value_time")
obs = service.get(
    sites=["01189000"],
    startDt="2015-12-01T00:00",
    endDt="2015-12-31T23:45"
)

The error seems to originate here:

dfs.loc[:, "value"] = pd.to_numeric(dfs["value"], downcast="float")

Looks like the issue is when NWIS returns an empty time series it results in an empty pandas.DataFrame. A KeyError is raised when the tool attempts to optimize the float values. As I recall, older versions of nwis_client would check for this using pandas.DataFrame.empty before attempting any optimizations. It looks like this functionality may have been lost during the asyncio transition.

I'll ping @aaraney for input.

from hydrotools.

aaraney avatar aaraney commented on June 1, 2024

@stcui007, thanks for reporting this and thanks @jarq6c for verifying and reproducing the bug. I was able to reproduce it locally as well. I believe your thinking is correct @jarq6c, some logic was changed in #86. I will submit a PR and reference it here. Thanks!

from hydrotools.

stcui007 avatar stcui007 commented on June 1, 2024

from hydrotools.

aaraney avatar aaraney commented on June 1, 2024

@stcui007, no worries. My apology if I implicitly suggested that you needed to do anything. This was just a bug in the software. #134 should resolve the issue.

from hydrotools.

jarq6c avatar jarq6c commented on June 1, 2024

Fix has been deployed:
https://pypi.org/project/hydrotools.nwis-client/3.0.5/

@stcui007 @aaraney @hellkite500

from hydrotools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.