1. Center a rack in the oven and preheat the oven to 325 degrees F. Butter an 8-inch square baking pan and line the bottom with parchment or wax paper.
2. Whisk together the flour, baking powder, baking soda and cinnamon and nutmeg, if you’re using them, in a small bowl. Toss together the granola, chocolate and coconut in another bowl.
3. Working in a stand mixer fitted with the paddle attachment, or in a large bowl with a hand mixer, beat the butter at low-medium speed for 2 to 3 minutes, or until soft and creamy. Add both sugars and beat for 2 minutes. Add the egg and beat until the mixture is smooth, about 2 minutes more. Beat in the vanilla and salt. Reduce the speed to low and add the flour mixture, mixing only until it disappears into the batter. Add the granola mixture, again mixing just until incorporated. Scrape the batter into the prepared pan, smooth the top and jiggle the pan a little to make sure that the batter gets into the corners.
4. Bake the cake for 35 to 40 minutes, until the top is honey brown and sugar- crackly; a skewer inserted into the center should come out clean. Transfer the pan to a rack and let rest for 10 minutes, then run a table knife around the edges of the cake and unmold it onto the rack; invert and cool to room temperature onto the racks.
Note-The cake is very moist and will keep, wrapped in plastic, at room temperature for about 4 days. You can also wrap it airtight and freeze it for up to 2 months; defrost it still wrapped. It is good served with vanilla yogurt or ice cream!