Skip to content

Commit a661af3

Browse files
committed
22
0 parents  commit a661af3

11 files changed

+413
-0
lines changed

.vscode/launch.json

Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Python",
6+
"type": "python",
7+
"request": "launch",
8+
"stopOnEntry": true,
9+
"pythonPath": "${config:python.pythonPath}",
10+
"program": "${file}",
11+
"cwd": "${workspaceRoot}",
12+
"env": {},
13+
"envFile": "${workspaceRoot}/.env",
14+
"debugOptions": [
15+
"WaitOnAbnormalExit",
16+
"WaitOnNormalExit",
17+
"RedirectOutput"
18+
]
19+
},
20+
{
21+
"name": "PySpark",
22+
"type": "python",
23+
"request": "launch",
24+
"stopOnEntry": true,
25+
"osx": {
26+
"pythonPath": "${env:SPARK_HOME}/bin/spark-submit"
27+
},
28+
"windows": {
29+
"pythonPath": "${env:SPARK_HOME}/bin/spark-submit.cmd"
30+
},
31+
"linux": {
32+
"pythonPath": "${env:SPARK_HOME}/bin/spark-submit"
33+
},
34+
"program": "${file}",
35+
"cwd": "${workspaceRoot}",
36+
"env": {},
37+
"envFile": "${workspaceRoot}/.env",
38+
"debugOptions": [
39+
"WaitOnAbnormalExit",
40+
"WaitOnNormalExit",
41+
"RedirectOutput"
42+
]
43+
},
44+
{
45+
"name": "Python Module",
46+
"type": "python",
47+
"request": "launch",
48+
"stopOnEntry": true,
49+
"pythonPath": "${config:python.pythonPath}",
50+
"module": "module.name",
51+
"cwd": "${workspaceRoot}",
52+
"env": {},
53+
"envFile": "${workspaceRoot}/.env",
54+
"debugOptions": [
55+
"WaitOnAbnormalExit",
56+
"WaitOnNormalExit",
57+
"RedirectOutput"
58+
]
59+
},
60+
{
61+
"name": "Integrated Terminal/Console",
62+
"type": "python",
63+
"request": "launch",
64+
"stopOnEntry": true,
65+
"pythonPath": "${config:python.pythonPath}",
66+
"program": "${file}",
67+
"cwd": "",
68+
"console": "integratedTerminal",
69+
"env": {},
70+
"envFile": "${workspaceRoot}/.env",
71+
"debugOptions": [
72+
"WaitOnAbnormalExit",
73+
"WaitOnNormalExit"
74+
]
75+
},
76+
{
77+
"name": "External Terminal/Console",
78+
"type": "python",
79+
"request": "launch",
80+
"stopOnEntry": true,
81+
"pythonPath": "${config:python.pythonPath}",
82+
"program": "${file}",
83+
"cwd": "",
84+
"console": "externalTerminal",
85+
"env": {},
86+
"envFile": "${workspaceRoot}/.env",
87+
"debugOptions": [
88+
"WaitOnAbnormalExit",
89+
"WaitOnNormalExit"
90+
]
91+
},
92+
{
93+
"name": "Django",
94+
"type": "python",
95+
"request": "launch",
96+
"stopOnEntry": true,
97+
"pythonPath": "${config:python.pythonPath}",
98+
"program": "${workspaceRoot}/manage.py",
99+
"cwd": "${workspaceRoot}",
100+
"args": [
101+
"runserver",
102+
"--noreload"
103+
],
104+
"env": {},
105+
"envFile": "${workspaceRoot}/.env",
106+
"debugOptions": [
107+
"WaitOnAbnormalExit",
108+
"WaitOnNormalExit",
109+
"RedirectOutput",
110+
"DjangoDebugging"
111+
]
112+
},
113+
{
114+
"name": "Flask",
115+
"type": "python",
116+
"request": "launch",
117+
"stopOnEntry": false,
118+
"pythonPath": "${config:python.pythonPath}",
119+
"program": "fully qualified path fo 'flask' executable. Generally located along with python interpreter",
120+
"cwd": "${workspaceRoot}",
121+
"env": {
122+
"FLASK_APP": "${workspaceRoot}/quickstart/app.py"
123+
},
124+
"args": [
125+
"run",
126+
"--no-debugger",
127+
"--no-reload"
128+
],
129+
"envFile": "${workspaceRoot}/.env",
130+
"debugOptions": [
131+
"WaitOnAbnormalExit",
132+
"WaitOnNormalExit",
133+
"RedirectOutput"
134+
]
135+
},
136+
{
137+
"name": "Flask (old)",
138+
"type": "python",
139+
"request": "launch",
140+
"stopOnEntry": false,
141+
"pythonPath": "${config:python.pythonPath}",
142+
"program": "${workspaceRoot}/run.py",
143+
"cwd": "${workspaceRoot}",
144+
"args": [],
145+
"env": {},
146+
"envFile": "${workspaceRoot}/.env",
147+
"debugOptions": [
148+
"WaitOnAbnormalExit",
149+
"WaitOnNormalExit",
150+
"RedirectOutput"
151+
]
152+
},
153+
{
154+
"name": "Pyramid",
155+
"type": "python",
156+
"request": "launch",
157+
"stopOnEntry": true,
158+
"pythonPath": "${config:python.pythonPath}",
159+
"cwd": "${workspaceRoot}",
160+
"env": {},
161+
"envFile": "${workspaceRoot}/.env",
162+
"args": [
163+
"${workspaceRoot}/development.ini"
164+
],
165+
"debugOptions": [
166+
"WaitOnAbnormalExit",
167+
"WaitOnNormalExit",
168+
"RedirectOutput",
169+
"Pyramid"
170+
]
171+
},
172+
{
173+
"name": "Watson",
174+
"type": "python",
175+
"request": "launch",
176+
"stopOnEntry": true,
177+
"pythonPath": "${config:python.pythonPath}",
178+
"program": "${workspaceRoot}/console.py",
179+
"cwd": "${workspaceRoot}",
180+
"args": [
181+
"dev",
182+
"runserver",
183+
"--noreload=True"
184+
],
185+
"env": {},
186+
"envFile": "${workspaceRoot}/.env",
187+
"debugOptions": [
188+
"WaitOnAbnormalExit",
189+
"WaitOnNormalExit",
190+
"RedirectOutput"
191+
]
192+
},
193+
{
194+
"name": "Attach (Remote Debug)",
195+
"type": "python",
196+
"request": "attach",
197+
"localRoot": "${workspaceRoot}",
198+
"remoteRoot": "${workspaceRoot}",
199+
"port": 3000,
200+
"secret": "my_secret",
201+
"host": "localhost"
202+
}
203+
]
204+
}

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// 将设置放入此文件中以覆盖默认值和用户设置。
2+
{
3+
}

HTBCG2016120100-006.grb

43.6 MB
Binary file not shown.

doPygrib.py

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# coding=UTF-8
2+
# print('测试')
3+
import sys
4+
import importlib
5+
import pygrib
6+
import os
7+
#import reload
8+
# 具体步骤:
9+
# 1 获取文件的一些信息(传入参数)
10+
# 2 找到对应文件——目前先根据预报要素、时间、时效
11+
# 3 读取文件
12+
# 4 根据经纬度二维数组以及层级获取指定的gribmessage
13+
# 5 根据经纬度找到对应的区域并取出对应的结果一维数组
14+
importlib.reload(sys)
15+
16+
#reload(sys)
17+
#sys.setdefaultencoding('utf8')
18+
# 2 找到对应文件——目前先根据预报要素、时间、时效
19+
forecastType='HTBCG'
20+
targetDateTime='201612010000'
21+
aging=6
22+
grbname_array=[forecastType,targetDateTime,'-',aging,'.grb']
23+
targetName=''.join(grbname_array)
24+
targetPath='/usr/testFIles/'
25+
targetFullName=targetPath+targetName
26+
# 判断指定路径及是否存在指定文件
27+
if not os.path.exists(targetPath):
28+
print('路径'+targetName+'不存在')
29+
elif os.path.exists(targetFullName):
30+
print('指定文件'+targetFullName+'不存在')
31+
else:
32+
print('文件:'+targetName+'存在')
33+
34+
# 读取文件
35+
# grbs=pygrib.open(targetFullName)
36+
grbs=pygrib.open('')
37+
grbs.seek(0)
38+
39+
# 4 根据经纬度二维数组以及层级获取指定的gribmessage
40+
# for grb in grbs:
41+
# print(grb)
42+
# print(grb.values)
43+
# grb.get_count()
44+
grbs
45+
data= grbs[1].values
46+
print(grbs[1].latlons)
47+
# for temp in len(data[0]):
48+
# for
49+
50+
print(grbs[1][1].values)
51+
print(data)
52+
# 获取数组的长度
53+
lenghth=grbs.messagenumber
54+
55+
# 获取数组中每个对象的长度
56+
count_temp=len(grbs[1])
57+
temp=grbs[1]
58+
latlon=grbs[1].latlons()[0]
59+
print(latlon)
60+
# print(type(data))
61+
print(data.shap,data.min(),data.max())
62+
lat=grb.latlons()
63+
print(lat)
64+
65+
#通过grbs[1].values的方式可以读取文件
66+
# grb = grbs.select(name='regular_ll')[0]
67+
# data = grb.values
68+
# print(data)
69+
print('测试')
70+

teset.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import sys
2+
import importlib
3+
import pygrib
4+
#import reload
5+
importlib.reload(sys)
6+
#reload(sys)
7+
sys.setdefaultencoding('utf8')
8+
grbs=pygrib.open('/usr/testFIles/HTBCG2016120100-006.grb')
9+
grbs.seek(0)
10+
for grb in grbs:
11+
print(str(grb))

vscode使用说明.odt

12 KB
Binary file not shown.

vscode出现的一些问题.odt

56.1 KB
Binary file not shown.

安装说明文档.odt

21.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)