Closed tylerlum closed 3 years ago
Good idea from Kieran:
Example of usage. Change the magnitudes.csv and run ./build/bin/pathfinder_cli -p 8 --navigate 48 235 21 203 -g csv
Still have some questions about how this works. For instance, the time steps only work for the first 4. Maybe that's all that can be gotten? If that's the case, it seems like the 4th row is the one that matters most
Notes from discussion:
Summary: Change from huge row to more clear xy coordinates so that magnitudes can be modified more easily.
Found bug! Reading csv wrong, missing last element on each row.
CSV
|
readCSV
|
Nice Intuitive 2D Representation From CSV
lats2d = [[ 22, 22, 22, 22]
[ 21, 21, 21, 21]]
lons2d = [[203, 204, 205, 206]
[203, 204, 205, 206]]
mags2d =[[ 14, 15, 16, 17]
[ 10, 11, 12, 13]]
Angs2d = [[ 00, 00, 00, 00]
[ 00, 00, 00, 00]]
|
reverseColumns
|
2D Representation Just Before 1D Conversion
lats2d = [[ 21, 21, 21, 21]
[ 22, 22, 22, 22]]
lons2d = [[203, 204, 205, 206]
[203, 204, 205, 206]]
mags2d =[[ 10, 11, 12, 13]
[ 14, 15, 16, 17]]
Angs2d = [[ 00, 00, 00, 00]
[ 00, 00, 00, 00]]
|
convert2Dto1D
|
WHAT THE GRIBPARSE CLASS ACTUALLY HAS
lats = [ 21, 21, 21, 21, 22, 22, 22, 22]
lons = [203, 204, 205, 206, 203, 204, 205, 206]
mags = [ 10, 11, 12, 13, 10, 11, 12, 13]
angs = [ 00, 00, 00, 00, 00, 00, 00, 00]
south = 21
north = 22
west = 203
east = 206
What is gribIndex of (lat=22, lon=204)?
gi = (22-21)*(206-203+1) + (204-203) = 1(4) + 1 = 5
What is gribIndex of (lat=21, lon=206)?
gi = (21-21)*(206-203+1) + (206-203) = 0(4) + 3 = 3
gribIndex = (lat-south) * (east-west+1) + (lon-west);
TEST OUTPUT
intuitiveLats
22.000000,22.000000,22.000000,
21.000000,21.000000,21.000000,
intuitiveLons
203.000000,204.000000,205.000000,
203.000000,204.000000,205.000000,
intuitiveMags3
14.000000,15.000000,16.000000,
10.000000,11.000000,12.000000,
intuitiveAngs3
0.000000,0.000000,0.000000,
0.000000,0.000000,0.000000,
reversedLats
21.000000,21.000000,21.000000,
22.000000,22.000000,22.000000,
reversedLons
203.000000,204.000000,205.000000,
203.000000,204.000000,205.000000,
reversedMags3
10.000000,11.000000,12.000000,
14.000000,15.000000,16.000000,
reversedAngs3
0.000000,0.000000,0.000000,
0.000000,0.000000,0.000000,
readyLats
21.000000,21.000000,21.000000,22.000000,22.000000,22.000000,
readyLons
203.000000,204.000000,205.000000,203.000000,204.000000,205.000000,
readyMags3
10.000000,11.000000,12.000000,14.000000,15.000000,16.000000,
readyAngs3
0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,
FIXED! @kpfgallagher thank you for the debugging skills :D
@kpfgallagher ready for re-review
Seems like there is a visible difference in the paths when presented with an obstacle, although it doesn't avoid it fully. This is with a weather factor of 3000.
And this is with a weather factor of 10000 - even more avoidance.
Great! Will get this merged in. Will be good to add some README info in another PR
READY FOR REVIEW.
The purpose of this PR is to allow for csv writing and reading for custom weather tests.
There are three possible options:
./build/bin/pathfinder_cli -p 8 --navigate 48 235 21 203
./build/bin/pathfinder_cli -p 8 --navigate 48 235 21 203 -g mydata.grb
./build/bin/pathfinder_cli -p 8 --navigate 48 235 21 203 -g csv
(not path to csv file, just exactly csv)In options 1 and 2, it saves the weather data into the
output_csvs
directory in the following files:In option 3, it reads from
input_csvs
those same filenames. Those files can be modified to make custom tests.An example of input_csvs are included in this PR, and can be modified as desired.
May want to find a cleaner way to pass in custom files and save custom files. For now, just modify the files in
input_csvs
as needed.