Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nf26_projet
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Romain Creuzenet
nf26_projet
Commits
6dabbbad
Commit
6dabbbad
authored
Jun 10, 2019
by
Romain Creuzenet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
courbe ok
parent
0fbf76c1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
13 deletions
+74
-13
.idea/workspace.xml
.idea/workspace.xml
+5
-8
main.py
main.py
+69
-5
No files found.
.idea/workspace.xml
View file @
6dabbbad
...
@@ -2,10 +2,7 @@
...
@@ -2,10 +2,7 @@
<project
version=
"4"
>
<project
version=
"4"
>
<component
name=
"ChangeListManager"
>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"dec891dc-2fad-4291-af33-64d4fd64029d"
name=
"Default Changelist"
comment=
""
>
<list
default=
"true"
id=
"dec891dc-2fad-4291-af33-64d4fd64029d"
name=
"Default Changelist"
comment=
""
>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/main.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/main.py"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/create_table.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/create_table.py"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/espagne_2001_2010.csv"
beforeDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/parameters.py"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/parameters.py"
afterDir=
"false"
/>
</list>
</list>
<option
name=
"EXCLUDED_CONVERTED_TO_IGNORED"
value=
"true"
/>
<option
name=
"EXCLUDED_CONVERTED_TO_IGNORED"
value=
"true"
/>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
...
@@ -30,8 +27,8 @@
...
@@ -30,8 +27,8 @@
<file
pinned=
"false"
current-in-tab=
"true"
>
<file
pinned=
"false"
current-in-tab=
"true"
>
<entry
file=
"file://$PROJECT_DIR$/main.py"
>
<entry
file=
"file://$PROJECT_DIR$/main.py"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
507
"
>
<state
relative-caret-position=
"
298
"
>
<caret
line=
"
64"
column=
"8"
selection-start-line=
"64"
selection-start-column=
"8"
selection-end-line=
"64"
selection-end-column=
"8
"
/>
<caret
line=
"
112"
selection-start-line=
"112"
selection-end-line=
"112
"
/>
<folding>
<folding>
<element
signature=
"e#38#56#0"
expanded=
"true"
/>
<element
signature=
"e#38#56#0"
expanded=
"true"
/>
</folding>
</folding>
...
@@ -332,8 +329,8 @@
...
@@ -332,8 +329,8 @@
</entry>
</entry>
<entry
file=
"file://$PROJECT_DIR$/main.py"
>
<entry
file=
"file://$PROJECT_DIR$/main.py"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
507
"
>
<state
relative-caret-position=
"
298
"
>
<caret
line=
"
64"
column=
"8"
selection-start-line=
"64"
selection-start-column=
"8"
selection-end-line=
"64"
selection-end-column=
"8
"
/>
<caret
line=
"
112"
selection-start-line=
"112"
selection-end-line=
"112
"
/>
<folding>
<folding>
<element
signature=
"e#38#56#0"
expanded=
"true"
/>
<element
signature=
"e#38#56#0"
expanded=
"true"
/>
</folding>
</folding>
...
...
main.py
View file @
6dabbbad
"""File to execute to show results"""
"""File to execute to show results"""
import
numpy
as
np
import
numpy
as
np
import
matplotlib.pyplot
as
plt
import
matplotlib.pyplot
as
plt
from
datetime
import
datetime
from
datetime
import
datetime
,
timedelta
from
parameters
import
SESSION
from
parameters
import
SESSION
...
@@ -40,10 +40,15 @@ class Manager:
...
@@ -40,10 +40,15 @@ class Manager:
self
.
table
=
"TABLE_SPACE"
self
.
table
=
"TABLE_SPACE"
# Search station
# Search station
query
=
"SELECT DISTINCT station FROM {}"
.
format
(
self
.
table
)
stations
=
[]
stations
=
[
row
.
station
for
row
in
execute_query
(
query
)]
print
(
"Choisissez une station parmis celles-ci:"
)
print
(
"Choisissez une station parmis celles-ci:"
)
print
(
"
\t
"
.
join
(
stations
))
query
=
"SELECT DISTINCT station FROM {}"
.
format
(
self
.
table
)
for
i
,
row
in
enumerate
(
execute_query
(
query
),
1
):
end
=
"
\n
"
if
i
%
3
==
0
else
""
print
(
"
\t
"
,
row
.
station
,
end
=
end
)
stations
.
append
(
row
.
station
)
print
()
station
=
ask_q
(
stations
)
station
=
ask_q
(
stations
)
# Search element
# Search element
...
@@ -58,13 +63,72 @@ class Manager:
...
@@ -58,13 +63,72 @@ class Manager:
x
=
[]
x
=
[]
y
=
[]
y
=
[]
saisons
=
{
'spring'
:
{
'n'
:
0
,
'somme'
:
0
,
'month'
:
[
3
,
4
,
5
],
# March - May
'end'
:
lambda
dt
:
datetime
(
dt
.
year
,
6
,
1
)
-
timedelta
(
days
=
1
),
'legend'
:
False
,
'color'
:
'r'
},
'summer'
:
{
'n'
:
0
,
'somme'
:
0
,
'month'
:
[
6
,
7
,
8
],
# June - August
'end'
:
lambda
dt
:
datetime
(
dt
.
year
,
9
,
1
)
-
timedelta
(
days
=
1
),
'legend'
:
False
,
'color'
:
'y'
},
'automne'
:
{
'n'
:
0
,
'somme'
:
0
,
'month'
:
[
9
,
10
,
11
],
# September - November
'end'
:
lambda
dt
:
datetime
(
dt
.
year
,
12
,
1
)
-
timedelta
(
days
=
1
),
'legend'
:
False
,
'color'
:
'm'
},
'winter'
:
{
'n'
:
0
,
'somme'
:
0
,
'month'
:
[
12
,
1
,
2
],
# December - Febrarie
'end'
:
lambda
dt
:
datetime
(
dt
.
year
+
1
,
3
,
1
)
-
timedelta
(
days
=
1
),
'legend'
:
False
,
'color'
:
'k'
}
}
query
=
"SELECT * FROM {} WHERE station={}"
.
format
(
self
.
table
,
station
.
__repr__
())
query
=
"SELECT * FROM {} WHERE station={}"
.
format
(
self
.
table
,
station
.
__repr__
())
for
row
in
execute_query
(
query
):
for
row
in
execute_query
(
query
):
value
=
getattr
(
row
,
attr
)
if
value
is
None
:
continue
x
.
append
(
datetime
(
*
list
(
row
.
time
)))
x
.
append
(
datetime
(
*
list
(
row
.
time
)))
y
.
append
(
getattr
(
row
,
attr
))
y
.
append
(
value
)
# For saison
for
saison
,
d
in
saisons
.
items
():
if
row
.
time
[
1
]
in
d
[
'month'
]:
d
[
'n'
]
+=
1
d
[
'somme'
]
+=
value
break
date
,
last_date
=
x
[
0
],
x
[
-
1
]
# first date and last date, initialisation
x
=
np
.
array
(
x
)
x
=
np
.
array
(
x
)
y
=
np
.
array
(
y
)
y
=
np
.
array
(
y
)
plt
.
plot
(
x
,
y
,
label
=
attr
)
plt
.
plot
(
x
,
y
,
label
=
attr
)
# Mark saison
while
date
<
last_date
:
for
saison
,
d
in
saisons
.
items
():
if
date
.
month
in
d
[
'month'
]:
next_date
=
min
(
last_date
,
d
[
'end'
](
date
))
moyenne
=
d
[
'somme'
]
/
d
[
'n'
]
if
d
[
'legend'
]:
plt
.
plot
([
date
,
next_date
],
[
moyenne
,
moyenne
],
d
[
'color'
],
linewidth
=
4
)
else
:
plt
.
plot
([
date
,
next_date
],
[
moyenne
,
moyenne
],
d
[
'color'
],
label
=
saison
,
linewidth
=
4
)
d
[
'legend'
]
=
True
date
=
next_date
+
timedelta
(
days
=
1
)
break
plt
.
title
(
station
)
plt
.
title
(
station
)
plt
.
legend
()
plt
.
legend
()
plt
.
show
()
plt
.
show
()
...
...
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