Skip to content

Commit

Permalink
Change OrderedDict to dict
Browse files Browse the repository at this point in the history
  • Loading branch information
ErichSuter committed Mar 11, 2024
1 parent 073e289 commit 02f2e7f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 13 deletions.
3 changes: 1 addition & 2 deletions src/grid3d_maps/avghc/_compute_avg.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import getpass
from collections import OrderedDict
from time import localtime, strftime

import numpy as np
Expand All @@ -22,7 +21,7 @@ def get_avg(config, specd, propd, dates, zonation, zoned, filterarray):
"""
logger.info("Dates is unused %s", dates)

avgd = OrderedDict()
avgd = {}

myavgzon = config["computesettings"]["tuning"]["zone_avg"]
mycoarsen = config["computesettings"]["tuning"]["coarsen"]
Expand Down
5 changes: 2 additions & 3 deletions src/grid3d_maps/avghc/_get_zonation_filters.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from collections import OrderedDict

import numpy as np
import xtgeo
Expand Down Expand Up @@ -31,8 +30,8 @@ def zonation(config, grd):
raise ValueError('Cannot have both "zproperty" and "zranges" in ' '"zonation"')

usezonation = np.zeros(grd.dimensions, dtype=np.int32)
zoned = OrderedDict()
superzoned = OrderedDict()
zoned = {}
superzoned = {}

eclroot = None
if "eclroot" in config["input"] and config["input"]["eclroot"] is not None:
Expand Down
3 changes: 1 addition & 2 deletions src/grid3d_maps/avghc/_hc_plotmap.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Private module for HC thickness functions."""

import getpass
from collections import OrderedDict
from time import localtime, strftime

import numpy as np
Expand All @@ -20,7 +19,7 @@
def do_hc_mapping(config, initd, hcpfzd, zonation, zoned, hcmode):
"""Do the actual map gridding, for zones and groups of zones"""

mapzd = OrderedDict()
mapzd = {}

if "templatefile" in config["mapsettings"]:
basemap = xtgeo.surface_from_file(config["mapsettings"]["templatefile"])
Expand Down
7 changes: 1 addition & 6 deletions src/grid3d_maps/avghc/_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import io
import os.path
from collections import OrderedDict

import yaml
from xtgeo.common import XTGeoDialog, null_logger
Expand All @@ -24,8 +23,7 @@ class FMUYamlSafeLoader(yaml.SafeLoader):

# pylint: disable=too-many-ancestors

def __init__(self, stream, ordered=False):
self._ordered = ordered # for OrderedDict
def __init__(self, stream):
self._root = os.path.split(stream.name)[0]
super().__init__(stream)

Expand Down Expand Up @@ -115,7 +113,6 @@ def extract_file(self, filename):
return yaml.safe_load(yfile)

# from https://gist.github.com/pypt/94d747fe5180851196eb
# but changed mapping to OrderedDict
def construct_mapping(self, node, deep=False):
if not isinstance(node, MappingNode):
raise ConstructorError(
Expand All @@ -126,8 +123,6 @@ def construct_mapping(self, node, deep=False):
)

mapping = {}
if self._ordered:
mapping = OrderedDict()

for key_node, value_node in node.value:
key = self.construct_object(key_node, deep=deep)
Expand Down

0 comments on commit 02f2e7f

Please sign in to comment.