mesowx / MesoPy

A Python wrapper for the MesoWest environmental data API
MIT License
59 stars 23 forks source link

Crashes on querying for RAWS station percipitation #25

Closed pingyangtiaer closed 6 years ago

pingyangtiaer commented 6 years ago

Hi, I tried use the MesoPy precip to get the precipitation for RAWS stations, e.g. if I use the ASOS stations as stid it works: precip = m.precip(stid='KCLL', start='201712131200', end='201712141200', units='precip|in') however, If I just changed it to raws station: precip = m.precip(stid='CDDT2', start='201712131200', end='201712141200', units='precip|in') It gives me a MesoPy.MesoPyError: 'No results were found matching your query' Does that mean the MesoPy doesn't support RAWS stations? How should I do if I want the pecipitation for the RAWS stations? Looking forward t hearing from you. Thanks, Ping Yang(Peter)

adamabernathy commented 6 years ago

@pingyangtiaer What you're seeing is that there is no data available for CDDT at that time period.

Here's the raw query below

http://api.mesowest.net/v2/stations/precipitation?token=tk2018jan0117y4VDmb2UWqZ00IyNB3a&stid=CDDT2&start=201712131200&end=201712141200&units=precip|in

I'll add in some code to catch the empty response and return a None rather than crashing.

adamabernathy commented 6 years ago

@pingyangtiaer do a pip update on the package now. For queries that don't don't return any stations the empty API response will just be a None now.

pingyangtiaer commented 6 years ago

I did following: python -m pip uninstall MesoPy Successfully uninstalled MesoPy-2.0.2 Then I reinstall it again: Successfully uninstalled MesoPy-2.0.2 but it still not working. and I did c:\DEV\MesoNet>python -m pip install update MesoPy Requirement already satisfied: update in c:\python27\arcgisx6410.5\lib\site-packages Requirement already satisfied: MesoPy in c:\python27\arcgisx6410.5\lib\site-packages Requirement already satisfied: style==1.1.0 in c:\python27\arcgisx6410.5\lib\site-packages (from update)

However, It still have same issue. Was my update correctly?

adamabernathy commented 6 years ago

The new build is MesoPy-2.0.3.

You can install it directly from source with

pip install https://github.com/mesowx/MesoPy/archive/2.0.3.tar.gz
pingyangtiaer commented 6 years ago

It worked! Thank you so much.