Exemple #1
0
 def plot_profile(self, get_index, get_value, parameter_code, parameter_label, time_index, ids):
     fig = plt.figure()
     if self.rbnNodes.isChecked():
         x_values = self.report.node_distances(ids)
     else:
         x_values = range(0, len(ids))
     self.time_linked_graphs.append([graphEPANET.update_profile, self.output, ids, x_values,
          get_index, get_value, parameter_code, parameter_label, fig.number, time_index])
     graphEPANET.update_profile(self.output, ids, x_values,
                                get_index, get_value, parameter_code, parameter_label, fig.number, time_index)
Exemple #2
0
 def plot_profile(self, attribute, time_index, items):
     fig = plt.figure()
     if self.rbnNodes.isChecked():
         x_values = self.report.node_distances(items)
     else:
         x_values = range(0, len(items))
     self.time_linked_graphs.append([
         graphEPANET.update_profile, self.output, items, x_values,
         attribute, fig.number, time_index
     ])
     graphEPANET.update_profile(self.output, items, x_values, attribute,
                                fig.number, time_index)
Exemple #3
0
    def cmdOK_Clicked(self):
        parameter_label = self.cboParameter.currentText()
        if self.rbnNodes.isChecked():
            attribute = ENR_node_type.get_attribute_by_name(parameter_label)
        else:
            attribute = ENR_link_type.get_attribute_by_name(parameter_label)

        time_index = self.cboTime.currentIndex()

        if self.rbnTime.isChecked(
        ):  # TODO: use get_series instead of get_value if it is more efficient
            graphEPANET.plot_time(self.output, attribute,
                                  self.selected_items())

        if self.rbnSystem.isChecked():
            graphEPANET.plot_system_flow(self.output)

        if time_index < 0 and (self.rbnProfile.isChecked()
                               or self.rbnFrequency.isChecked()):
            QMessageBox.information(
                None, self._main_form.model,
                "There is no time step currently selected.", QMessageBox.Ok)
        else:
            if self.rbnProfile.isChecked():
                items = self.selected_items()
                if len(
                        items
                ) < 2:  # if fewer than two items were selected, use all items
                    items = self.list_items.values()
                self.plot_profile(attribute, time_index, items)
            if self.rbnFrequency.isChecked():
                graphEPANET.plot_freq(self.output, attribute, time_index,
                                      self.list_items.values())
    def cmdOK_Clicked(self):
        parameter_label = self.cboParameter.currentText()
        lqual_name = ""
        lqual_unit = ""
        if parameter_label.startswith("Chemical") or \
            parameter_label.startswith("Age") or \
            parameter_label.startswith("Trace"):
            lqual_name = parameter_label
            if lqual_name.startswith("Age"):
                lqual_unit = "hours"
            elif lqual_name.startswith("Trace"):
                lqual_unit = "percent"
            parameter_label = "Quality"

        if self.rbnNodes.isChecked():
            attribute = ENR_node_type.get_attribute_by_name(parameter_label)
        else:
            attribute = ENR_link_type.get_attribute_by_name(parameter_label)

        time_index = self.cboTime.currentIndex()

        if self.rbnTime.isChecked(
        ):  # TODO: use get_series instead of get_value if it is more efficient
            graphEPANET.plot_time(self.output, attribute,
                                  self.selected_items(), lqual_name,
                                  lqual_unit)

        if self.rbnSystem.isChecked():
            ljuncs = []
            lreserv = []
            for node_j in self.project.junctions.value:
                ljuncs.append(node_j.name)
            for node_res in self.project.reservoirs.value:
                lreserv.append(node_res.name)
            graphEPANET.plot_system_flow(self.output, ljuncs, lreserv)

        if time_index < 0 and (self.rbnProfile.isChecked()
                               or self.rbnFrequency.isChecked()):
            QMessageBox.information(
                None, self._main_form.model,
                "There is no time step currently selected.", QMessageBox.Ok)
        else:
            if self.rbnProfile.isChecked():
                items = self.selected_items()
                if len(
                        items
                ) < 2:  # if fewer than two items were selected, use all items
                    items = self.list_items.values()
                self.plot_profile(attribute, time_index, items, lqual_name,
                                  lqual_unit)
            if self.rbnFrequency.isChecked():
                graphEPANET.plot_freq(self.output, attribute, time_index,
                                      self.list_items.values(), lqual_name,
                                      lqual_unit)
Exemple #5
0
    def cmdOK_Clicked(self):
        attribute_index = self.cboParameter.currentIndex()
        if self.rbnNodes.isChecked():
            get_index = self.output.get_NodeIndex
            get_value = self.output.get_NodeValue
            get_series = self.output.get_NodeSeries
            parameter_code = ENR_NodeAttributes[attribute_index]
            units = ENR_NodeAttributeUnits[attribute_index][self.output.unit_system]

        else:
            get_index = self.output.get_LinkIndex
            get_value = self.output.get_LinkValue
            get_series = self.output.get_LinkSeries
            parameter_code = ENR_LinkAttributes[attribute_index]
            units = ENR_LinkAttributeUnits[attribute_index][self.output.unit_system]

        parameter_label = self.cboParameter.currentText()
        if units:
            parameter_label += ' (' + units + ')'
        time_index = self.cboTime.currentIndex()

        if self.rbnTime.isChecked():  # TODO: use get_series instead of get_value if it is more efficient
            graphEPANET.plot_time(self.output, get_index, get_value, parameter_code, parameter_label, selected_list_items(self.lstToGraph))

        if self.rbnSystem.isChecked():
            graphEPANET.plot_system_flow(self.output)

        if time_index < 0 and (self.rbnProfile.isChecked() or self.rbnFrequency.isChecked()):
            QMessageBox.information(None, self._main_form.model,
                                    "There is no time step currently selected.",
                                    QMessageBox.Ok)
        else:
            if self.rbnProfile.isChecked():
                graph_ids = selected_list_items(self.lstToGraph)
                if not graph_ids:
                    graph_ids = self.report.all_node_ids()
                self.plot_profile(get_index, get_value, parameter_code, parameter_label, time_index, graph_ids)
            if self.rbnFrequency.isChecked():
                graphEPANET.plot_freq(self.output, get_index, get_value, parameter_code, parameter_label,
                                      time_index, all_list_items(self.lstToGraph))