-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added in script to remove the bad epsg in AK
- Loading branch information
1 parent
d114e71
commit c6ce183
Showing
2 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |