ci(revert): undo last commit (#1066)
Undo last commit, which seems to have broken mf6 transport supportdevelop
parent
cb04f9d2ac
commit
aca1446da0
|
@ -37,8 +37,7 @@ from flopy.mf6.mfbase import MFDataException
|
|||
|
||||
try:
|
||||
import shapefile
|
||||
|
||||
if int(shapefile.__version__.split(".")[0]) < 2:
|
||||
if int(shapefile.__version__.split('.')[0]) < 2:
|
||||
shapefile = None
|
||||
except ImportError:
|
||||
shapefile = None
|
||||
|
@ -1135,28 +1134,6 @@ def test005_advgw_tidal():
|
|||
timeseries=ts_dict,
|
||||
)
|
||||
|
||||
# test nseg = 1
|
||||
evt_period = ModflowGwfevt.stress_period_data.empty(model, 150, nseg=1)
|
||||
for col in range(0, 10):
|
||||
for row in range(0, 15):
|
||||
evt_period[0][col * 15 + row] = (
|
||||
(0, row, col),
|
||||
50.0,
|
||||
0.0004,
|
||||
10.0,
|
||||
None,
|
||||
)
|
||||
evt_package_test = ModflowGwfevt(
|
||||
model,
|
||||
print_input=True,
|
||||
print_flows=True,
|
||||
save_flows=True,
|
||||
maxbound=150,
|
||||
nseg=1,
|
||||
stress_period_data=evt_period,
|
||||
)
|
||||
evt_package_test.remove()
|
||||
|
||||
# test empty
|
||||
evt_period = ModflowGwfevt.stress_period_data.empty(model, 150, nseg=3)
|
||||
for col in range(0, 10):
|
||||
|
@ -1287,15 +1264,7 @@ def test005_advgw_tidal():
|
|||
("rv2-upper", "RIV", "riv2_upper"),
|
||||
("rv-2-7-4", "RIV", (0, 6, 3)),
|
||||
("rv2-8-5", "RIV", (0, 6, 4)),
|
||||
(
|
||||
"rv-2-9-6",
|
||||
"RIV",
|
||||
(
|
||||
0,
|
||||
5,
|
||||
5,
|
||||
),
|
||||
),
|
||||
("rv-2-9-6", "RIV", (0, 5, 5,)),
|
||||
],
|
||||
"riv_flowsA.csv": [
|
||||
("riv1-3-1", "RIV", (0, 2, 0)),
|
||||
|
|
|
@ -4,7 +4,6 @@ modeldimensions module. Contains the model dimension information
|
|||
|
||||
"""
|
||||
|
||||
import sys
|
||||
from .simulationtime import SimulationTime
|
||||
from .modelgrid import UnstructuredModelGrid, ModelGrid
|
||||
from ..mfbase import StructException, FlopyException, VerbosityLevel
|
||||
|
@ -82,7 +81,6 @@ class DataDimensions(object):
|
|||
data=None,
|
||||
data_item_num=None,
|
||||
repeating_key=None,
|
||||
min_size=False,
|
||||
):
|
||||
return self.get_model_dim(data_item_num).get_data_shape(
|
||||
self.structure,
|
||||
|
@ -91,7 +89,6 @@ class DataDimensions(object):
|
|||
data,
|
||||
self.package_dim.package_path,
|
||||
repeating_key=repeating_key,
|
||||
min_size=min_size,
|
||||
)
|
||||
|
||||
def model_subspace_size(self, subspace_string="", data_item_num=None):
|
||||
|
@ -406,7 +403,6 @@ class ModelDimensions(object):
|
|||
path=None,
|
||||
deconstruct_axis=True,
|
||||
repeating_key=None,
|
||||
min_size=False,
|
||||
):
|
||||
if structure is None:
|
||||
raise FlopyException(
|
||||
|
@ -496,7 +492,6 @@ class ModelDimensions(object):
|
|||
path,
|
||||
deconstruct_axis,
|
||||
repeating_key=repeating_key,
|
||||
min_size=min_size,
|
||||
)
|
||||
if self.locked and consistent_shape:
|
||||
self.stored_shapes[data_item.path] = (
|
||||
|
@ -514,7 +509,6 @@ class ModelDimensions(object):
|
|||
path=None,
|
||||
deconstruct_axis=True,
|
||||
repeating_key=None,
|
||||
min_size=False,
|
||||
):
|
||||
if isinstance(data, tuple):
|
||||
data = [data]
|
||||
|
@ -566,7 +560,7 @@ class ModelDimensions(object):
|
|||
result = self.resolve_exp(
|
||||
item,
|
||||
self._find_in_dataset(
|
||||
data_set_struct, item[0], data, min_size
|
||||
data_set_struct, item[0], data
|
||||
),
|
||||
)
|
||||
if result:
|
||||
|
@ -590,8 +584,7 @@ class ModelDimensions(object):
|
|||
elif DatumUtil.is_int(item[0]):
|
||||
shape_dimensions.append(int(item[0]))
|
||||
else:
|
||||
# try to resolve dimension within the
|
||||
# existing block
|
||||
# try to resolve dimension within the existing block
|
||||
result = self.simulation_data.mfdata.find_in_path(
|
||||
parent_path, item[0]
|
||||
)
|
||||
|
@ -691,7 +684,7 @@ class ModelDimensions(object):
|
|||
return value
|
||||
|
||||
@staticmethod
|
||||
def _find_in_dataset(data_set_struct, item, data, min_size=False):
|
||||
def _find_in_dataset(data_set_struct, item, data):
|
||||
if data is not None:
|
||||
# find the current data item in data_set_struct
|
||||
for index, data_item in zip(
|
||||
|
@ -702,22 +695,12 @@ class ModelDimensions(object):
|
|||
data_item.name.lower() == item.lower()
|
||||
and len(data[0]) > index
|
||||
):
|
||||
if min_size:
|
||||
# use the minimum value
|
||||
min_val = sys.maxsize
|
||||
for data_line in data:
|
||||
if data_line[index] < min_val:
|
||||
min_val = data_line[index]
|
||||
if min_val == sys.maxsize:
|
||||
return 0
|
||||
return min_val
|
||||
else:
|
||||
# use the maximum value
|
||||
max_val = 0
|
||||
for data_line in data:
|
||||
if data_line[index] > max_val:
|
||||
max_val = data_line[index]
|
||||
return max_val
|
||||
# always use the maximum value
|
||||
max_val = 0
|
||||
for data_line in data:
|
||||
if data_line[index] > max_val:
|
||||
max_val = data_line[index]
|
||||
return max_val
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
|
|
|
@ -356,31 +356,6 @@ class MFList(mfdata.MFMultiDimVar, DataListInterface):
|
|||
def get_data(self, apply_mult=False, **kwargs):
|
||||
return self._get_data(apply_mult, **kwargs)
|
||||
|
||||
def _get_min_record_entries(self, data=None):
|
||||
try:
|
||||
if isinstance(data, dict) and "data" in data:
|
||||
data = data["data"]
|
||||
type_list = self._get_storage_obj().build_type_list(
|
||||
data=data, min_size=True
|
||||
)
|
||||
except Exception as ex:
|
||||
type_, value_, traceback_ = sys.exc_info()
|
||||
raise MFDataException(
|
||||
self.structure.get_model(),
|
||||
self.structure.get_package(),
|
||||
self._path,
|
||||
"getting min record entries",
|
||||
self.structure.name,
|
||||
inspect.stack()[0][3],
|
||||
type_,
|
||||
value_,
|
||||
traceback_,
|
||||
None,
|
||||
self._simulation_data.debug,
|
||||
ex,
|
||||
)
|
||||
return len(type_list)
|
||||
|
||||
def _set_data(self, data, autofill=False, check_data=True):
|
||||
if isinstance(data, dict):
|
||||
if "data" in data:
|
||||
|
@ -391,7 +366,7 @@ class MFList(mfdata.MFMultiDimVar, DataListInterface):
|
|||
data_check = data
|
||||
if iterable(data_check) and check_data:
|
||||
# verify data length
|
||||
min_line_size = self._get_min_record_entries(data)
|
||||
min_line_size = self.structure.get_min_record_entries()
|
||||
if isinstance(data_check[0], np.record) or (
|
||||
iterable(data_check[0]) and not isinstance(data_check[0], str)
|
||||
):
|
||||
|
@ -506,6 +481,7 @@ class MFList(mfdata.MFMultiDimVar, DataListInterface):
|
|||
|
||||
def _check_line_size(self, data_line, min_line_size):
|
||||
if 0 < len(data_line) < min_line_size:
|
||||
min_line_size = self.structure.get_min_record_entries()
|
||||
message = (
|
||||
"Data line {} only has {} entries, "
|
||||
"minimum number of entries is "
|
||||
|
|
|
@ -2388,7 +2388,6 @@ class DataStorage(object):
|
|||
key=None,
|
||||
nseg=None,
|
||||
cellid_expanded=False,
|
||||
min_size=False,
|
||||
):
|
||||
if data_set is None:
|
||||
self.jagged_record = False
|
||||
|
@ -2439,27 +2438,17 @@ class DataStorage(object):
|
|||
ks_data_item.type = DatumType.string
|
||||
ks_data_item.name = "{}_data".format(ks_data_item.name)
|
||||
ks_rec_type = ks_data_item.get_rec_type()
|
||||
if not min_size:
|
||||
self._append_type_lists(
|
||||
ks_data_item.name,
|
||||
ks_rec_type,
|
||||
ks_data_item.is_cellid,
|
||||
)
|
||||
self._append_type_lists(
|
||||
ks_data_item.name, ks_rec_type, ks_data_item.is_cellid
|
||||
)
|
||||
if (
|
||||
index == len(data_set.data_item_structures) - 1
|
||||
and data is not None
|
||||
):
|
||||
idx = 1
|
||||
(
|
||||
line_max_size,
|
||||
line_min_size,
|
||||
) = self._get_max_min_data_line_size(data)
|
||||
if min_size:
|
||||
line_size = line_min_size
|
||||
else:
|
||||
line_size = line_max_size
|
||||
line_max_size = self._get_max_data_line_size(data)
|
||||
type_list = self.resolve_typelist(data)
|
||||
while len(type_list) < line_size:
|
||||
while len(type_list) < line_max_size:
|
||||
# keystrings at the end of a line can contain
|
||||
# items of variable length. assume everything at
|
||||
# the end of the data line is related to the last
|
||||
|
@ -2526,7 +2515,6 @@ class DataStorage(object):
|
|||
data_set,
|
||||
data,
|
||||
repeating_key=key,
|
||||
min_size=min_size,
|
||||
)
|
||||
else:
|
||||
resolved_shape = [1]
|
||||
|
@ -2567,17 +2555,14 @@ class DataStorage(object):
|
|||
grid = data_dim.get_model_grid()
|
||||
size = grid.get_num_spatial_coordinates()
|
||||
data_item.remove_cellid(resolved_shape, size)
|
||||
if not data_item.optional or not min_size:
|
||||
for index in range(0, resolved_shape[0]):
|
||||
if resolved_shape[0] > 1:
|
||||
name = "{}_{}".format(
|
||||
data_item.name, index
|
||||
)
|
||||
else:
|
||||
name = data_item.name
|
||||
self._append_type_lists(
|
||||
name, data_type, data_item.is_cellid
|
||||
)
|
||||
for index in range(0, resolved_shape[0]):
|
||||
if resolved_shape[0] > 1:
|
||||
name = "{}_{}".format(data_item.name, index)
|
||||
else:
|
||||
name = data_item.name
|
||||
self._append_type_lists(
|
||||
name, data_type, data_item.is_cellid
|
||||
)
|
||||
if cellid_expanded:
|
||||
return self._recarray_type_list_ex
|
||||
else:
|
||||
|
@ -2640,18 +2625,13 @@ class DataStorage(object):
|
|||
return current_length[0]
|
||||
|
||||
@staticmethod
|
||||
def _get_max_min_data_line_size(data):
|
||||
def _get_max_data_line_size(data):
|
||||
max_size = 0
|
||||
min_size = sys.maxsize
|
||||
if data is not None:
|
||||
for value in data:
|
||||
if len(value) > max_size:
|
||||
max_size = len(value)
|
||||
if len(value) < min_size:
|
||||
min_size = len(value)
|
||||
if min_size == sys.maxsize:
|
||||
min_size = 0
|
||||
return max_size, min_size
|
||||
return max_size
|
||||
|
||||
def get_data_dimensions(self, layer):
|
||||
data_dimensions = self.data_dimensions.get_data_shape()[0]
|
||||
|
|
|
@ -173,9 +173,7 @@ class PyListUtil(object):
|
|||
def max_multi_dim_list_size(current_list):
|
||||
max_length = -1
|
||||
for item in current_list:
|
||||
if isinstance(item, str):
|
||||
return len(current_list)
|
||||
elif len(item) > max_length:
|
||||
if len(item) > max_length:
|
||||
max_length = len(item)
|
||||
return max_length
|
||||
|
||||
|
|
Loading…
Reference in New Issue