Hi, removing depth map and then setting it worked for me:
ddata = numpy array of depth values in local CS as float32
DM = Metashape.Image.fromstring(ddata.tostring(), ddata.shape[1], ddata.shape[0], ' ', 'F32')
depth_map = chunk.depth_maps[camera]
depth_map.setImage(DM)
del chunk.depth_maps[camera]
chunk.depth_maps[camera] = depth_map
P.S. also please note that setImage has a level argument which is equal to zero by default, but there can be multiple levels (typically three), so maybe it is better to create a fresh one:
ddata = numpy array of depth values in local CS as float32
DM = Metashape.Image.fromstring(ddata.tostring(), ddata.shape[1], ddata.shape[0], ' ', 'F32')
depth_map = Metashape.DepthMap()
depth_map.setCalibration(chunk.depth_maps[camera].getCalibration())
depth_map.setImage(DM)
del chunk.depth_maps[camera]
chunk.depth_maps[camera] = depth_map