@@ -0,0 +1,1757 @@
+%22%22%22Utility script to delete a flowpath from the database and on-disk%22%22%22%0A%0Aimport psycopg2%0Aimport sys%0Aimport os%0A%0Adef do_delete(huc12, fpath, scenario):%0A    %22%22%22Delete a flowpath from the database and on disk%0A    %0A    Args:%0A      huc12 (str): The HUC12 that contains the flowpath%0A      fpath (str): The flowpath within that HUC12 that needs removal%0A      scenario (str): The IDEP scenario to remove this flowpath from%0A    %22%22%22%0A    pgconn = psycopg2.connect(database='idep', host='iemdb')%0A    cursor = pgconn.cursor()%0A    %0A    #Find the FID%0A    cursor.execute(%22%22%22SELECT fid from flowpaths WHERE huc_12 = %25s and%0A    fpath = %25s and scenario = %25s%22%22%22, (huc12, fpath, scenario))%0A    if cursor.rowcount == 0:%0A        print(%22ERROR: Can't find FID for HUC12: %25s FPATH: %25s SCENARIO: %25s%22 %25 (%0A            huc12, fpath, scenario))%0A        return%0A    fid = cursor.fetchone()%5B0%5D%0A    # Delete flowpath points%0A    cursor.execute(%22%22%22DELETE from flowpath_points where flowpath = %25s%0A    and scenario = %25s%22%22%22, (fid, scenario))%0A    # Delete flowpath%0A    cursor.execute(%22%22%22DELETE from flowpaths where fid = %25s%0A    and scenario = %25s%22%22%22, (fid, scenario))%0A    %0A    # Remove some files%0A    for prefix in %5B'env', 'error', 'man', 'prj', 'run', 'slp', 'sol', 'wb'%5D:%0A        fn = %22/i/%25s/%25s/%25s/%25s/%25s_%25s.%25s%22 %25 (scenario, prefix, huc12%5B:8%5D,%0A                                          huc12%5B8:%5D, huc12, fpath, prefix)%0A        if os.path.isfile(fn):%0A            print(%22REMOVE  %25s%22 %25 (fn,))%0A            os.unlink(fn)%0A        else:%0A            print(%22MISSING %25s%22 %25 (fn,))%0A    %0A    cursor.close()%0A    pgconn.commit()%0A%0Adef main():%0A    %22%22%22Go Main Go%22%22%22%0A    huc12 = sys.argv%5B1%5D%0A    fpath = sys.argv%5B2%5D%0A    scenario = sys.argv%5B3%5D%0A    do_delete(huc12, fpath, scenario)%0A%0Aif __name__ == '__main__':%0A    main()

Add util script for removal of flowpaths