I would like to preface this by saying that I am very new to python and its capabilities. So my problem is that while using the in_memory work space I encountered some limitations in querying the minimum value for a field. My workaround for this was to create a dictionary, then use a the search cursor to find the minimum distance. My method returns the results that I am looking for but I have not been able to incorporate these results into my selection. Below is a snippet of the code I am currently using:
# Process: Near
arcpy.Near_analysis(newStationLayer, targetPoint, "", "NO_LOCATION", "NO_ANGLE", "")
nearDist = {}
with arcpy.da.SearchCursor(newStationLayer,("OID@","NEAR_DIST")) as cur:
for row in cur:
nearDist[row[0]] = row[1]
arcpy.AddMessage("Near distances: %s"%str(nearDist))
## arcpy.AddWarning(min(nearDist.iteritems(),key=operator.itemgetter))
lowestOID = min(nearDist,key=nearDist.get)
arcpy.AddWarning(lowestOID)
arcpy.SelectLayerByAttribute_management()