function result_status = planet_ndvi(JSONString, imgName)

pkg load image
JSONSentinel = JSONString
StartPixelLat = JSONSentinel.StartPixelLat
EndPixelLat = JSONSentinel.EndPixelLat
StartPixelLong = JSONSentinel.StartPixelLong
EndPixelLong = JSONSentinel.EndPixelLong
FieldID = JSONSentinel.FieldID
UID = JSONSentinel.UID

fileName = strcat(imgName,".png");
ndviImg = imread(fileName);
ndviImg = single(ndviImg);
size(ndviImg)

clip = [StartPixelLat EndPixelLat StartPixelLong EndPixelLong];
NDVI = ndviImg(clip(1):clip(2),clip(3):clip(4));
fileNameCSV = strcat(UID,"/");
fileNameCSV = strcat(fileNameCSV,"IndexValues_");
fileNameCSV = strcat(fileNameCSV,imgName);
fileNameCSV = strcat(fileNameCSV,"_");
fileNameCSV = strcat(fileNameCSV, FieldID);
fileNameCSV = strcat(fileNameCSV, ".csv");
	csvwrite(fileNameCSV, NDVI);

sizeNDVI = size(NDVI)
index_new = NDVI;
imgCMP = gen_map1_img(index_new);
filename = strcat(UID,"/");
filename = strcat(filename,imgName);
filename = strcat(filename,"_");
filename = strcat(filename,FieldID);
filename=strcat(filename,".png")
imwrite(imgCMP,filename);

result_status = "successful";
end