forked from flashlxy/PyMICAPS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Products.py
51 lines (40 loc) · 1.37 KB
/
Products.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
# -*- coding: utf-8 -*-
# 产品参数类 关联模块Main,maskout和类Micaps3Data,Micaps4Data,Projection, HeadDesc
# Author: Liu xianyao
# Email: [email protected]
# Update: 2017-04-11
# Copyright: ©江西省气象台 2017
# Version: 2.0.20170411
import os
import re
from datetime import datetime
from xml.etree import ElementTree
from matplotlib.path import Path
import maskout
from Map import Map
from MicapsFile import MicapsFile
from Picture import Picture
class Products:
"""
画图参数的封装类
用法:
"""
def __init__(self, xmlfile):
self.xmlfile = xmlfile
if not os.path.exists(self.xmlfile):
return
try:
tree = ElementTree.parse(self.xmlfile)
p = tree.getroot()
# 地图
self.map = Map(p)
# get picture para class
self.picture = Picture(p, self.map.clipborders)
# Get the micaps files list
self.micapsfiles = []
micapsfiles = p.find("MicapsFiles").getchildren()
for micapsfile in micapsfiles:
self.micapsfiles.append(MicapsFile(micapsfile))
except Exception as err:
print(u'【{0}】{1}-{2}'.format(self.xmlfile, err, datetime.now()))
return None