Commit b7a4e114 authored by Bryson Howell's avatar Bryson Howell

Started script to collect GIS imformation for dataset.

parent 1ccfab24
incident_index,IPP_lat,IPP_lon,find_lat,find_lon
1,31.39708335,-111.20643,31.406333,-111.19683
2,31.42903334,-110.29328,31.429517,-110.30412
3,31.50571667,-110.67622,31.51,-110.65333
4,31.72261664,-110.18783,31.741767,-110.19178
5,31.83521665,-110.3567,31.862267,-110.39655
6,31.90240002,-109.27847,31.8395,-109.27667
7,31.92245,-109.96732,31.921483,-110.03358
8,32.01236667,-109.31572,31.99935,-109.3078
9,32.33333333,-110.85283,32.3715,-110.86467
10,32.33583333,-110.91017,32.3665,-110.88017
11,32.33699999,-110.91667,32.359833,-110.89767
12,32.40916665,-110.70983,32.400833,-110.69233
13,32.41976668,-110.74733,32.3655,-110.77583
14,32.43543332,-110.78933,32.428833,-110.79433
15,32.82141666,-111.20212,32.824667,-111.22717
16,33.37055,-111.11522,33.375283,-111.08918
17,33.38884999,-111.36565,33.4012,-111.37517
18,33.39680001,-111.34805,33.4215,-111.3605
19,33.39705,-111.34787,33.409333,-111.31717
20,33.39733334,-111.348,33.441667,-111.36767
21,33.39750001,-111.34783,33.415667,-111.365
22,33.47801666,-111.43767,33.415667,-111.36478
23,33.60398331,-112.51512,33.590333,-112.52283
24,33.70541668,-111.33805,33.67915,-111.31695
25,34.0927,-111.42465,34.068767,-111.43592
26,34.09278333,-111.42098,34.102333,-111.49033
27,34.55,-111.63333,34.55,-111.61667
28,34.55976664,-111.65395,34.540067,-111.70348
29,34.6,-112.55,34.633333,-112.63333
30,34.63041668,-112.5553,34.627233,-112.54577
31,34.82166665,-111.80667,34.818333,-111.79833
32,34.82386665,-111.77513,34.831667,-111.743
33,34.86666667,-111.88333,34.866667,-111.8
34,34.88683332,-111.784,34.902667,-111.78683
35,34.89333331,-111.86333,34.906667,-111.87603
36,34.90286668,-111.81313,34.891833,-111.80482
37,34.91666667,-111.8,34.966667,-111.86667
38,34.92530003,-111.7341,34.897333,-111.74117
39,34.97868334,-111.89643,34.946833,-111.88967
40,35.1938,-114.05703,35.208717,-114.13195
41,35.24375,-111.59967,35.232517,-111.6015
42,35.33068333,-111.71108,35.334233,-111.6975
43,36.23878333,-112.6892,36.246433,-112.70008
44,41.54819,-80.33056,41.59006,-80.32647
45,42.0097,-74.42595,42.03544,-74.35565
46,42.02893,-74.33659,42.02902,-74.35191
47,42.17965,-74.21362,42.18345,-74.19585
48,42.31735,-76.47791,42.30271,-76.48976
49,42.34432,-77.47638,42.36077,-77.48593
50,42.74271,-73.45475,42.75163,-73.46259
51,43.06902,-74.48481,43.05475,-74.4839
52,43.42473,-73.73209,43.42878,-73.73981
53,43.42498,-74.41496,43.41592,-74.4142
54,43.42736,-74.4481,43.44347,-74.45004
55,43.4332,-74.41433,43.45684,-74.41519
56,43.4449,-74.4086,43.43407,-74.40747
57,43.51063,-74.57393,43.53014,-74.57169
58,43.65649,-76.00019,43.65566,-76.0115
59,43.73413,-74.25577,43.73701,-74.28305
60,43.8756,-74.43076,43.91132,-74.37437
61,43.95385,-75.15748,43.99774,-75.16148
62,44.16065,-73.85545,44.1547,-73.85942
63,44.19013,-74.81336,44.18772,-74.79719
64,44.28656,-74.61429,44.28923,-74.60208
65,48.1103,-121.4917,48.142,-121.4739
import numpy as np
import matplotlib.pyplot as plt
from scipy.io import loadmat
import pandas as pd
from arcgis_terrain import get_terrain_map, lat_lon2meters
#Bryson Howell (blhowell@vt.edu), 7/10/24
#Script made to create 3D Gridworld environments for RL experiments
#Formats data into a csv that can be loaded as a Pandas dataframe.
#Finds incident keys for LPM fit data
def incident_list():
listname = './lp_data/incident_locations.csv'
biglistname = './lp_data/DD.DDD WGS Coordinates_cleaned.xlsx - DD Format.csv'
#load data
incidents = pd.read_csv(listname)
biglist = pd.read_csv(biglistname,dtype={'LKP Coord. (N/S)': np.float64, 'LKP Coord. (E/W)': np.float64,
'Find Coord (N/S)': np.float64, 'Find Coord (E/W)': np.float64},nrows=116)
#print(incidents.columns)
#print(biglist.columns)
#Look for incident key for each item in the LPM data
count = 0
for index, row in incidents.iterrows():
for index2, row2 in biglist.iterrows():
#Check difference between coordinates
tol = 0.0001
if(abs(row['IPP_lat'] - row2['LKP Coord. (N/S)']) <= tol):
if(abs(row['IPP_lon'] - row2['LKP Coord. (E/W)']) <= tol):
if(abs(row['find_lat'] - row2['Find Coord (N/S)']) <= tol):
if(abs(row['find_lon'] - row2['Find Coord (E/W)']) <= tol):
print("Found Incident: %s" % row2['Key#'])
if(row2['Subject Category'] != 'Hiker'):
print("!!Mismatch Subject = %s" % row2['Subject Category'])
count += 1
print('Found %d/%d incidents' % (count,incidents.shape[0]))
#Make dataframe / csv file
#new_df = pd.DataFrame(columns=incidents.columns)
#new_df.insert(0,'key')
#print(new_df.columns)
#From the set of LPM coordinates, download and save map/linear features for areas as necessary
def collect_terrain():
#Collection of map centers, in meters. Use to check if we need to download a new area
centers = []
listname = './lp_data/incident_locations.csv'
samples = 1
incidents = pd.read_csv(listname,nrows=samples)
#Loop through search incidents
for index, row in incidents.iterrows():
ipp_point = [row['IPP_lat'],row['IPP_lon']]
find_point = [row['find_lat'],row['find_lon']]
#Convert to meters
ipp_xy = lat_lon2meters(ipp_point[0],ipp_point[1])
find_xy = lat_lon2meters(find_point[0],find_point[1])
#See if IPP has at least 1500 cells on either side.
#First find nearest center point
return
#Load elevation
res = 10 #Resolution of GIS collection
size = 6000 #Maximum size of map. Is this is latlon, grid cells, ?
#heading is direction of trajectories from north (default 0 degrees?)
[e,e_interp,x,y,data,lat_lon] = get_terrain_map(ipp_point, sample_dist = res, extent = size, show_plot = True)
#Load Linear Features. Probably need to convert some Matlab code...
return
#Collect GIS maps and layers for SAR initial positions
def main():
extent = 3000 #size in meters of map area
#incident_list()
collect_terrain()
return
if __name__ == "__main__":
main()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment