I read about the handbrak cable being possibly loose, but couldn't really understand how to check this
I already posted about it, the outer PVC jacket rubs and wears on the rear underbody 'A' frame. Once the outer jacket is chaffed through, the edges of the 'A' touch and bang on the inner spiral metal core of the cable. You can only visualise and check the cable when all 4 wheels are on the ground and the rear is loaded which lowers the chassis on to the cable. Reach underneath from each side and run your fingers along the outer PVC jacket feeling for rubbing and wear through. My fix is to replace the worn cable (search) then slit a length of heater hose, push it over and hold each end with a tywrap.
N.B This isn't the only cause of rattles, but the hardest to find and simplest to fix - well replacing the hand brake cables is a torment!
The other possibility may be a broken spring. They are hard to spot because it's usually the top or bottom turn that breaks and you won't see it unless you run your fingers around the coils from top to bottom. My street is good for test driving rattles because it has horrible road humps - which are often the cause of spring failure on modern cars.
Start with a full roof lube to eliminate sqeaks and rattles from roof seals. There are some other ideas in this thread. Get somebody listening through the ski hole with a tube in their ear to try and find the location. Roof up and down changes the weight distribution on the rear suspension considerably and there may be something there to look at? There's usually a distinct different between solid 'clunks' (more serious) and annoying metalic contact noises.
Roof parts and the hinges themselves sit on rubber buffers when the roof is down. There are also small buffers under the rear window frame. But I would suspect any loud dull thud sounds might come from the hinges if they are distorted because under the weight of roof parts, they should sit down evenly on the buffers - check sliding in a thin rule there is pressure on each buffer and no gaps, a buffer is missing or a roof ram hasn't collapsed evenly?
Another obscure possibility is rattles coming from the main and smaller hydraulic ram pivots. With the roof propped I've removed mine one at a time and there's quit a lot of tolerance for the pin in the holes. Normally when the roof is opened or closed there should be some residual hydraulic pressure or weight from the roof package to hold the pivot pins under pressure. When the package settles down on the trunk floor buffers, their height (Too low) could be holding the hinges slack or unsupported allowing the pins to rattle? Check both hinges are sat on their buffers with equal pressure first, then try adding a few mm of packing both sides to lift the height of the hinge buffer. That should force the package to increase downwards pressure on the ram hinge pins. If something isn't right and hinges are not settling down evenly on the buffers, there's something more serious to investigate further because it may be the consequence of a previous roof hinge 'crunch'.