Skip to content

Commit

Permalink
Added in script to remove the bad epsg in AK
Browse files Browse the repository at this point in the history
  • Loading branch information
micahjohnson150 committed Aug 18, 2024
1 parent d114e71 commit c6ce183
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
3 changes: 2 additions & 1 deletion scripts/download/nsidc_sources.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ https://n5eil01u.ecs.nsidc.org/SNOWEX/SNEX20_TS_SP.002/
https://n5eil01u.ecs.nsidc.org/SNOWEX/SNEX21_TS_SP.001/
https://n5eil01u.ecs.nsidc.org/SNOWEX/SNEX_Met.001/
https://n5eil01u.ecs.nsidc.org/SNOWEX/SNEX23_Lidar.001/2022.10.24/SNEX23_Lidar_FLCF_CH_0.25M_20221024_V01.0.tif
https://n5eil01u.ecs.nsidc.org/SNOWEX/SNEX23_Lidar.001/2023.03.11/SNEX23_Lidar_FLCF_SD_0.25M_20230311_V01.0.tif
https://n5eil01u.ecs.nsidc.org/SNOWEX/SNEX23_Lidar.001/2023.03.11/SNEX23_Lidar_FLCF_SD_0.25M_20230311_V01.0.tif

39 changes: 39 additions & 0 deletions scripts/remove_data/remove_bad_utm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
"""
A set of data got uploaded with a bad EPSG value. This script removes them
"""
from snowexsql.data import LayerData, PointData
from snowexsql.api import DB_NAME, db_session

def delete_data(session, qry):
ans = input(f"You are about to delete {qry.count()}, Continue? (Y/n)")
if ans == 'Y':
qry.delete()
session.commit()
else:
print('Aborted!')


def main():

# Remove GPR data with bad EPSG in AK
with (db_session(DB_NAME) as (session, engine)):
# Filter to alaska
qry = session.query(PointData).filter(PointData.utm_zone==6)
# Filter to GPR by Randall
qry = qry.filter(PointData.observers=='Randall Bonnell')
qry = qry.filter(PointData.instrument == 'pulseEkko pro 1 GHz GPR')
delete_data(session, qry)

# Delete the AK pits with bad EPSG.
qry = session.query(LayerData).filter(LayerData.utm_zone==6)
types_pit = ['sample_signal', 'grain_size', 'density',
'reflectance', 'permittivity', 'lwc_vol',
'manual_wetness', 'equivalent_diameter',
'specific_surface_area', 'grain_type','temperature',
'hand_hardness'
]
qry = qry.filter(PointData.types.in_(types_pit))
delete_data(session, qry)

if __name__ == '__main__':
main()

0 comments on commit c6ce183

Please sign in to comment.