Fix bug in write so it includes the weight map and the bad pixel mask
Build truth catalog