added sorting to the function so that the rain and discharge dataframes are sorted in chronological order