How to use the ecl.util.util.CTime function in ecl

To help you get started, we’ve selected a few ecl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OPM / ResInsight / ThirdParty / Ert / python / ecl / summary / ecl_sum.py View on Github external
trange = TimeVector.createRegular(range_start, range_end, interval)

        # If the simulation does not start at the first of the month
        # the start value will be before the simulation start; we
        # manually shift the first element in the trange to the start
        # value; the same for the end of list.

        if trange[-1] < end:
            if extend_end:
                trange.appendTime(num, timeUnit)
            else:
                trange.append(end)

        data_start = self.getDataStartTime()
        if trange[0] < data_start:
            trange[0] = CTime(data_start)

        return trange
github equinor / libecl / python / ecl / summary / ecl_sum.py View on Github external
def check_sim_time(self, date):
        """
        Will check if the input date is in the time span [sim_start, sim_end].
        """
        if not isinstance(date, CTime):
            date = CTime(date)
        return self._check_sim_time(date)
github OPM / ResInsight / ThirdParty / Ert / python / ecl / summary / ecl_sum.py View on Github external
def check_sim_time(self, date):
        """
        Will check if the input date is in the time span [sim_start, sim_end].
        """
        if not isinstance(date, CTime):
            date = CTime(date)
        return self._check_sim_time(date)
github equinor / libecl / python / ecl / util / util / time_vector.py View on Github external
def __init__(self, default_value=None, initial_size=0):
        if default_value is None:
            super(TimeVector, self).__init__(CTime(0), initial_size)
        else:
            try:
                default = CTime(default_value)
            except:
                raise ValueError("default value invalid - must be type ctime() or date/datetime")

            super(TimeVector, self).__init__(default, initial_size)
github OPM / ResInsight / ThirdParty / Ert / python / ecl / summary / ecl_sum.py View on Github external
def get_report(self, date=None, days=None):
        """
        Will return the report step corresponding to input @date or @days.

        If the input argument does not correspond to any report steps
        the function will return -1. Observe that the function
        requires strict equality.
        """
        if date:
            if days:
                raise ValueError("Must supply either days or date")
            step = self._get_report_step_from_time(CTime(date))
        elif days:
            step = self._get_report_step_from_days(days)

        return step
github equinor / libecl / python / ecl / eclfile / ecl_restart_file.py View on Github external
def get_sim_date(self):
        ct = CTime( self._get_sim_time( ) )
        return ct.datetime( )
github equinor / libecl / python / ecl / rft / ecl_rft.py View on Github external
def get_headers(self):
        """
        Returns a list of two tuples (well_name , date) for the whole file.
        """
        header_list = []
        for i in (range(self._get_size( None , CTime(-1)))):
            rft = self.iget( i )
            header_list.append( (rft.getWellName() , rft.getDate()) )
        return header_list
github equinor / libecl / python / ecl / summary / ecl_sum.py View on Github external
def writer(case,
               start_time,
               nx,ny,nz,
               fmt_output=False,
               unified=True,
               time_in_days=True,
               key_join_string=":"):
        """
        The writer is not generally usable.
        @rtype: EclSum
        """

        start = CTime(start_time)

        smry = EclSum._create_writer(case,
                                     fmt_output,
                                     unified,
                                     key_join_string,
                                     start,
                                     time_in_days,
                                     nx,
                                     ny,
                                     nz)
        smry._load_case = 'writer'
        return smry
github OPM / ResInsight / ThirdParty / Ert / python / ecl / summary / ecl_sum.py View on Github external
def end_date(self):
        """
        The date of the last (loaded) time step.
        """
        return CTime(self._get_end_date()).date()