if no downsample provided, calculate one

calculate downsample based on range. Also calculate range if needed.