forked from lzhenn/wrf-sdpwfe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
change_wps_namelist.py
41 lines (31 loc) · 1.03 KB
/
change_wps_namelist.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
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# Fetch GFS realtime forecast data from HKUST ENVR Server
# executed every day at 00:30
# L_Zealot
# Jan 06, 2018
#
#
import datetime
import requests
import os
# Main function
def main():
# Optional URL when data not available from HKUST
#url='ftp://ftpprd.ncep.noaa.gov/pub/data/nccf/com/gfs/prod/gfs.2018010512/'
# Fetch url
url0='http://envf.ust.hk/dataop/data/model_input/gfs_1.00deg_realtime/'
# Archive path
arpath='/home/lzhenn/array/lzhenn/gfs_fcst/'
date_lastday=datetime.datetime.now() datetime.timedelta(days=-1)
date_str=date_lastday.strftime('%Y%m%d')
arpath=arpath date_str
os.system('mkdir ' arpath)
for ii in range(0,168,6):
url=url0 'gfs.' date_str '12/' 'gfs.t12z.pgrb2.1p00.fd' % ii
print('fetching ' url)
r = requests.get(url)
with open(arpath '/' 'gfs.t12z.pgrb2.1p00.fd' % ii, 'wb') as code:
code.write(r.content)
if __name__=='__main__':
main()