Skip to content

Commit

Permalink
Expose properties that were first public variables
Browse files Browse the repository at this point in the history
  • Loading branch information
deltamarnix committed Oct 3, 2024
1 parent 3f884fd commit df70b51
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 25 deletions.
9 changes: 0 additions & 9 deletions flopy/mf6/mfbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,15 +461,6 @@ def __init__(self, simulation_data):
self.package_name_dict = {}
self.package_filename_dict = {}

@property
def package_key_dict(self):
warnings.warn(
"package_key_dict has been deprecated, use "
"package_type_dict instead",
category=DeprecationWarning,
)
return self.package_type_dict

@staticmethod
def package_list():
"""Static method that returns the list of available packages.
Expand Down
19 changes: 18 additions & 1 deletion flopy/mf6/mfmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,12 @@ def _get_data_str(self, formal):

@property
def package_key_dict(self):
return self._package_container.package_key_dict
warnings.warn(
"package_key_dict has been deprecated, use "
"package_type_dict instead",
category=DeprecationWarning,
)
return self._package_container.package_type_dict

@property
def package_dict(self):
Expand All @@ -252,6 +257,18 @@ def package_names(self):
"""Returns a list of package names."""
return self._package_container.package_names

@property
def package_type_dict(self):
return self._package_container.package_type_dict

@property
def package_name_dict(self):
return self._package_container.package_name_dict

@property
def package_filename_dict(self):
return self._package_container.package_filename_dict

@property
def nper(self):
"""Number of stress periods.
Expand Down
19 changes: 18 additions & 1 deletion flopy/mf6/mfpackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -1993,7 +1993,12 @@ def data_list(self):

@property
def package_key_dict(self):
return self._package_container.package_key_dict
warnings.warn(
"package_key_dict has been deprecated, use "
"package_type_dict instead",
category=DeprecationWarning,
)
return self._package_container.package_type_dict

@property
def package_names(self):
Expand All @@ -2004,6 +2009,18 @@ def package_names(self):
def package_dict(self):
return self._package_container.package_dict

@property
def package_type_dict(self):
return self._package_container.package_type_dict

@property
def package_name_dict(self):
return self._package_container.package_name_dict

@property
def package_filename_dict(self):
return self._package_container.package_filename_dict

def get_package(self, name=None, type_only=False, name_only=False):
"""
Finds a package by package name, package key, package type, or partial
Expand Down
42 changes: 28 additions & 14 deletions flopy/mf6/mfsimbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os.path
import sys
from pathlib import Path
from typing import List, Optional, Union, cast
from typing import List, Optional, Type, Union, cast

import numpy as np

Expand Down Expand Up @@ -692,7 +692,12 @@ def exchange_files(self):

@property
def package_key_dict(self):
return self._package_container.package_key_dict
warnings.warn(
"package_key_dict has been deprecated, use "
"package_type_dict instead",
category=DeprecationWarning,
)
return self._package_container.package_type_dict

@property
def package_dict(self):
Expand All @@ -704,9 +709,21 @@ def package_names(self):
"""Returns a list of package names."""
return self._package_container.package_names

@property
def package_type_dict(self):
return self._package_container.package_type_dict

@property
def package_name_dict(self):
return self._package_container.package_name_dict

@property
def package_filename_dict(self):
return self._package_container.package_filename_dict

@staticmethod
def load(
cls_child,
cls_child: Type["MFSimulationBase"],
sim_name="modflowsim",
version="mf6",
exe_name: Union[str, os.PathLike] = "mf6",
Expand Down Expand Up @@ -774,17 +791,14 @@ def load(
"""
# initialize
instance = cast(
MFSimulationBase,
cls_child(
sim_name,
version,
exe_name,
sim_ws,
verbosity_level,
write_headers=write_headers,
use_pandas=use_pandas,
),
instance = cls_child(
sim_name,
version,
exe_name,
sim_ws,
verbosity_level,
write_headers=write_headers,
use_pandas=use_pandas,
)
verbosity_level = instance.simulation_data.verbosity_level

Expand Down

0 comments on commit df70b51

Please sign in to comment.