Skip to content

Commit

Permalink
Merge pull request #5 from awi-response/structure
Browse files Browse the repository at this point in the history
Structure
  • Loading branch information
initze authored Jun 28, 2024
2 parents a98e4c6 + d594a50 commit a82131e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
19 changes: 17 additions & 2 deletions 01_create_gfp_from_userwpt.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import sys
import glob
from pathlib import Path

folder = sys.argv[1]

Expand Down Expand Up @@ -29,9 +30,23 @@
- output: returns a iii_sitename_flp.gfp file which can be imported to the Garmin
'''

renamed_user_wpt_list = []
for file in glob.glob(f"{folder}\*_user.wpt"):
target = file[:-9]
target_name = Path(file).name[:-9]
print(target)
print(target_name)


# Script 1: rename waypoints
os.system(f'python 20230704_WPnameChanger.py {target}_user.wpt')
os.system(f'python 20230704_DEC2DMM.py {target}_user_renamed.wpt')
os.system(f'python 20230704_wpt_to_gfp.py {target}_user_renamed_DDM.wpt {target}_fpl.gfp')

# Script 2: change coordinate format
renamed_user_wpt = f'{target}_user_renamed.wpt'
os.system(f'python 20230704_DEC2DMM.py {renamed_user_wpt}')

# Script 3: create flightplans
fpl_dir = Path(folder) / 'FPL'
os.makedirs(fpl_dir, exist_ok=True)
outfile = fpl_dir / f'{target_name}_fpl.gfp'
os.system(f'python 20230704_wpt_to_gfp.py {target}_user_renamed_DDM.wpt {outfile}')
5 changes: 3 additions & 2 deletions 20230704_wpt_to_gfp.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sys
from pathlib import Path

def convert_wpt_to_gfp(input_file, output_file):
"""Create a flightplan from an ordered list of user waypoints.
Expand Down Expand Up @@ -31,6 +32,6 @@ def convert_wpt_to_gfp(input_file, output_file):
f.write(output_content)

if __name__ == "__main__":
user_wpt = sys.argv[1]
flp_gfp = sys.argv[2]
user_wpt = Path(sys.argv[1])
flp_gfp = (sys.argv[2])
convert_wpt_to_gfp(user_wpt, flp_gfp)

0 comments on commit a82131e

Please sign in to comment.