fmu.sumo.explorer.timefilter module

Module with classes handling time filtering

class fmu.sumo.explorer.timefilter.TimeType(*values)[source]

Bases: Enum

An Enum representing diffent time types in Sumo

Used when creating a TimeFilter object.

class fmu.sumo.explorer.timefilter.TimeFilter(time_type, start=None, end=None, overlap=False, exact=False)[source]

Bases: object

Class representing a time filter

A TimeFilter object can be used when doing time filtering on case objects.

Initialize TimeFilter

Parameters:
  • time_type (TimeType) – time type (TIMESTAMP, INTERVAL, ALL, NONE)

  • start (str) – start of range

  • end (str) – end of range

  • overlap (bool) – include overlapping intervals

  • exact (bool) – include only exact matches

Examples

Get surfaces with timestamps:

time = TimeFilter(time_type=TimeType.TIMESTAMP)

case.surfaces.filter(time=time)

Get surfaces whith timestamp in range:

time = TimeFilter(
    time_type=TimeType.TIMESTAMP,
    start="2018-01-01",
    end="2022-01-01"
)

case.surfaces.filter(time=time)

Get surfaces with intervals:

time = TimeFilter(time_type=TimeType.INTERVAL)

case.surfaces.filter(time=time)

Get surfaces with intervals in range:

time = TimeFilter(
    time_type=TimeType.INTERVAL,
    start="2018-01-01",
    end="2022-01-01"
)

case.surfaces.filter(time=time)

Get surfaces where intervals overlap:

time = TimeFIlter(
    time_type=TimeType.INTERVAL,
    start="2018-01-01",
    end="2022-01-01",
    overlap=True
)

case.surfaces.filter(time=time)

Get surfaces with exact interval match:

time = TimeFilter(
    time_type=TimeType.INTERVAL,
    start="2018-01-01",
    end="2022-01-01",
    exact=True
)

case.surfaces.filter(time=time)