Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ACT - Time Series Analysis in Flood-Prone Areas
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Kies, Jacqueline
ACT - Time Series Analysis in Flood-Prone Areas
Commits
89ba731b
Commit
89ba731b
authored
2 years ago
by
Verouden, Niels
Browse files
Options
Downloads
Patches
Plain Diff
Update s22VisualiseData.py
parent
5535a75c
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
urban_areas/py/s22VisualiseData.py
+13
-9
13 additions, 9 deletions
urban_areas/py/s22VisualiseData.py
with
13 additions
and
9 deletions
urban_areas/py/s22VisualiseData.py
+
13
−
9
View file @
89ba731b
...
...
@@ -10,7 +10,7 @@ import numpy as np
def
visualiseData
(
SAR_path
,
precipitation_csv
,
file_name
,
path_mean_vv
):
## Create path to load precipitation csv
path_precip
=
os
.
path
.
join
(
"
data
"
,
"
precipitation_data
"
,
precipitation_csv
)
path_precip
=
os
.
path
.
join
(
"
data
"
,
precipitation_csv
)
# Find sum_days inside name of precipitation CSV file and assign it to a variable
days
=
re
.
search
(
'
_avg(.+?)days_
'
,
precipitation_csv
).
group
(
1
)
...
...
@@ -24,13 +24,20 @@ def visualiseData(SAR_path, precipitation_csv, file_name, path_mean_vv):
## Combine DataFrames based on data
df_total
=
pd
.
merge
(
df_precip
,
df_vv
,
on
=
'
date
'
)
# Define name for titles
count
=
SAR_path
.
count
(
'
/
'
)
if
count
!=
0
:
title_name
=
re
.
search
(
'
/(.+)
'
,
SAR_path
).
group
(
count
)
else
:
title_name
=
SAR_path
##### LINEPLOT MEAN_VV AND AVERAGE PRECIPITATION
## Set parameters for the lineplot
fig
,
ax
=
plt
.
subplots
(
figsize
=
(
2
5
,
5
))
fig
,
ax
=
plt
.
subplots
(
figsize
=
(
2
0
,
5
))
plt
.
xticks
(
np
.
arange
(
0
,
len
(
df_total
),
(
len
(
df_total
)
*
0.015
)))
[
lab
.
set_rotation
(
90
)
for
lab
in
ax
.
get_xticklabels
()]
plt
.
title
(
f
'
Mean VV backscatter and average precipitation in urban area (
{
SAR_path
}
)
'
,
plt
.
title
(
f
'
Mean VV backscatter and average precipitation in urban area (
{
title_name
}
)
'
,
fontdict
=
{
'
fontsize
'
:
20
})
ax
.
set_xlabel
(
'
date
'
,
fontdict
=
{
'
fontsize
'
:
15
})
...
...
@@ -54,10 +61,10 @@ def visualiseData(SAR_path, precipitation_csv, file_name, path_mean_vv):
##### LINEPLOT MEAN_VV AND SUM xDAYS PRECIPITATION
## Set parameters for the lineplot
fig
,
ax
=
plt
.
subplots
(
figsize
=
(
2
5
,
5
))
fig
,
ax
=
plt
.
subplots
(
figsize
=
(
2
0
,
5
))
plt
.
xticks
(
np
.
arange
(
0
,
len
(
df_total
),
(
len
(
df_total
)
*
0.015
)))
[
lab
.
set_rotation
(
90
)
for
lab
in
ax
.
get_xticklabels
()]
plt
.
title
(
f
'
Mean VV backscatter and
{
days
}
-day sum of precipitation in urban area (
{
SAR_path
}
)
'
,
plt
.
title
(
f
'
Mean VV backscatter and
{
days
}
-day sum of precipitation in urban area (
{
title_name
}
)
'
,
fontdict
=
{
'
fontsize
'
:
20
})
ax
.
set_xlabel
(
'
date
'
,
fontdict
=
{
'
fontsize
'
:
15
})
...
...
@@ -80,9 +87,6 @@ def visualiseData(SAR_path, precipitation_csv, file_name, path_mean_vv):
plt
.
show
()
return
df_total
,
days
,
mean_VV
,
sum_xdays
return
df_total
,
days
,
mean_VV
,
sum_xdays
,
title_name
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment