I have more than 20 satellite images of an agricultural field from 3 different satellites. Each image name contains the data collection data and the satellite name in it. The first two digits of the file name is the month, the next two digits are the day, and the last part contains the satellite name. Suppose Six images will be used for this code.
Each image has been passed through a loop where they are processed into numpy array. The codes are -
image_list = ["D:/6.10.SkySat.tif", "D:/06.30.SkySat.tif", "D:/06.06.RapidEye.tif",
"D:/06.16.RapidEye.tif", "D:/06.26.PlanetScope.tif", "D:/06.30.PlanetScope.tif"]
for image in image_list:
#converting raster image to numpy array
array = arcpy.RasterToNumPyArray(image, nodata_to_value=9999)
#masking out the no data value and converting into one dimentional array
marray = numpy.ma.masked_values(array,9999)
new_array = marray.flatten()
#extracting the date and satellite name
date = image[3:8]
satellite = image[9:-4]
Here I am getting a one-dimensional array, one date, and one string(satellite name). For further use I want them in the following format shown below. The data will have three columns. One will have the all pixel values from the array, the next one will contain the date, and last will have the Satellite name.
Value Date Satellite
0.05825 6/15/2018 SkySat
0.07967976 6/15/2018 SkySat
0.09638854 6/15/2018 SkySat
0.12477265 6/15/2018 SkySat
0.13941683 6/15/2018 SkySat
0.13072205 6/15/2018 SkySat
0.12254229 6/15/2018 SkySat
0.13378483 6/15/2018 SkySat
0.13875392 6/15/2018 SkySat
0.14010076 6/10/2018 PlanetScope
0.1371166 6/10/2018 PlanetScope
0.13878246 6/10/2018 PlanetScope
0.1351179 6/10/2018 PlanetScope
0.16816537 6/10/2018 PlanetScope
0.16348109 6/10/2018 PlanetScope
0.15997969 6/10/2018 PlanetScope
0.16568226 6/10/2018 PlanetScope
0.190534599 6/12/2018 RapidEye
0.219114789 6/12/2018 RapidEye
0.251982007 6/12/2018 RapidEye
0.289779308 6/12/2018 RapidEye
0.333246204 6/12/2018 RapidEye
Is there any way to arrange the data in this format then write it into CSV or text file?