Fixed bug in calculate_scale when checking for 100% masked data - I queried wrong dimension for length of unmasked data