I am trying to batch process the conversion of shapefiles to rasters. I am stuck on how to specify the name for each output raster file. Part of the trick is that my input shapefiles are the names of frogs in "genus_species" format and go over the 13 character requirement of rasters.
For example, here are the names of my first two shapefiles: Acris_crepitans.shp Anaxyrus_americanus.shp
I would like the output rasters to be as follows (i.e., the first two letters of the genus, underscore, and then however many remaining characters can fit for the species): Ac_crepitans An_americanus
Here is my code thus far (it's probably horrible b/c I'm new to Python):
********************************************************************************
# Import arcpy module
import arcpy
from arcpy import env
#Set working environment
env.workspace = "C:\\GIS_data\\Frog_shps"
Dir = env.workspace
#List FCs
fcList = arcpy.ListFeatureClasses()
# Loop
for fc in fcList:
output = Dir + "\\" + [here is where I am stuck]
# Process: Polygon to Raster
arcpy.FeatureToRaster_conversion(fc, "BINOMIAL", output, 1000)
print "finished polygon to raster"
********************************************************************************