Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Thomas Meurou
NF26 Project
Commits
f0eb967b
Commit
f0eb967b
authored
Jun 20, 2019
by
Tianyang
Browse files
Add moyen of season
parent
b40da489
Changes
4
Hide whitespace changes
Inline
Side-by-side
.DS_Store
View file @
f0eb967b
No preview for this file type
question1.png
View replaced file @
b40da489
View file @
f0eb967b
31.9 KB
|
W:
|
H:
99.7 KB
|
W:
|
H:
2-up
Swipe
Onion skin
question1.py
View file @
f0eb967b
...
...
@@ -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
):
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
...
...
@@ -166,9 +176,18 @@ def drawCourbe_season(session,season,target,targetNB,espace):
keys
[
index_each
]
=
"."
.
join
(
each
)
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
,[
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
,[
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
,[
mean_season_mean
for
i
in
range
(
longth
)],
'--'
)
plt
.
xticks
(
keys
,
keys
,
rotation
=
45
,
fontsize
=
5
)
plt
.
ylabel
(
target
)
plt
.
grid
(
True
)
...
...
@@ -194,7 +213,7 @@ if __name__ == "__main__":
#if choice == 1, we will use the fonction 1
if
choice
==
1
:
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]: "
)
timeNB
=
checkNBvariable
(
time
)
targetNB
=
checkNBvariable
(
target
)
...
...
question1_season.png
View replaced file @
b40da489
View file @
f0eb967b
32.5 KB
|
W:
|
H:
36.4 KB
|
W:
|
H:
2-up
Swipe
Onion skin
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment