Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Temperaturverteilung
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Package Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
s39174
Temperaturverteilung
Commits
ca941bcc
Commit
ca941bcc
authored
3 years ago
by
Clemens Berteld
Browse files
Options
Downloads
Patches
Plain Diff
Added some comments
parent
05fdb6ce
No related branches found
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
api/GetAverageData.py
+4
-1
4 additions, 1 deletion
api/GetAverageData.py
with
4 additions
and
1 deletion
api/GetAverageData.py
+
4
−
1
View file @
ca941bcc
...
...
@@ -10,6 +10,7 @@ param_postgres = cfg["POSTGRES"]
param_interpol
=
cfg
[
"
INTERPOLATION
"
]
# Calculate average for a certain period of time for each station
def
get_average_of_multiple_years
(
cursor
,
years
):
avg_strings
=
"
"
and_strings
=
""
...
...
@@ -41,6 +42,7 @@ def get_year_columns(cursor):
return
columns
# Find minimum and maximum temperature value in database for colour ramp
def
find_extremum
(
cursor
,
years
,
extremum
):
extremum_strings
=
''
and_strings
=
''
...
...
@@ -65,7 +67,7 @@ def get_min_max(cursor):
return
min
,
max
# Find
n (defined in config)
neighbours and return them ordered by distance
# Find
all
neighbours and return them ordered by distance
def
get_neighbours
(
cursor
,
lat
,
lon
,
columns
):
values
=
''
# Used in second parameter of cursor.execute() (Avoids SQL injection)
for
n
in
[
lat
,
lon
]:
...
...
@@ -97,6 +99,7 @@ def calc_averages(neighbours, years):
return
averages
# Find the nearest n neighbours (defined in config.ini) that are not NaN
def
filter_neighbours
(
year
,
neighbours
):
filtered_neighbours
=
[]
neighbour_counter
=
0
...
...
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