-
Notifications
You must be signed in to change notification settings - Fork 0
/
CloudDetection.py
49 lines (32 loc) · 1 KB
/
CloudDetection.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
# Author - Quazi Rabbi
# Date Created - 5/29/2018
# Version - 1.0
# Description -
# Detectes clouds from downloading image from website
import numpy as np
import urllib , urllib2
import ImageProcessing as IPr
import date as dt
class cloud:
def __init__(self,TimePST):
self.PST = TimePST
self.UTC = TimePST #should be changed later
self.Image_Processing(self.UTC)
def Image_Processing(self,TimeUTC):
if self.Image_Download(TimeUTC):
self.CloudValue = IPr.Image_Processing(TimeUTC)
print self.CloudValue
else:
return 0
def Image_Download(self,TimeUTC):
date = dt.date()
link = "https://weather.gc.ca/data/prog/regional/"+date+"00/"+date+"00_054_R1_north@america@northwest_I_ASTRO_nt_0"+str(TimeUTC).zfill(2)+".png"
dowloadPic = "Images/Image"+str(TimeUTC)+".jpg"
print TimeUTC
try:
urllib2.urlopen(link)
urllib.urlretrieve(link, dowloadPic)
return 1
except:
return 0
obj = [cloud(i) for i in range(49)]