env.extent = Australia_extent

maxent_raster = arcpy.sa.Raster(maxent_model)

# start a list of layers to delete at the end
layers_to_delete = []

## Buffer the full set of sequenced locations   STEPS 1 & 2
print "Buffering all points\n"
point_buffer = arcpy.sa.EucDistance(points, buffer_dist, grid_resolution)
point_buffer.save("all_points_buf")  ## once the code is working, no need to save this layer
layers_to_delete.append("all_points_buf")

## from the points shapefile, get a list of the lineages
print "Lineage list\n"
lineage_list = LineageFunctions.getFieldValues(points, Lineage_field_name)
print "Lineages:"
for lineage in lineage_list:
    print "   ", lineage

# calculate the extent for weight grids
points_properties = arcpy.Describe(points)
points_extent = points_properties.extent
buffer_ratio = 1 + additional_buffer
extent_buffer = buffer_dist * buffer_ratio

# new extent is the same as points layer + a buffer
# but where the extended buffer goes beyond the extent of Australia, limit to Australia
xmin = math.floor(max([points_extent.xmin - extent_buffer, Australia_extent.XMin]))
ymin = math.floor(max([points_extent.ymin - extent_buffer, Australia_extent.YMin]))
xmax = math.ceil(min([points_extent.xmax + extent_buffer, Australia_extent.XMax]))