Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PROG2900
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Sara Savanovic Djordjevic
PROG2900
Commits
e6917e12
Commit
e6917e12
authored
1 year ago
by
Sara Savanovic Djordjevic
Browse files
Options
Downloads
Patches
Plain Diff
add: reading and matching ice stats (commented)
parent
7ce2666c
No related branches found
Branches containing commit
No related tags found
1 merge request
!12
Clhp map
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
server/map_handler/get_measurements.py
+19
-0
19 additions, 0 deletions
server/map_handler/get_measurements.py
server/map_handler/process_lake.py
+1
-4
1 addition, 4 deletions
server/map_handler/process_lake.py
with
20 additions
and
4 deletions
server/map_handler/get_measurements.py
+
19
−
0
View file @
e6917e12
...
...
@@ -3,6 +3,7 @@ from datetime import datetime
import
random
from
random
import
randint
# get_markers requests all marker data or valid markers, converts the data to json, and writes
# the data to the response object
def
get_all_markers
(
self
,
cursor
,
waterBodyName
):
...
...
@@ -28,10 +29,25 @@ def get_all_markers(self, cursor, waterBodyName):
# Container for all fetched measurement objects
measurement_data
=
{}
'''
f = open(
'
server/?
'
)
data = json.load(f)
'''
# Iterate over all fetched rows
for
row
in
rows
:
measurement_id
=
row
[
0
]
'''
curr_stat = []
# Find matching ice stat
for stat in data[
'
stats
'
]
if ice_stats.sub_div_id == row[8]
curr_stat = stat
break
'''
# Create subdivision new object
sub_division
=
{
'
SubdivID
'
:
row
[
8
],
...
...
@@ -109,6 +125,9 @@ def get_all_markers(self, cursor, waterBodyName):
test_measurements
.
append
(
measurement
)
########################### TEST DATA ###########################################
# NB remember to clos file after implementation
# f.close()
# Convert dictionary values to list of measurements
data
=
list
(
measurement_data
.
values
())
+
test_measurements
...
...
This diff is collapsed.
Click to expand it.
server/map_handler/process_lake.py
+
1
−
4
View file @
e6917e12
import
geopandas
as
gpd
from
shapely.geometry
import
Polygon
,
MultiPolygon
import
json
from
server.map_handler.add_lake
import
write_json_to_file
# Writes contents of a map_handler json file to the response
...
...
@@ -34,4 +31,4 @@ def get_ids_and_centers(file_name): # NB buggy
'
sub_div_center
'
:
sub_div_center
}
subdivisions
.
append
(
subdivision
)
return
subdivisions
\ No newline at end of file
return
subdivisions
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