Ejemplo n.º 1
0
    return extrap_site
#------------------------------------------------------------

#--------------------------------------------------------------------------    
#--------------------------------------------------------------------------
#MAIN

if __name__ == "__main__":

    try:

        #---- Create the Geoprocessing Object ----------------------
        gp = arcgisscripting.create(9.3)
        
        #----- Create the Custom Error Object ----------------------
        e = SvmpToolsError(gp)
        # Set some basic defaults for error handling
        e.debug = True
        e.full_tb = True
        
        #-------- unit conversion flag --------------------
        unit_convert = "sf2m"
        
        def msg(msg):
            gp.AddMessage(msg)
        
            
        # ----------- PARAMETERS ----------------------------------
        # Temporary stand-ins for parameters
        #dbPath = "c:/projects/dnr_svmp/output/eelgrass_monitoring/"
        #blPath = "c:/projects/dnr_svmp/output/eelgrass_monitoring/base_layers/"
Ejemplo n.º 2
0
    '''Create dictionary of extrapolation type by site id
       using lookup from analysis/geo stratum to 
       determine analysis and extrapolation type
    '''
    site_extrap = {}
    for (siteid,data) in sites_strata.items():
        site_extrap[siteid] = lookup_dict[tuple(data)]
    # invert this dictionary to get sites by extrapolation/analysis stratum
    extrap_site = invert_dict(site_extrap)
    return extrap_site

#---- Create the Geoprocessing Object ----------------------
gp = arcgisscripting.create()

#----- Create the Custom Error Object ----------------------
e = SvmpToolsError(gp)
# Set some basic defaults for error handling
e.debug = True
e.full_tb = True

#-------- unit conversion flag --------------------
unit_convert = "sf2m"

#------------------   DATA QUERIES AND GROUPING --------------------------------
#-------------------------------------------------------------------------------
#----------------- MATCHING SITES sampled in YEARS 1 & 2 -----------------------
#-------------------------------------------------------------------------------
# Get list of sites sampled in both years and their strata
sites_strata_2yr = sites_strata(gp,svmp_all_sites_fc,sample_group,year1,year2)
sites2yr = sorted(sites_strata_2yr.keys())
# For use in query strings
Ejemplo n.º 3
0
def msg(msg):
    gp.AddMessage(msg)

shapefile = "C:/projects/dnr_svmp/output/eelgrass_monitoring/site_folders/nps1446/video_transect_data/2008_nps1446_transect_data.shp"
selStatement = '"tran_num" = 1'

try:

    # Create the geoprocessing object
    gp = arcgisscripting.create()
    # Overwrite existing output data 
    gp.OverWriteOutput = 1

    # Create the custom error class
    # and associate it with the gp
    e = SvmpToolsError(gp)
    # Set some basic defaults for error handling
    e.debug = True
    e.full_tb = True
    #e.exit_clean = False
    #e.pdb = True
    
    msg(selStatement)
    rows = gp.UpdateCursor(shapefile,selStatement)
    row = rows.Next()
    while row:
        id = row.getValue("Id")
        date = row.getValue(utils.shpDateCol)
        msg(id)
        msg(date)
        row = rows.Next()
Ejemplo n.º 4
0
import os
import sys
import traceback
import arcgisscripting
from svmp_exceptions import SvmpToolsError

DEBUG = True
PDB_DEBUG = False

# Create the geoprocessing object
gp = arcgisscripting.create()

# Create the custom error class
# and associate it with the gp
error = SvmpToolsError(gp)

# Set some basic defaults for error handling
error.debug = True
error.pdb = True

def main():
  try:
    raise RuntimeError
  except Exception, E:
    error.call('An intentional RuntimeError occurred in the python script..')

if __name__ == "__main__":
  try:
    main()
  except Exception, E:
    error.call(E)
Ejemplo n.º 5
0
#--------------------------------------------------------------------------    
#--------------------------------------------------------------------------
#MAIN

if __name__ == "__main__":

    try:

        # Create the geoprocessing object
        gp = arcgisscripting.create()
        # Overwrite existing output data (for testing only?)
        gp.OverWriteOutput = 1

        # Create the custom error class
        # and associate it with the gp
        e = SvmpToolsError(gp)
        # Set some basic defaults for error handling
        e.debug = True
        e.full_tb = True

        #-- Get parameters -----
        # Input Data Parent Directory 
        # Transect ASCII files are located in subdirectories below here
        #  Default: Environment - current workspace
        # outParentDir: Output Data Parent Directory.  Default: Environment - scratch workspace
        # siteFile: Full Path of text file containing list of sites to process
        inParentDir,siteFile,outParentDir = get(0),get(2),get(3)  
        # Input Data Coordinate System.  Default:  GCS_WGS_1984
        # Ouput Data Coordinate System.  Default:  Default: NAD_1983_HARN_StatePlane_Washington_South_FIPS_4602_Feet
        # Survey Year for data to be processed
        inCoordSys,outCoordSys, surveyYear = get(1),get(4),get(5)
Ejemplo n.º 6
0
#--------------------------------------------------------------------------    
#--------------------------------------------------------------------------
#MAIN

if __name__ == "__main__":

    try:

        # Create the geoprocessing object
        gp = arcgisscripting.create()
        # Overwrite existing output data 
        gp.OverWriteOutput = 1

        # Create the custom error class
        # and associate it with the gp
        e = SvmpToolsError(gp)
        # Set some basic defaults for error handling
        e.debug = True
        e.full_tb = True
        #e.exit_clean = False
        #e.pdb = True

        #Get parameters
        # Input Transect Point Shapefile Parent Directory 
        # Transect ASCII files are located in subdirectories below here 
        ptParentDir = gp.GetParameterAsText(0)  
        # Input Sample Polygon Shapefile Parent Directory 
        pyParentDir = gp.GetParameterAsText(1)
        # Control File Parent Directory
        ctlParentDir = gp.GetParameterAsText(2)
        # Full Path of text file containing list of sites to process