From 93a56eb1878e99817b3fb5842351c2af3edb3505 Mon Sep 17 00:00:00 2001 From: Hoa Ben The Nguyen <hbnguye@stud.ntnu.no> Date: Tue, 12 Mar 2024 10:14:03 +0100 Subject: [PATCH] no progress in calculations, must take later --- .../area_processing.cpython-39.pyc | Bin 0 -> 1480 bytes .../process_lidar_data.cpython-39.pyc | Bin 2853 -> 3085 bytes server/data_processing/area_processing.py | 5 +- server/data_processing/process_lidar_data.py | 91 +++++++++++++++--- server/main.py | 6 +- .../__pycache__/get_markers.cpython-39.pyc | Bin 2646 -> 2182 bytes .../__pycache__/input_new_data.cpython-39.pyc | Bin 1759 -> 1795 bytes server/map/input_new_data.py | 70 ++++++++------ 8 files changed, 127 insertions(+), 45 deletions(-) create mode 100644 server/data_processing/__pycache__/area_processing.cpython-39.pyc diff --git a/server/data_processing/__pycache__/area_processing.cpython-39.pyc b/server/data_processing/__pycache__/area_processing.cpython-39.pyc new file mode 100644 index 0000000000000000000000000000000000000000..36bd3436993a5dbf223824d0c9b30cbeb8de4ca5 GIT binary patch literal 1480 zcmZ`(y^kAJ5Pu)L_WI*Kd^uelImH4^ED>}H1tLNy(d8l<f|P`2WmxU`J?|}N?>cYS zCoX!f4jLq+bhJ>?Q}DNJOM|JX5e2___Hid6o;9;G^BcdJosUhnw%QD*|J_Qz-(l=G zQf?jz<q@bPrkLVWHscYWiAZp!L?o3|p62^Z`2(iqJ{vIA7_i7wO%;5@B44#s8_$O7 zykNub3b(MKsKq?1<+v!*?|;bm-udI#M=K6sCBU*%h}rK5Jf`4RrwO3}Is%nbFw3l{ z*gm_>meTUITye`Pq4)syOK@P`m0zDN{r~d=*08?yCc?@MZ$S1fc<Lc>@%r1NWIA3< zlS+r<!sObNVKE8k#q=UA^6(@nwF)65;aKODHgGD8%5wO(+ab<llP+d}%7;$HMdAJX zSI*F~YN7NR%F~-rk*C+#>KDBEP}csZ$1jhc8!C{Yq79q1#3f*PT6Yqolem~nN?p}W znB#d-Lda7RB4^2U3IP@fKQpt1JO29e=;7$|5^pv-Et2@b=(AiuG1<8uy*Q)C30`P4 zH%0p3!^6XC0e?8xW~7oTiGhxFS!Q`UayeY<@69jj-uSA7@uq~-&~guqwYvPS0Lcb- zzrW26tYeR`&DqB@0J#Y;7?Kp-t!NI={Y#1N`ikGdP~KsXz=`@-vUFC$A@$irpyLha zD;36fz@U-OMg!ion1%sc21+bjpf;$336q!n3H##DW!H8czV)xIUT)iMXWKyr-X@ow zbsU;h+oXt?%H0i45x3TnH#jW7dvwnMvaww^;d{^#&H1<tmAuUer`*rP8*UD4OYslb zvUTmL_yKC*(5E-7;!MK-sckC>|28VPYkM|81#emJM`8DD3mE>3d~Z$UPn@$?Z(dnT zd*DAaK3YK4XNH=yq7fWQ*R9$&NuKJuk<8~hSHpcn?J_N5^p%NPsmWAaX0LVBAyKQC z#w2RZk}ThdZf=}QPi18lS4CVdPS#5mZ9}{<+)<F4Vlj_1Rr9RoU)B5~>KRSjbgo^T znD&8x{U2*m8GP-S=~7w^+)8&eH&f}hVa>LI*SktjvRucMGDR=ng0*}Xj7d*+#i0mg zAUuwr?DBvUg*+6y;%y#?dpv;kt}uQ0Kf|JWv!pt8TkG~W@{b=sfBA`_51cEbbG(rQ b?WS>w1Ru=`wV3LUsr)4scNby%A{hJwfvQ=u literal 0 HcmV?d00001 diff --git a/server/data_processing/__pycache__/process_lidar_data.cpython-39.pyc b/server/data_processing/__pycache__/process_lidar_data.cpython-39.pyc index 47edf95b89a3f2a16363fcc7430b1e02bc70d60d..9a3706cc4096a71462648ad5967fbd3abd35f8e1 100644 GIT binary patch literal 3085 zcmbVOPj4H?6`z@1l1qxDCCZj1$99;YNzBAhWH~Jm!B896aEl&fBXV44!Gu_GhSW;r zE;YLhWQIIZK+}U!7ySa#Q9wUL3-nVAf?j&^xwoA9dqe6kT(syeX7;@|Z|D7gGeN0T zV0d2r`HjlVG4@YF&OaWIUtuJlamFN*yu*BMzrq*zijLEDeV5ak)5&zRezu$QbHH7h zX$#*|;xMl~$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n1tUH||9 diff --git a/server/data_processing/area_processing.py b/server/data_processing/area_processing.py index 6239487d..43e289ee 100644 --- a/server/data_processing/area_processing.py +++ b/server/data_processing/area_processing.py @@ -41,7 +41,7 @@ def define_gridareas(lat, lng, area_offset, grid_size): area_size = (main_area[2][0] - main_area[0][0], main_area[0][1] - main_area[2][1]) # find each subareas vector to it's center dist_to_subcenter = (area_size[0]/(grid_size*2), area_size[1]/(grid_size*2)) - print(dist_to_subcenter) + # find subareas size relative to main area subarea_offset = area_offset/grid_size @@ -71,4 +71,5 @@ def define_gridareas(lat, lng, area_offset, grid_size): return grided_area -print(define_gridareas(60,10,1500,4)) \ No newline at end of file +#print(define_gridareas(-60,10,1500,4)) +print(define_gridareas(3435693.5,6299200.0, 20000000000,4)) \ No newline at end of file diff --git a/server/data_processing/process_lidar_data.py b/server/data_processing/process_lidar_data.py index a0282be5..6345fe11 100644 --- a/server/data_processing/process_lidar_data.py +++ b/server/data_processing/process_lidar_data.py @@ -1,7 +1,9 @@ import numpy as np import laspy +import utm # src: https://github.com/Turbo87/utm from itertools import groupby -from process_lidar_data import calculate_corners, define_gridareas +from server.data_processing.area_processing import calculate_corners, define_gridareas + # hard coded files for test data lazData_path = ["server/example_lidar_data/ot_N_000005_1.laz", "server/example_lidar_data/ot_N_000033_1.laz"] @@ -27,7 +29,9 @@ with laspy.open(lazData_path[0]) as fh: # check if lidar points is within range of the area selected def inArea(position, areaRange): x, y, _ = position - if (areaRange[0][0] < x < areaRange[1][0]) and (areaRange[0][1] > y > areaRange[1][1]): + print(areaRange[0][0], " > ", x, " > ", areaRange[1][0], ") and (", areaRange[0][1], " < ", y, " < ", areaRange[1][1]) + if (areaRange[0][0] > x > areaRange[1][0]) and (areaRange[0][1] < y < areaRange[1][1]): + print("inside area") return True else: return False @@ -60,7 +64,7 @@ def find_height(points): # find the height of an area based on the coordinates of it's center # and it's affiliations (subId and groupId) (soon to be implemented -def height_in_area(center): +def calculate_area_data(center): # container for all the heights in area area_heights = [] @@ -73,11 +77,39 @@ def height_in_area(center): # ] # specified the area and it's range - area = calculate_corners(center, 1500) - area = (area[0], area[2]) - # NB: is only for the test data (soon to be removed) - areazone = [(((area[0]) * ((-3671212/60.815356) - (-3200175/60.774878))) - 3200175, (area[1] * ((7898422/10.768867) - (4699978/10.672022))) + 4699978), - (((area[0] - 100) * ((-3671212/60.815356) - (-3200175/60.774878))) - 3200175, ((area[1] - 1) * ((7898422/10.768867) - (4699978/10.672022))) + 4699978)] + #area = (area[0], area[2]) + #print("area size") + # NB: is only for the test data (soon to be removed and switched with center) + #areazone = ((((7898422) - (4699978)))/2.0 + 4699978), (((-3671212) - (-3200175)))/2.0 - 3200175 + #areazone = ((-3671212 - (-3200175))/center[0] - 3200175, (7898422 - 4699978)/center[1] + 4699978) + + #print(areazone) + + + # max and min initial (-9.790000, -615.719971) - (696.619995, 96.660004) + # max and min g(idk) (-36709.790000, 78284.280029) - (-36003.380005,78996.660004) + # should be within (-3200175, 4699978) - (-3671212, 7898422) + #print(utm.to_latlon(4699978, -3200175,18,'S')) + + + #areazone = ((((-3200175 + 3671212) / ( area[0][0] - area[2][0]))), + # ((7898422 - 4699978) / (area[0][1] - area[2][1]))) + #areazone = ((((-3200175 / area[0][0]) - ( - 3671212 / area[2][0]))), + # ((7898422 / area[0][1]) - (area[2][1] / 4699978))) + + #area = calculate_corners(center[0],center[1], 1500) + + areazone = calculate_corners(3435693.5,7550000.0, 20000000000) + #print(area[0]," area ", area[2]) + + #start_point = areazone[0] + #areazone = (areazone[2][0] - areazone[0][0], areazone[2][1] - areazone[0][1]) + #print("az",areazone) + + # areazone = [(((center[0]) * ((-3671212 / 60.815356) - (-3200175 / 60.774878))) - 3200175, + # (center[1] * ((7898422 / 10.768867) - (4699978 / 10.672022))) + 4699978), + # (((center[0] - 100) * ((-3671212 / 60.815356) - (-3200175 / 60.774878))) - 3200175, + # ((center[1] - 1) * ((7898422 / 10.768867) - (4699978 / 10.672022))) + 4699978)] # Refactor lidar data to a readable format iceOver = laspy.read(lazData_path[0]) @@ -85,13 +117,48 @@ def height_in_area(center): # add two files together temporary test data(soon to be removed) ice_points = list(zip(iceOver.X,iceOver.Y,iceOver.Z)) + list(zip(iceUnder.X,iceUnder.Y,iceUnder.Z)) - # area height in all the subsections - grid_area_heights = define_gridareas(areazone, 1500, 20) + #grid_area_heights = define_gridareas(-3435693.5,6299200.0, 20000000000,4) + grid_area_heights = define_gridareas(3435693.5,7550000.0, 20000000000,4) + + print("",grid_area_heights) # find the heights of each sub-area => area-heights for sub_area in grid_area_heights: - ice_points = list(filter(lambda point_position: inArea(point_position, (sub_area[0],sub_area[2])), ice_points)) - area_heights.append(find_height(ice_points)) + + #main_vector = tuple(x - y for x, y in zip(area[2], area[0])) + #sub_vector = tuple(x - y for x, y in zip(sub_area[2][2], sub_area[2][0])) + #relative_to_laz = (tuple(x - y for x, y in zip(sub_area[2][0], area[0])), + # tuple(x + y for x, y in zip(sub_vector, sub_area[2][0]))) + #relative_to_laz = (tuple(x / y for x, y in zip(relative_to_laz[0], main_vector)), + # tuple(x / y for x, y in zip(relative_to_laz[1], sub_area[2][0]))) + #relative_to_laz = (tuple(x * y for x, y in zip(relative_to_laz[0], areazone)), + # tuple(x * y for x, y in zip(relative_to_laz[1], areazone))) + #relative_to_laz = (tuple(x + y for x, y in zip(relative_to_laz[0], start_point)), + # tuple(x + y for x, y in zip(relative_to_laz[1], start_point))) + + #print("areaZone",areazone) + #print("sub area",sub_area) + #print("relativer",relative_to_laz) + + #zone_limit = (tuple(x * y for x, y in zip(relative_to_laz, areazone)), + # tuple(x * y for x, y in zip(sub_area[2][2], areazone))) + #print("zone_limit",zone_limit) + #zone_limit = (tuple(x + y for x, y in zip(zone_limit[0], start_point)), + # tuple(x + y for x, y in zip(zone_limit[1], start_point))) + + #print("zone_limit",zone_limit) + print(type(ice_points[0])) + ice_points = list(filter(lambda point_position: inArea(point_position, ((int(-sub_area[2][0][0]),int(sub_area[2][0][1])),(int(-sub_area[2][2][0]),int(sub_area[2][2][1])))), ice_points)) + #ice_points = list(filter(lambda point_position: inArea(point_position, (((-areazone[0][0]),areazone[0][1]),(-areazone[2][0],areazone[2][1]))), ice_points)) + #ice_points = list(filter(lambda point_position: inArea(point_position, (((-3200000,7400000),(-3671212,7898422)))), ice_points)) + print("ice",ice_points) + area_heights.append((sub_area[0],sub_area[1],find_height(ice_points))) return area_heights + +print(-3>-4) +print(calculate_area_data((60.0,10.0))) + + + diff --git a/server/main.py b/server/main.py index 021581b6..5aa9dd5b 100644 --- a/server/main.py +++ b/server/main.py @@ -43,15 +43,15 @@ class IceHTTP(BaseHTTPRequestHandler): elif self.path == '/get_valid_markers': # NB: should be POST? get_all_markers(self, self.cursor, True, 'Mjosa') # Get only valid markers # NB: temporary hardcoded waterBodyName - elif self.path == '/get_relation': - get_relation(self, 'Mjosa') # NB temp hardcoded value + #elif self.path == '/get_relation': + # get_relation(self, 'Mjosa') # NB temp hardcoded value def do_POST(self): if self.path == '/get_weather_data': get_weather(self) elif self.path == '/new_lidar_data': - input_new_Lidar_data(self,self.cursor, 1, 'Mjosa') # hardcoded body of water must change later + input_new_Lidar_data(self,self.cursor, 1, 'Mjosa') # hardcoded body of water must change later # Terminate server on key press q def on_key_press(server, event, cursor, conn): diff --git a/server/map/__pycache__/get_markers.cpython-39.pyc b/server/map/__pycache__/get_markers.cpython-39.pyc index c1b95c053be539be6996efc2239388bcdada2a33..153eff491a414be4d1f89f774ec15cc0bcc92577 100644 GIT binary patch delta 158 zcmca6(k954$ji&c00c3+pQdi(o5&}lCI#fBFr+Z%Fhnt=GNv%iVN798VQFEBVoG5Q zX3%7P2~zI2adHtWBiCd$wiS#~lh?CNVPu-@!d}CuIr$)a3M1=eHI7s}ZJ;_$<|2@J jMWP@ABv7P@N@xMOw>WHa^HWN5QtcRlykaIG!NCFm!c-s0 delta 625 zcmYjO&ubGw6rP#=*=-VP3A7NERmowY=^vmXX-kS1qoxsYPTlT|+lBp6W|M;&noHW7 zhq6Ko3W65}@!&x$c+;C8R0IzTiXa86cW<I^wiNr|eLLUx&D%HgX7j}7YQ-&=Ed=o< z+vl$*w<;%t4lsro4iS}K65@zZ5-C){h^tI_gqg~;kxDhDQ=J*i<fMw&SPgN#ifV{i zHAD?IPEA%~<q@J|3@;(4av<BZ9g>r^AXmI3eR)l2xRkxqp5Z(T^#@qZura_h*}B27 zk$pG#a287Z``hv4xu3gDF#$}J0fJQw@Iyi9pbFF@07oI$G8Z6I6TpYNJdr0LcQ+Q? z(Cde8kK0}%VlGlUxoxi{;T=DT?G-oW%!Y+)dpz!OVGq3|5iE$Iz_M(JIpOys@Y3@I zg+JMi#?fwIL9fsFp%webtt9sUdyeW5|I4e<V9#qe{ZC)Njb}l<3EIOOkDtF-2JORz z_Q$P3eJI7Zn@?}PUjcFV^v192JH^J?zi0mZ=Ag|l@9&+xS8s|LxT!;^0*3&I{X#f| z23TSmfJ3ImtfmU?SmG2&xf;2>RUr)lBSm6Lf*gIDYOT3W_cGP4w7RVh)vqotF15Nv j@v#Q7w~$?O^J0{+e#kGu`=GQ0VB!g_a!bY2SXKT3ex#k~ diff --git a/server/map/__pycache__/input_new_data.cpython-39.pyc b/server/map/__pycache__/input_new_data.cpython-39.pyc index 0bd02d71bf69b6ab2b4ebf9ed26a4e027128f49a..4881eedf5ef43ca958dd3f3bc08a3990387c89ae 100644 GIT binary patch delta 932 zcma)5&1=*^6rZomX7jPFc<I_p(5kFmN<sWq+NC{~1wWv;AZy6XZny3xnoKM%6MNXR zP{~=?;=!8;p2a`HTQ1^3P>}uw6`UlkdJ<oFAH4U=yx)7we6}aGnrqtzQ1a@_H~zzX zS@U*JdhXDRhpymVH{@=Yxx)2GjyV!bd0Xk4(&!EZU=NOG8B7R6iN<h3C7c3ABoc6n z_Q5u0m}xJdR9+IP_2@o=K*DX3RD{Op1VSKaQ9%=!?CL66DUzDhb1(JqK<ew@0ZXc) zBCAZVg9#M+aWoGSLsDs60Y|N?GDqP$P}ZmeQ5D89R{d9%Mqx=|wcIk5>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<~S!tBh7c#X#%)!JLt;8l<WQ8-_n zwCCcey*FRIpnkZ#^w|DScY&N+URr%(KUkN=>?`L?XJ|39i)FF>s2#cj;}fb$&~=z2 zzLM*3MEoEVQ#c4&MtzSpcARE2#&WC-H@z@Z_TrqvNxPLPelv1p-U>o-TN#Izc&6N3 z&a9T_B<<L1d7)fMw{Gr5Nx<YFoB1Odj-&lLZ8|JqZP%;o%_!V1QYC3`%~$K%b}?*S zD>_ZYH-%3t`TpLO4nTxdeCd>^DpCpkLsUbdh(HR<gU>(|4nq}>pHhh%sEovWbswU? DW5LjK diff --git a/server/map/input_new_data.py b/server/map/input_new_data.py index c5e2e25c..d52d93ba 100644 --- a/server/map/input_new_data.py +++ b/server/map/input_new_data.py @@ -1,51 +1,65 @@ import json from datetime import datetime -from server.data_processing.process_lidar_data import height_in_area +from server.data_processing.process_lidar_data import calculate_area_data # input_new_Lidar_data send new data gathered from the lidar and send it to the database (from the drone, most likely) def input_new_Lidar_data(self, cursor, sensorId, bodyOfWater): try: + # hard coded coordinates + latitude = 60.0 + longitude = 10.0 + + total_measurement_average = 0 # the total average of a measurement + # create a new measurement with the time the data is sent, sensor type, where # and an estimate of average thickness of ice on water body cursor.execute(''' - INSERT INTO Measurement( SensorID, TimeMeasured, WaterBodyName, WholeAverageThickness) VALUES - (?,?,?,?); - ''', ( sensorId, datetime.utcnow().replace(microsecond=0), bodyOfWater, 0)) + INSERT INTO Measurement( SensorID, TimeMeasured, WaterBodyName, + WholeAverageThickness, CenterLat, CenterLon) VALUES + (?,?,?,?,?,?); + ''', (sensorId, datetime.utcnow().replace(microsecond=0), bodyOfWater, 0, latitude, longitude)) # auto generate new measurement id measurement_id = cursor.lastrowid - # input the newly generated measurement_id and ... average thickness (soon to be implemented) - cursor.execute(''' - UPDATE Measurement - SET measurementID = ? - WHERE MeasurementID IS NULL; - ''', (int(measurement_id),)) - # soon to be removed - cursor.execute(''' - SELECT CenterLatitude, CenterLongitude, SubDivisionID, GroupID - FROM SubDivision - GROUP BY CenterLatitude, CenterLongitude - ''') - position_data = cursor.fetchall() + # supposed get all the hardcode the coordinates of the areas we want + # cursor.execute(''' + # SELECT CenterLatitude, CenterLongitude, SubDivisionID, GroupID + # FROM SubDivision + # GROUP BY CenterLatitude, CenterLongitude + # ''') + # position_data = cursor.fetchall() + # soon to be removed - if(position_data): - for row in position_data: - latitude, longitude, subID, groupID = row - heights = height_in_area((latitude,longitude)) - if(len(heights) > 0): - print(heights) - else: - print("No height found") - average = sum(heights)/len(heights) + print("uwu") + areas_data = calculate_area_data((latitude, longitude)) + print("area") + print(areas_data) + if(areas_data): + for area in areas_data: + #if(len(area[2]) != 0): + average = sum(area[2])/len(area[2]) + #else: + #average = 0 + + total_measurement_average += average cursor.execute(''' INSERT INTO SubDivision(MeasurementID, SubDivisionID, GroupID, MinimumThickness, AverageThickness, CenterLatitude, CenterLongitude, Accuracy) VALUES (?,?,?,?,?,?,?,?); - ''',(measurement_id, subID, groupID, float(min(heights)), float(average), float(latitude), float(longitude), float(1))) + ''',(measurement_id, area[0], area[1], float(min(area[2])), float(average), float(latitude), float(longitude), float(1))) + + total_measurement_average = total_measurement_average / len(areas_data) + # input the newly generated measurement_id and whole average thickness (soon to be implemented) + cursor.execute(''' + UPDATE Measurement + SET measurementID = ? AND WholeAverageThickness = ? + WHERE MeasurementID IS NULL AND WholeAverageThickness = 0; + ''', (int(measurement_id), total_measurement_average),) else: - print('No data') + print('No data found') + print("uwu3") # send the changes to the database cursor.connection.commit() -- GitLab