Un-log data before returning

Data was logged on input, unlog before returning.
Also scale by 1/n when returning mean and covariance.
Write results to netcdf file