Exemplo n.º 1
0
    arcpy.MakeFeatureLayer_management(infc_gdb, "fc_lyr")
    path, fc = os.path.split(infc_gdb)
    clippath, fc_clip = os.path.split(clipfc)
    print "Starting Clip for {0} with ".format(fc, fc_clip)
    outfc = out_working + os.sep + fc + "_LandClip"
    if arcpy.Exists(outfc):
        print "{0} Already clipped".format(outfc)
    else:
        arcpy.env.workspace = out_working
        arcpy.env.overwriteOutput = True
        arcpy.Clip_analysis("fc_lyr", clipfc, outfc)
else:
    if MutliGDB:
        for v in infc_gdb:
            ingdb = v
            for fc in functions.fcs_in_workspace(ingdb):
                start_loop = datetime.datetime.now()
                path, gdb = os.path.split(ingdb)
                inloopfc = ingdb + os.sep + fc
                arcpy.Delete_management("fc_lyr")
                arcpy.MakeFeatureLayer_management(inloopfc, "fc_lyr")
                clippath, fc_clip = os.path.split(clipfc)
                outgdbpath = out_working + os.sep + gdb
                CreateGDB(out_working, gdb, outgdbpath)
                print "Starting Clip for {0} with ".format(fc, fc_clip)
                outfc = outgdbpath + os.sep + fc + "_LandClip"
                if arcpy.Exists(outfc):
                    print "{0} Already clipped".format(outfc)
                else:
                    arcpy.env.workspace = out_working
                    arcpy.env.overwriteOutput = True
Exemplo n.º 2
0
    for line in inputFile:
        line = line.split(',')
        finalGDB = str(line[0])
        finalGDB = finalGDB.strip('\n')
        use = str(line[1])
        use = use.strip('\n')
        outtable = finalGDB + os.sep + "Topo_results_" + use

        if arcpy.Exists(outtable):
            intable = outtable
        else:
            intable = topolist

        print finalGDB

        for fc in functions.fcs_in_workspace(finalGDB):
            #print fc
            current_update = {}
            CHchecklist = fc.split("_")
            CHcheck = CHchecklist[0]
            if CHcheck != 'Topo':
                continue
            elif str(CHchecklist[1]) == 'T':
                continue
            elif str(CHchecklist[1]) == 'R':
                entlist = fc.split("_")
                ent = str(entlist[2])
                filename = str(entlist[1]) + "_" + str(entlist[2])
                #print filename

            else:
Exemplo n.º 3
0
for k, v in globals().items():
    if k.startswith('huc'):
        num = k.replace("huc", "")
        HUCdict[num] = v

start = time.time()
start_times(start)

# Create Workspaces
create_directory(File_dir)
create_directory(LYR_dir)
create_directory(DBF_dir)

# Execute loop that will check each input comp fc to see if a species in the species list is present, and if so it will
# extract all streams with in the range and save to a dbf
for fc in functions.fcs_in_workspace(MasterSpeFC):
    check_prj = fc.split('_')
    try:
        if 'AlbersUSA' == check_prj[4]:
            continue
    except:
        pass

    print fc
    input_fc = MasterSpeFC + os.sep + fc
    stream_crosswalk(input_fc, HUC2_lwr48, LYR_dir, DBF_dir, HUCdict, noNHD,
                     csvpath)

print noNHD
done = time.time()
end_times(done, start)
Exemplo n.º 4
0
createdirectory(DBF_dir)
createdirectory(CSV_dir)

counter = 0

if MultiFolder:
    FolderList = os.listdir(inFolder)
    print FolderList

    for value in FolderList:
        FinalGDB = inFolder + os.sep + value + os.sep + 'Final.gdb'
        # print FinalGDB
        outfolder = DBF_dir + os.sep + value
        createdirectory(outfolder)
        if fc:
            for fc in functions.fcs_in_workspace(FinalGDB):
                print fc
                counter += 1
                table = "{0}.dbf".format(fc)
                outtable = outfolder + os.sep + table
                tableview = "tbl_view_" + str(counter)
                arcpy.Delete_management("fc_lyr")
                if arcpy.Exists(outtable):
                    continue
                else:
                    arcpy.MakeFeatureLayer_management(fc, "fc_lyr")
                    arcpy.MakeTableView_management("fc_lyr", tableview)
                    arcpy.TableToTable_conversion(tableview, outfolder, table)

        else:
            for raster in functions.rasters_in_workspace(FinalGDB):
Exemplo n.º 5
0

def CreateDirectory(DBF_dir):
    if not os.path.exists(DBF_dir):
        os.mkdir(DBF_dir)


def CreateGDB(OutFolder, OutName, outpath):
    if not arcpy.Exists(outpath):
        arcpy.CreateFileGDB_management(OutFolder, OutName, "CURRENT")


start_script = datetime.datetime.now()
print "Started: {0}".format(start_script)

for fc in functions.fcs_in_workspace(inGDB):
    compFC = inGDB + os.sep + str(fc)
    group = fc.split('_')
    group = str(group[2])
    fish = fishnet
    outpath_working = outpath + os.sep + "Working.gdb"
    outpath_final = outpath + "GAP_" + group + '.gdb'
    resultfolder, workinggdb = os.path.split(outpath_working)
    finalgdb = os.path.basename(outpath_final)
    lyr = resultfolder + os.sep + 'lyr'

    CreateDirectory(resultfolder)
    CreateDirectory(lyr)

    CreateGDB(resultfolder, workinggdb, (resultfolder + os.sep + workinggdb))
    CreateGDB(resultfolder, finalgdb, (resultfolder + os.sep + finalgdb))
# import system modules
import os
import csv
import time
import datetime
import functions

import arcpy

# Title : Checks projection for all fc infolder to make sure they are in the STD geo projection before moving forward

Infolder = 'J:\Workspace\ESA_Species\CriticalHabitat\NAD_Final'

# #####################################################################################################################
##############################################################################################################
start_script = datetime.datetime.now()
print "Script started at {0}".format(start_script)
# Prints Elapse clock
prj_list = []

for fc in functions.fcs_in_workspace(Infolder):
    # set local variables
    ORGdsc = arcpy.Describe(fc)
    ORGsr = ORGdsc.spatialReference
    ORGprj = ORGsr.name.lower()
    if ORGprj not in prj_list:
        prj_list.append(ORGprj)
        print "{0}  {1}".format(fc, ORGsr.name)
    else:
        pass
Exemplo n.º 7
0
                symbologyLayer = "J:\Workspace\ESA_Species\Step3\ZonalHis_GAP\GAP.lyr"
                arcpy.ApplySymbologyFromLayer_management(
                    "rdlayer", symbologyLayer)
                functions.ZonalHist(lyr, zoneField, "rdlayer", dbf,
                                    outpath_final, scratchpath)
                del lyr

                print "Loop completed in: {0}".format(datetime.datetime.now() -
                                                      start_loop)


start_script = datetime.datetime.now()
print "Script started at: {0}".format(start_script)

if inlocation[-3:] == 'gdb':
    for fc in functions.fcs_in_workspace(inlocation):
        infc = inlocation + os.sep + fc
        outpath_final = results
        for v in pathlist:
            rasterLocation = v
            for raster in rasters_in_workspace(rasterLocation):
                ZonalHist(rasterLocation, raster, outpath_final, infc,
                          FullFile)
else:
    infc = inlocation
    outpath_final = results
    for v in pathlist:
        rasterLocation = v
        for raster in rasters_in_workspace(rasterLocation):
            ZonalHist(rasterLocation, raster, outpath_final, infc, FullFile)