Commit 7bd7dbc1 authored by Bryson Howell's avatar Bryson Howell

small update to recenter on IPP

parent 32abb9df
...@@ -5,6 +5,7 @@ import os, sys, inspect ...@@ -5,6 +5,7 @@ import os, sys, inspect
from os import path, getcwd from os import path, getcwd
import pandas as pd import pandas as pd
#Add parent directory to path, where LPM code is
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir) parentdir = os.path.dirname(currentdir)
sys.path.insert(0, parentdir) sys.path.insert(0, parentdir)
...@@ -40,7 +41,8 @@ def main(exp_name='test', start_idx=0, n_envs=1, n_iter=10): ...@@ -40,7 +41,8 @@ def main(exp_name='test', start_idx=0, n_envs=1, n_iter=10):
#Calculate cells from extent #Calculate cells from extent
scale_factor = 3/20 # factor to get 6.66667m mapping from 1m mapping (1/6.6667) scale_factor = 3/20 # factor to get 6.66667m mapping from 1m mapping (1/6.6667)
extent = np.ceil(scale_factor*download_extent).astype(np.int32) test_extent = np.ceil(scale_factor*test_extent).astype(np.int32)
download_extent = np.ceil(scale_factor*download_extent).astype(np.int32)
for i in range(start_idx, end_idx): for i in range(start_idx, end_idx):
...@@ -49,7 +51,7 @@ def main(exp_name='test', start_idx=0, n_envs=1, n_iter=10): ...@@ -49,7 +51,7 @@ def main(exp_name='test', start_idx=0, n_envs=1, n_iter=10):
i_area = np.transpose(i_area)[0] i_area = np.transpose(i_area)[0]
#test - print start / end locations on grid #test - print start / end locations on grid
grid = np.zeros((3000,3000),dtype=np.int8()) grid = np.zeros((extent,extent),dtype=np.int8())
for incident in range(0,len(i_area)): for incident in range(0,len(i_area)):
#Dealing with large areas. Find the IPP point and resize around it #Dealing with large areas. Find the IPP point and resize around it
...@@ -64,6 +66,18 @@ def main(exp_name='test', start_idx=0, n_envs=1, n_iter=10): ...@@ -64,6 +66,18 @@ def main(exp_name='test', start_idx=0, n_envs=1, n_iter=10):
cur_ipp = ipp_latlons[i_area[incident+subzone]] cur_ipp = ipp_latlons[i_area[incident+subzone]]
ipp_xy = lat_lon2meters(cur_ipp[0],cur_ipp[1]) ipp_xy = lat_lon2meters(cur_ipp[0],cur_ipp[1])
print(cur_ipp) print(cur_ipp)
#Distance calculation
x_dist = cur_ipp[0] - sub_center[0]
y_dist = cur_ipp[1] - sub_center[1]
x_index = np.ceil(0.5*extent + scale_factor*x_dist).astype(np.int32)
y_index = np.ceil(0.5*extent + scale_factor*y_dist).astype(np.int32)
if(x_index >= extent or y_index >= extent or x_index)
#Grab subset of big grid
sub_grid =
#Locate find position from IPP #Locate find position from IPP
#Convert both to meters #Convert both to meters
#Use extent / cell count to determine which cell we're in: #Use extent / cell count to determine which cell we're in:
...@@ -166,7 +180,7 @@ def main(exp_name='test', start_idx=0, n_envs=1, n_iter=10): ...@@ -166,7 +180,7 @@ def main(exp_name='test', start_idx=0, n_envs=1, n_iter=10):
if __name__ == "__main__": if __name__ == "__main__":
start = 0 #Environment to start at (0 is first, 8 is first large map) start = 8 #Environment to start at (0 is first, 8 is first large map)
n = 1 #Number of environments to test n = 1 #Number of environments to test
mc = 10 #Monte Carlo iterations mc = 10 #Monte Carlo iterations
......
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