I am trying to update several fields in a mosaic dataset, to do this I am creating a mosaic layer and then running a loop over each row and calculating fields.
NAME field contains a string which I would like to use to calculate several other fields. It is formatted like the following:
I would like to use split and use the output list indices in a field calculation (ie Project, Year and Date). The issue is I don't know to access the
NAME field within a mosaic layer.
# create mosaic layer mdl = arcpy.MakeMosaicLayer_management(md_path, "md_layer") # calculate fields loop print("Calculating fields in footprint...") for lyr in mdl: split_name = lyr.NAME.split('_') arcpy.CalculateField_management(lyr, "YEAR", ????, "PYTHON") print("Year calculated...") arcpy.CalculateField_management(lyr, "PROJECT",????, "PYTHON") print("Project calculated...")
It falls over at the first step -
split_name = lyr.NAME.split('_')-
AttributeError: 'Layer' object has no attribute 'NAME'
I would like to know the best approach to accessing specific fields within the mosaic layer.