Could anyone let me know if they see why this would cause a memory issue? The user running the script let me know he got a message that he ran out of memory while the script was running.
EDIT: Originally this was being used by someone else on the large dataset, but now I am running on my machine and getting an 'Out of Memory' message. No error message is given in the python window. I just get a small popup that says 'Out of Memory', or once it just shut down ArcMap. I watched the performace tab in the Task Manager and it the memory just slowly rises the whole time. It goes through ~5000 points before giving this message. I thought maybe deleting the variables after each row might help (just a guess), but didn't seem to.
This is being run with ArcMap in the Python window. It takes the layers from the table of contents as inputs. Not ideal, but needed to use SelectByDimension which updates the mosaic dataset in ArcMap.
Task: iterate through points, get a date, filter a mosaic dataset of rasters with this date, and then get the cell value at the point location. I am not familiar enough with these operations to know what is building up in the memory. Anyone have any ideas.
def getSST(mosaicds,detections,dateField,longField,latField,sstField,reportID):
count = 1
with arcpy.da.UpdateCursor(detections,[dateField,longField,latField,sstField,reportID]) as cursor:
for row in cursor:
split = row[0].split("/")
timestamp = "{}-{}-{}".format(split[2],split[0],split[1])
arcpy.SelectByDimension_md(mosaicds,[["StdTime",timestamp]],"BY_VALUE")
coords = str(row[1])+" "+str(row[2])
value = arcpy.GetCellValue_management(mosaicds,coords)
SST = value.getOutput(0)
if SST == "NoData":
row[3] = -999
else:
row[3] = SST
cursor.updateRow(row)
if count % 500 == 0:
print count
count += 1
del split, timestamp, coords, value, SST