Identification and removal of bottlenecks for extended use of wastewater for irrigation or for other purposes