get_locations function

Subset input data based on locations