Commit f0eb967b authored by Tianyang's avatar Tianyang
Browse files

Add moyen of season

parent b40da489
No preview for this file type
question1.png

31.9 KB | W: | H:

question1.png

99.7 KB | W: | H:

question1.png
question1.png
question1.png
question1.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -151,6 +151,16 @@ def checkNBvariable (x): ...@@ -151,6 +151,16 @@ def checkNBvariable (x):
#Caculate the mean of the values of each season
def caculateMean_Season(result):
i = 0
total = 0
for each in result:
total += each
i += 1
return total/i , i
def drawCourbe_season(session,season,target,targetNB,espace): def drawCourbe_season(session,season,target,targetNB,espace):
data = session.execute_async("select * from caitiany.database_espace where station = '%s'"%espace ) data = session.execute_async("select * from caitiany.database_espace where station = '%s'"%espace )
#We do the same map reduce as fonction 1 by fixing the time as season #We do the same map reduce as fonction 1 by fixing the time as season
...@@ -166,9 +176,18 @@ def drawCourbe_season(session,season,target,targetNB,espace): ...@@ -166,9 +176,18 @@ def drawCourbe_season(session,season,target,targetNB,espace):
keys[index_each] = ".".join(each) keys[index_each] = ".".join(each)
fig, ax = plt.subplots(1, 1) fig, ax = plt.subplots(1, 1)
mean_season_mean, longth = caculateMean_Season(zipped_result[0])
plt.plot(keys,zipped_result[0],'x-',label="mean") plt.plot(keys,zipped_result[0],'x-',label="mean")
plt.plot(keys,[mean_season_mean for i in range(longth)],'--')
mean_season_mean, longth = caculateMean_Season(zipped_result[1])
plt.plot(keys,zipped_result[1],'+-',label="max") plt.plot(keys,zipped_result[1],'+-',label="max")
plt.plot(keys,[mean_season_mean for i in range(longth)],'--')
mean_season_mean, longth = caculateMean_Season(zipped_result[2])
plt.plot(keys,zipped_result[2],'b--',label="min") plt.plot(keys,zipped_result[2],'b--',label="min")
plt.plot(keys,[mean_season_mean for i in range(longth)],'--')
plt.xticks(keys, keys, rotation=45, fontsize=5) plt.xticks(keys, keys, rotation=45, fontsize=5)
plt.ylabel(target) plt.ylabel(target)
plt.grid(True) plt.grid(True)
...@@ -194,7 +213,7 @@ if __name__ == "__main__": ...@@ -194,7 +213,7 @@ if __name__ == "__main__":
#if choice == 1, we will use the fonction 1 #if choice == 1, we will use the fonction 1
if choice == 1: if choice == 1:
espace = input("Please enter which station you want to search [LEBZ,LETO,etc]: ") espace = input("Please enter which station you want to search [LEBZ,LETO,etc]: ")
time = input("By which kind of time [year,season,month,etc]: ") time = input("By which kind of time [year,season,month]: ")
target = input("Which indicator do you want to check [tmpf,dwpf,etc]: ") target = input("Which indicator do you want to check [tmpf,dwpf,etc]: ")
timeNB = checkNBvariable(time) timeNB = checkNBvariable(time)
targetNB = checkNBvariable(target) targetNB = checkNBvariable(target)
......
question1_season.png

32.5 KB | W: | H:

question1_season.png

36.4 KB | W: | H:

question1_season.png
question1_season.png
question1_season.png
question1_season.png
  • 2-up
  • Swipe
  • Onion skin
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment