-
Notifications
You must be signed in to change notification settings - Fork 157
/
Main.py
59 lines (48 loc) · 1.25 KB
/
Main.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# -*- coding: utf-8 -*-
#
# Author: Liu xianyao
# Email: [email protected]
# Update: 2017-04-11
# Copyright: ©江西省气象台 2017
# Version: 2.0.20170411
import sys
import math
from itertools import takewhile
from FnTime import fn_timer
def parseInt(s):
"""
全局函数 字符串转整数
:param s: 字符串
:return: 整数
"""
assert isinstance(s, str)
return (
int("".join(list(takewhile(lambda x: x.isdigit(), s))))
if s[0].isdigit()
else None
)
def equal(value1, value2):
return math.fabs(value1 - value2) < 10e-5
@fn_timer
def main(debug):
"""
主程序
:param debug:
:return:
"""
if debug:
xml = r"config.xml"
else:
if len(sys.argv) < 2:
print("参数不够,至少需要一个xml文件名参数")
sys.exit()
xml = sys.argv[1]
from Products import Products
products = Products(xml)
if products is not None:
for micapsfile in products.micapsfiles:
micapsfile.file.micapsdata.Draw(products, micapsfile, debug)
# break
if __name__ == "__main__":
ISDEBUG = True
main(ISDEBUG)