sharppy / SHARPpy

Sounding/Hodograph Analysis and Research Program in Python
https://sharppy.github.io/SHARPpy/index.html
Other
216 stars 112 forks source link

full_gui.py will not start - SPC page unavailable #67

Closed dangoff closed 8 years ago

dangoff commented 9 years ago

Windows 8.0 Enterprise, just installed SHARPpy 1.2.0 yesterday

Upon trying to run the application tonight:

C:\Users\Dan>python "C:\SHARPpy\runsharp\full_gui.py"
Traceback (most recent call last):
  File "C:\SHARPpy\runsharp\full_gui.py", line 635, in <module>
    win = MainWindow()
  File "C:\SHARPpy\runsharp\full_gui.py", line 191, in __init__
    self.__initUI()
  File "C:\SHARPpy\runsharp\full_gui.py", line 208, in __initUI
    self.view = self.create_map_view()
  File "C:\SHARPpy\runsharp\full_gui.py", line 358, in create_map_view
    view = MapWidget(self.data_sources[self.model], self.run, self.async, width=
800, height=500)
  File "c:\program files\enthought\canopy\user\lib\site-packages\sharppy-1.2.0-p
y2.7.egg\sharppy\viz\map.py", line 168, in __init__
    self.setDataSource(data_source, init_time, init=True)
  File "c:\program files\enthought\canopy\user\lib\site-packages\sharppy-1.2.0-p
y2.7.egg\sharppy\viz\map.py", line 209, in setDataSource
    self.setCurrentTime(data_time, init=init)
  File "c:\program files\enthought\canopy\user\lib\site-packages\sharppy-1.2.0-p
y2.7.egg\sharppy\viz\map.py", line 252, in setCurrentTime
    points = getPoints()
  File "c:\program files\enthought\canopy\user\lib\site-packages\sharppy-1.2.0-p
y2.7.egg\sharppy\viz\map.py", line 218, in <lambda>
    getPoints = lambda: self.cur_source.getAvailableAtTime(self.current_time)
  File "C:\Users\Dan\.sharppy\datasources\data_source.py", line 237, in getAvail
ableAtTime
    points = self._get('getAvailableAtTime', outlet, flatten=False, dt=dt)
  File "C:\Users\Dan\.sharppy\datasources\data_source.py", line 191, in _get
    prop.append(func(**kwargs))
  File "C:\Users\Dan\.sharppy\datasources\data_source.py", line 116, in getAvail
ableAtTime
    avail = available.availableat[self._name.lower()][self._ds_name.lower()](dt)

  File "C:\Users\Dan\.sharppy\datasources\available.py", line 15, in _availablea
t_spc
    text = urllib2.urlopen(recent_url).read()
  File "C:\Program Files\Enthought\Canopy\App\appdata\canopy-1.5.2.2785.win-x86_
64\lib\urllib2.py", line 127, in urlopen
    return _opener.open(url, data, timeout)
  File "C:\Program Files\Enthought\Canopy\App\appdata\canopy-1.5.2.2785.win-x86_
64\lib\urllib2.py", line 410, in open
    response = meth(req, response)
  File "C:\Program Files\Enthought\Canopy\App\appdata\canopy-1.5.2.2785.win-x86_
64\lib\urllib2.py", line 523, in http_response
    'http', request, response, code, msg, hdrs)
  File "C:\Program Files\Enthought\Canopy\App\appdata\canopy-1.5.2.2785.win-x86_
64\lib\urllib2.py", line 448, in error
    return self._call_chain(*args)
  File "C:\Program Files\Enthought\Canopy\App\appdata\canopy-1.5.2.2785.win-x86_
64\lib\urllib2.py", line 382, in _call_chain
    result = func(*args)
  File "C:\Program Files\Enthought\Canopy\App\appdata\canopy-1.5.2.2785.win-x86_
64\lib\urllib2.py", line 531, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 403: Forbidden

As was mentioned in [https://github.com/sharppy/SHARPpy/issues/65](issue #65), the application will not start if SPC is in the middle of posting profiles - there's a page there (http://www.spc.noaa.gov/exper/soundings/15051800_OBS/), but it really wasn't there yet, which triggered the HTTP 403 error.

Rather than crashing, is it possible to have the URL fall back to the previous 6-hourly (or 12-hourly) standard synoptic time? In this case, falling back to to either 18Z or 12Z on 2015-05-17, so that the application would still load successfully?

dangoff commented 9 years ago

Since I started writing this up, SPC published the sounding page for 2015-05-18 00Z, and the application is starting correctly now. However, if the SPC issue is a frequent occurrence (I'm guessing it may be?), a fallback option would be nice.

tsupinie commented 9 years ago

Yeah, I have a fix for that in a local branch I might try to commit today. It's not usually this much of an issue, but it has been in the last couple days I've noticed.

tsupinie commented 9 years ago

Okay, there's a fix committed to the repository now. Let me know if it helps.