Skip to content

Commit

Permalink
feat(disv1d): rename DISL to DISV1D (#2133)
Browse files Browse the repository at this point in the history
* feat(disv1d): rename DISL to DISV1D
* ruff

Merging this in even though a few of the mf6 tests are failing.  Those tests will fail until this gets in.
  • Loading branch information
langevin-usgs authored Apr 2, 2024
1 parent 3028863 commit 4c44cb0
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 23 deletions.
6 changes: 4 additions & 2 deletions flopy/mf6/coordinates/modeldimensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,9 +401,11 @@ def _create_model_grid(self, grid_type):
self._model_grid = UnstructuredModelGrid(
self.model_name, self.simulation_data
)
elif grid_type == DiscretizationType.DISL:
elif grid_type == DiscretizationType.DISV1D:
self._model_grid = ModelGrid(
self.model_name, self.simulation_data, DiscretizationType.DISL
self.model_name,
self.simulation_data,
DiscretizationType.DISV1D,
)
elif grid_type == DiscretizationType.DIS2D:
self._model_grid = ModelGrid(
Expand Down
30 changes: 15 additions & 15 deletions flopy/mf6/coordinates/modelgrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,11 +452,11 @@ def get_grid_type(simulation_data, model_name):
return DiscretizationType.DISU
elif (
package_recarray.search_data(
f"disl{structure.get_version_string()}", 0
f"disv1d{structure.get_version_string()}", 0
)
is not None
):
return DiscretizationType.DISL
return DiscretizationType.DISV1D
elif (
package_recarray.search_data(
f"dis2d{structure.get_version_string()}", 0
Expand All @@ -475,9 +475,9 @@ def get_idomain(self):
return self._simulation_data.mfdata[
(self._model_name, "disv", "griddata", "idomain")
].get_data()
elif self._grid_type == DiscretizationType.DISL:
elif self._grid_type == DiscretizationType.DISV1D:
return self._simulation_data.mfdata[
(self._model_name, "disl", "griddata", "idomain")
(self._model_name, "disv1d", "griddata", "idomain")
].get_data()
elif self._grid_type == DiscretizationType.DISU:
return self._simulation_data.mfdata[
Expand Down Expand Up @@ -526,11 +526,11 @@ def get_horizontal_cross_section_dim_arrays(self):
return [np.arange(1, self.num_cells_per_layer() + 1, 1, np.int32)]
elif (
self.grid_type() == DiscretizationType.DISU
or self.grid_type() == DiscretizationType.DISL
or self.grid_type() == DiscretizationType.DISV1D
):
except_str = (
"ERROR: Can not get horizontal plane arrays for "
'model "{}" grid. DISU and DISL grids do not '
'model "{}" grid. DISU and DISV1D grids do not '
"support individual layers.".format(self._model_name)
)
print(except_str)
Expand All @@ -545,7 +545,7 @@ def get_model_dim(self):
return [self.num_layers(), self.num_cells_per_layer()]
elif (
self.grid_type() == DiscretizationType.DISU
or self.grid_type() == DiscretizationType.DISL
or self.grid_type() == DiscretizationType.DISV1D
):
return [self.num_cells()]

Expand All @@ -568,7 +568,7 @@ def get_model_dim_arrays(self):
]
elif (
self.grid_type() == DiscretizationType.DISU
or self.grid_type() == DiscretizationType.DISL
or self.grid_type() == DiscretizationType.DISV1D
):
return [np.arange(1, self.num_cells() + 1, 1, np.int32)]

Expand All @@ -588,7 +588,7 @@ def get_horizontal_cross_section_dim_names(self):
return ["layer_cell_num"]
elif (
self.grid_type() == DiscretizationType.DISU
or self.grid_type() == DiscretizationType.DISL
or self.grid_type() == DiscretizationType.DISV1D
):
except_str = (
"ERROR: Can not get layer dimension name for model "
Expand All @@ -607,7 +607,7 @@ def get_model_dim_names(self):
return ["layer", "layer_cell_num"]
elif (
self.grid_type() == DiscretizationType.DISU
or self.grid_type() == DiscretizationType.DISL
or self.grid_type() == DiscretizationType.DISV1D
):
return ["node"]

Expand All @@ -621,7 +621,7 @@ def get_num_spatial_coordinates(self):
return 2
elif grid_type == DiscretizationType.DISU:
return 1
elif grid_type == DiscretizationType.DISL:
elif grid_type == DiscretizationType.DISV1D:
return 1
return 0

Expand Down Expand Up @@ -696,7 +696,7 @@ def num_layers(self):
].get_data()
elif (
self.grid_type() == DiscretizationType.DISU
or self.grid_type() == DiscretizationType.DISL
or self.grid_type() == DiscretizationType.DISV1D
or self.grid_type() == DiscretizationType.DIS2D
):
return None
Expand All @@ -712,9 +712,9 @@ def num_cells(self):
return self._simulation_data.mfdata[
(self._model_name, "disu", "dimensions", "nodes")
].get_data()
elif self.grid_type() == DiscretizationType.DISL:
elif self.grid_type() == DiscretizationType.DISV1D:
return self._simulation_data.mfdata[
(self._model_name, "disl", "dimensions", "nodes")
(self._model_name, "disv1d", "dimensions", "nodes")
].get_data()

def get_all_model_cells(self):
Expand All @@ -737,7 +737,7 @@ def get_all_model_cells(self):
return model_cells
elif (
self.grid_type() == DiscretizationType.DISU
or self.grid_type() == DiscretizationType.DISL
or self.grid_type() == DiscretizationType.DISV1D
):
for node in range(0, self.num_cells()):
model_cells.append(node + 1)
Expand Down
1 change: 0 additions & 1 deletion flopy/mf6/data/mfstructure.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ def get_file_list(self):
"gwf-dis", # dfn completed tex updated
"gwf-disv", # dfn completed tex updated
"gwf-disu", # dfn completed tex updated
"lnf-disl", # dfn completed tex updated
"gwf-ic", # dfn completed tex updated
"gwf-npf", # dfn completed tex updated
"gwf-sto", # dfn completed tex updated
Expand Down
8 changes: 4 additions & 4 deletions flopy/mf6/mfmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,8 +493,8 @@ def modelgrid(self):
iac=dis.iac.array,
ja=dis.ja.array,
)
elif self.get_grid_type() == DiscretizationType.DISL:
dis = self.get_package("disl")
elif self.get_grid_type() == DiscretizationType.DISV1D:
dis = self.get_package("disv1d")
if not hasattr(dis, "_init_complete"):
if not hasattr(dis, "cell1d"):
# disv package has not yet been initialized
Expand Down Expand Up @@ -1209,11 +1209,11 @@ def get_grid_type(self):
return DiscretizationType.DISU
elif (
package_recarray.search_data(
f"disl{structure.get_version_string()}", 0
f"disv1d{structure.get_version_string()}", 0
)
is not None
):
return DiscretizationType.DISL
return DiscretizationType.DISV1D

return DiscretizationType.UNDEFINED

Expand Down
2 changes: 1 addition & 1 deletion flopy/mf6/utils/mfenums.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ class DiscretizationType(Enum):
DIS = 1
DISV = 2
DISU = 3
DISL = 4
DISV1D = 4
DIS2D = 5

0 comments on commit 4c44cb0

Please sign in to comment.