From aa12f3943251c659323b38c83d20444db5abab9b Mon Sep 17 00:00:00 2001 From: mferrera Date: Thu, 23 Nov 2023 09:27:08 +0100 Subject: [PATCH] WIP roff --- src/xtgeo/grid3d/_roff_parameter.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/xtgeo/grid3d/_roff_parameter.py b/src/xtgeo/grid3d/_roff_parameter.py index f65c771e1..489a8db25 100644 --- a/src/xtgeo/grid3d/_roff_parameter.py +++ b/src/xtgeo/grid3d/_roff_parameter.py @@ -1,8 +1,9 @@ from __future__ import annotations import warnings -from collections import OrderedDict, defaultdict +from collections import defaultdict from dataclasses import dataclass +from typing import Any import numpy as np import roffio @@ -44,7 +45,7 @@ class RoffParameter: code_names: list[str] | None = None code_values: np.ndarray | None = None - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: if not isinstance(other, RoffParameter): return False return ( @@ -56,7 +57,7 @@ def __eq__(self, other): and self.same_codes(other) ) - def same_codes(self, other): + def same_codes(self, other: RoffParameter) -> bool: """ Args: other (RoffParameter): Any roff parameter @@ -78,7 +79,7 @@ def same_codes(self, other): ) @property - def undefined_value(self): + def undefined_value(self) -> int | float: """ Returns: The undefined value for the type of values in the @@ -179,7 +180,7 @@ def to_file(self, filelike, roff_format=roffio.Format.BINARY): filelike (str or byte stream): The file to write to. roff_format (roffio.Format): The format to write the file in. """ - data = OrderedDict( + data = dict( { "filedata": {"filetype": "parameter"}, "dimensions": {"nX": self.nx, "nY": self.ny, "nZ": self.nz},