<jupyter_start><jupyter_text>Script to convert geolocation into correct format<jupyter_code>import geopandas as gpd
import pandas as pd
import os
%config Completer.use_jedi = False<jupyter_output><empty_output><jupyter_text>Settings<jupyter_code>INFILE = 'nav.txt'
NEW_CRS = 'EPSG:32608'
H_ACC = 1
V_ACC = 1<jupyter_output><empty_output><jupyter_text>Load images<jupyter_code>df = pd.read_csv(INFILE, sep='\t')
df.head(2)<jupyter_output><empty_output><jupyter_text>Change image suffixes<jupyter_code>images = df['File '].str.replace('.macs', '.tif')
images = images.apply(lambda x: x.strip().split('/')[-1])<jupyter_output><empty_output><jupyter_text>Load coordinates to geom an reproject to selected crs<jupyter_code>#gdf = gpd.GeoDataFrame(df, geometry=gpd.points_from_xy(df['latitude [decimal degrees]'], df['longitude [decimal degrees]']))
series = gpd.GeoSeries(gpd.points_from_xy(df['Lon[deg] '], df['Lat[deg] ']), crs='EPSG:4326')
series_new = series.to_crs(crs=NEW_CRS)<jupyter_output><empty_output><jupyter_text>Fill Table<jupyter_code>df['imagename_tif'] = images
df['x'] = series_new.geometry.x
df['y'] = series_new.geometry.y
df['horizontal_accuracy'] = H_ACC
df['vertical_accuracy'] = V_ACC<jupyter_output><empty_output><jupyter_text>Create final structure<jupyter_code>df.columns
df_new = df[['imagename_tif', 'x', 'y', 'Alt[m] ', 'Omega[deg] ',
       'Phi[deg] ', 'Kappa[deg]', 'horizontal_accuracy', 'vertical_accuracy']]
df_new<jupyter_output><empty_output><jupyter_text>Export file<jupyter_code>df_new.to_csv('out.txt', sep='\t', header=False, index=False)
with open('out.txt', 'r') as f:
    l = f.readlines()
newlines = [NEW_CRS + '\n']  +l
with open('geo.txt', 'w') as f_new:
    f_new.writelines(newlines)
os.remove('out.txt')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16863406408094436, 'fraction_numerical': 0.007307476110174255, 'mean_word_length': 8.88888888888889, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '314842', 'license': 'FTL', 'n_tokens_mistral': 731, 'n_tokens_neox': 716, 'n_words': 105, 'path': 'correctednav_to_odmnav.ipynb', 'repo_name': 'awi-response/MACS_tools', 'size': '1779'}