fmu.tools.fipmapper package

Submodules

fmu.tools.fipmapper.fipmapper module

The FipMapper class, mapping region/zones in RMS to FIPxxx in Eclipse.

class fmu.tools.fipmapper.fipmapper.FipMapper(*, yamlfile=None, mapdata=None, skipstring=None)[source]

Bases: object

get_regions()[source]

Obtain a sorted list of the regions that exist in the map

Return type:

List[str]

get_zones()[source]

Obtain a sorted list of the zones that exist in the map

Return type:

List[str]

get_fipnums()[source]

Obtain a sorted list of the fip numbers that exist in the map

Return type:

List[str]

fip2region(fip)[source]

Maps one FIP(NUM) integer to list of Region strings. Each FIPNUM can map to multiple regions, therefore a list is always returned for each FIPNUM.

Parameters:

array – List/array of FIPNUMS, or integer.

Return type:

List[str]

Returns:

List of strings or list of lists of strings, depending on input. Region names that are “integers” will be returned as strings. Empty list if no region is known for a specific FIPNUM.

region2fip(region)[source]

Maps a Region string/int to FIPNUM(s).

Parameters:

region (Union[int, str]) – Region

Return type:

List[int]

Returns:

FIPNUM values. None if the region is unknown, many if many FIPNUMs are present in the region.

zone2fip(zone)[source]

Maps a zone to FIPNUMs

Return type:

List[int]

fip2zone(fip)[source]

Maps a FIPNUM integer to an list of Zone strings

Parameters:

array (list) – List/array of FIPNUMS, or integer.

Returns:

Region strings. Always returned as list, and always as strings, even if zone “names” are integers. Empty list if no zone is assigned to the FIPNUM.

Return type:

list

regzone2fip(region, zone)[source]
Return type:

List[int]

disjoint_sets()[source]

Determine the minimal disjoint sets of a reservoir

The disjoint sets returned consist of sets that can be split into both a set of FIPxxxx list and a region/zone list. Thus, the sum of any additive property is comparable on these disjoint sets.

The returned object is a dataframe that is to be used to group together fipnums or regions/zones so they are summable.

Note that the REGION and ZONE columns always contain strings only, while FIPNUM is always an integer.

Each row represents a cell in the partition where both region, zone and fipnum boundaries apply, this the finest possible partition the fipmapper data allows. Each row is then assigned to a integer identifier in the SET column. The chosen integers values for each set is based on lexiographical sorting of regions, zones and fipnum values.

These sets signifies the minimal grouping of data that must be applied in order for volumes in the region/zone partition or fipnum partition to be comparable.

Return type:

DataFrame

fmu.tools.fipmapper.fipmapper.regions_in_set(dframe)[source]

From the dataframe returned by disjoint_sets(), compute a dictionary to map from a set index to a list of regions that are members of that set index

Parameters:

dframe (DataFrame) – The dataframe emitted by disjoint_sets()

Return type:

Dict[int, List[str]]

fmu.tools.fipmapper.fipmapper.zones_in_set(dframe)[source]

From the dataframe returned by disjoint_sets(), compute a dictionary to map from a set index to a list of zones that are members of that set index

Parameters:

dframe (DataFrame) – The dataframe emitted by disjoint_sets()

Return type:

Dict[int, List[str]]

fmu.tools.fipmapper.fipmapper.fipnums_in_set(dframe)[source]

From the dataframe returned by disjoint_sets(), compute a dictionary to map from a set index to a list of FIPNUM values that are members of that set index

Parameters:

dframe (DataFrame) – The dataframe emitted by disjoint_sets()

Return type:

Dict[int, List[int]]

fmu.tools.fipmapper.fipmapper.regzonefips_in_set(dframe)[source]

From the dataframe returned by disjoint_sets(), compute a dictionary to map from a set index to a list of tuples of the region, zones and fipnums in the set.

Parameters:

dframe (DataFrame) – The dataframe emitted by disjoint_sets()

Return type:

Dict[int, List[Tuple[str, str, int]]]

fmu.tools.fipmapper.fipmapper.webviz_to_prtvol2csv(webvizdict)[source]

Convert a dict representation of a region/zone map in the Webviz format to the prtvol2csv format

fmu.tools.fipmapper.fipmapper.invert_map(dictmap, skipstring=None)[source]

Invert a dictionary, supporting many-to-many maps.

Parameters:
  • dictmap (Dict[str, Any]) –

  • skipstring (Union[list, str, None]) – List of strings which will be ignored (e.g. “Totals”).

Return type:

Dict[str, List[Any]]

Module contents