-
Notifications
You must be signed in to change notification settings - Fork 0
/
populate_dewpointtemp.py
61 lines (36 loc) · 1.42 KB
/
populate_dewpointtemp.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
from dolibs import dewpoint as st
from datetime import datetime
from datetime import date
import calendar
import pathlib
import urllib.parse
import sys
from dateutil.relativedelta import relativedelta
#previous_date = date.today() + relativedelta(days=-60)
#currentMonth = datetime.now().month
#currentYear = datetime.now().year
#prevYear = previous_date.year
#prevMonth = previous_date.month
#prevDay = 1
#icount = False
i_month = sys.argv[1]
i_year = sys.argv[2]
#print('clean old images')
#st.del_image('postgresql://satserv:ss!2017pwd@droughtsdi.fi.ibimet.cnr.it/gisdb',
# str(date(prevYear,prevMonth,prevDay)),
# str(date(currentYear,currentMonth,calendar.monthrange(currentYear, currentMonth)[1])))
list_of_days = list(filter(lambda x: isinstance(x,str),['01','02','03','04','05','06','07','08','09','10',
'11','12','13','14','15','16','17','18','19','20',
'21','22','23','24','25','26','27','28','29','30','31']))
#while (icount == False):
# print('Begin procedure for '+str(i_year)+'-'+str(i_month))
st.get_n_save(i_year,i_month,str(pathlib.Path(__file__).parent.resolve()), list_of_days)
# if((i_month == currentMonth) and (i_year == currentYear)):
# icount = True
# else:
# if(i_month == 12):
# i_month = 1
# i_year = i_year + 1
# else:
# i_month = i_month + 1
print('done')