예제 #1
0
    def fetchSummaryData(self, observation_data_fetcher, key, cases):
        plot_data = PlotData(key)

        histogram_factory = HistogramPlotDataFactory(key)
        refcase_fetcher = RefcaseDataFetcher(self.ert())

        self.addObservationData(plot_data, key, observation_data_fetcher,
                                histogram_factory)

        self.addRefcaseData(plot_data, key, refcase_fetcher, histogram_factory)

        self.addEnsembleData(plot_data, key, cases,
                             EnsembleDataFetcher(self.ert()),
                             histogram_factory)

        self.addPcaData(plot_data, key, cases)

        if refcase_fetcher.hasRefcase():
            unit = refcase_fetcher.getRefCase().unit(key)
            if unit != "":
                plot_data.setUnitY(unit)

        plot_data.setHistogramFactory(histogram_factory)

        return plot_data
예제 #2
0
    def getPlotDataForKeyAndCases(self, key, cases):
        observation_data_fetcher = ObservationDataFetcher(self.ert())
        block_observation_data_fetcher = BlockObservationDataFetcher(
            self.ert())
        gen_kw_fetcher = EnsembleGenKWFetcher(self.ert())
        gen_data_fetcher = EnsembleGenDataFetcher(self.ert())

        if self.isBlockObservationKey(key):
            return self.fetchBlockObservationData(
                block_observation_data_fetcher, key, cases)

        elif self.isSummaryKey(key):
            return self.fetchSummaryData(observation_data_fetcher, key, cases)

        elif self.isGenKWKey(key):
            return self.fetchGenKWData(gen_kw_fetcher, key, cases)

        elif self.isGenDataKey(key):
            return self.fetchGenData(gen_data_fetcher, key, cases)

        elif self.isPcaDataKey(key):
            plot_data = PlotData(key)
            pca_plot_data = self.fetchPcaData(key, cases)
            plot_data.setUserData("PCA", pca_plot_data)
            return plot_data

        else:
            raise NotImplementedError("Key %s not supported." % key)
예제 #3
0
    def fetchGenKWData(self, gen_kw_fetcher, key, cases):
        plot_data = PlotData(key)

        histogram_factory = ReportStepLessHistogramPlotDataFactory(key)
        self.addEnsembleData(plot_data, key, cases, gen_kw_fetcher,
                             histogram_factory)
        plot_data.setHistogramFactory(histogram_factory)

        return plot_data
예제 #4
0
    def fetchGenData(self, gen_data_fetcher, key, cases):
        plot_data = PlotData(key)

        gen_data_observation_fetcher = ObservationGenDataFetcher(self.ert())

        if gen_data_observation_fetcher.hasData(key):
            self.addObservationData(plot_data, key,
                                    gen_data_observation_fetcher)
            self.addEnsembleData(plot_data, key, cases, gen_data_fetcher)
            self.addPcaData(plot_data, key, cases)

        return plot_data
예제 #5
0
    def __init__(self, web_page, plot_url):
        QObject.__init__(self)
        assert isinstance(web_page, QWebPage)

        self.__web_page = web_page
        self.__ready = False
        self.__html_ready = False
        self.__data = PlotData("invalid", parent=self)
        self.__size = None
        self.__temporary_data_object = None

        self.applyContextObject()

        root_path = os.getenv("ERT_SHARE_PATH")
        path = os.path.join(root_path, plot_url)
        self.__web_page.mainFrame().load(QUrl("file://%s" % path))
        self.__web_page.loadFinished.connect(self.loadFinished)
예제 #6
0
    def fetchBlockObservationData(self, block_observation_data_fetcher, key,
                                  cases):
        plot_data = PlotData(key)

        plot_data.setUnitY(self.ert().eclConfig().getDepthUnit())
        plot_data.setUnitX(self.ert().eclConfig().getPressureUnit())

        if block_observation_data_fetcher.hasData(key):
            block_observation_data_fetcher.setSelectedReportStepIndex(0)
            self.addObservationData(plot_data, key,
                                    block_observation_data_fetcher)

            ensemble_block_data_fetcher = EnsembleBlockDataFetcher(self.ert())
            ensemble_block_data_fetcher.setSelectedReportStepIndex(0)
            self.addEnsembleData(plot_data, key, cases,
                                 ensemble_block_data_fetcher)

            self.addPcaData(plot_data, key, cases)

        return plot_data
예제 #7
0
    def fetchPcaData(self, key, cases):
        """ @rtype: PlotData """
        if key.startswith("PCA:"):
            pca_name = key
        else:
            pca_name = "PCA:%s" % key

        pca_data_fetcher = PcaDataFetcher(self.ert())
        pca_plot_data = PlotData(pca_name)

        if DataTypeKeysModel().isCustomPcaKey(key):
            obs_keys = DataTypeKeysModel().getCustomPcaKeyObsKeys(key)
        else:
            obs_keys = pca_data_fetcher.getObsKeys(key)

        for case in cases:

            pca_data = pca_data_fetcher.fetchData(obs_keys, case)

            if pca_data["x"] is not None:

                if not pca_plot_data.hasObservationData():
                    pca_observation_plot_data = ObservationPlotData(pca_name)
                    pca_observation_plot_data.setObservationData(
                        pca_data["x"], pca_data["obs_y"],
                        [0.0 for x in pca_data["x"]], False)
                    pca_observation_plot_data.updateBoundaries(
                        pca_data["min_x"], pca_data["max_x"],
                        pca_data["min_y"], pca_data["max_y"])
                    pca_plot_data.setObservationData(pca_observation_plot_data)

                pca_ensemble_plot_data = EnsemblePlotData(key, case)
                pca_ensemble_plot_data.setEnsembleData(pca_data["x"],
                                                       pca_data["y"], [], [])
                pca_ensemble_plot_data.updateBoundaries(
                    pca_data["min_x"], pca_data["max_x"], pca_data["min_y"],
                    pca_data["max_y"])
                pca_plot_data.addEnsembleData(pca_ensemble_plot_data)

        return pca_plot_data
예제 #8
0
 def addPcaData(self, plot_data, key, cases):
     if plot_data.hasObservationData() and plot_data.hasEnsembleData():
         plot_data.setUserData("PCA", self.fetchPcaData(key, cases))
     else:
         plot_data.setUserData(
             "PCA", PlotData("No ensemble data available for %s" % key))