-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathupdate.py
43 lines (38 loc) · 1.01 KB
/
update.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
"""Run all scripts to update current data"""
import logging
import sys
sys.path.append('..\util')
import common
from fpaloader import FPALoader
from gefsloader import GefsLoader
from gepsloader import GepsLoader
import dfoss
import gethistoric
import sst
def try_no_fail(fct):
"""!
Try to run function and ignore failure
@param fct Function to run
@return None
"""
try:
fct()
except KeyboardInterrupt as ke:
logging.debug('Aborting due to user cancel')
raise ke
except Exception as e:
logging.debug('Call failed but ignoring error')
def get_standard():
"""!
Get standard available weather
@return None
"""
try_no_fail(dfoss.load)
try_no_fail(gethistoric.get_standard)
try_no_fail(FPALoader().load_records)
try_no_fail(GefsLoader().load_records)
try_no_fail(GepsLoader().load_records)
try_no_fail(sst.load)
# run get_standard() for each file
if __name__ == "__main__":
get_standard()