Calculate invalid pixel percentage

Calculate invalid pixel percentage

This script calculates invalid pixel percentage and updates the Invalid-pixel-percent field in notebooks/results_2022.csv.

To reproduce this workflow, make sure you have downloaded all necessary input files (velocity maps and static terrain geometries) from https://doi.org/10.17605/OSF.IO/HE7YR and have updated the Vx and Vy columns in notebooks/results_2022.csv with the downloaded file paths before starting the analysis.

import glaft
import pandas as pd
df = pd.read_csv('../results_2022.csv', dtype=str)
# df
for idx, row in df.iterrows():
    # print(row.Vx)
    if row.Software == 'Vmap':
        # print('yes')
        ## Vmap derived velocity maps have a NoData value of 0, which needs a special attention.
        exp = glaft.Velocity(vxfile=row.Vx, vyfile=row.Vy, nodata=0)
    else:
        exp = glaft.Velocity(vxfile=row.Vx, vyfile=row.Vy)
    exp.cal_invalid_pixel_percent()
    df.loc[idx, 'Invalid-pixel-percent'] = exp.invalid_percent * 100
df.to_csv('../results_2022.csv', index=False)
# df