From fb5230d55f635cb1e42e6ecdb05d8012829cfd11 Mon Sep 17 00:00:00 2001 From: mjreno Date: Wed, 24 Jul 2024 13:15:17 -0400 Subject: [PATCH 1/3] add modflow 6 input tests for ic, dis --- flopy4/array.py | 17 +-- flopy4/block.py | 5 +- spec/dfn/gwf-ic.dfn | 31 +++++ spec/dfn2toml.py | 41 +------ spec/dfns.txt | 1 + spec/toml/gwe-dis.toml | 48 ++++---- spec/toml/gwf-dis.toml | 48 ++++---- spec/toml/gwf-ic.toml | 58 +++++++++ spec/toml/gwt-dis.toml | 48 ++++---- spec/toml/prt-dis.toml | 48 ++++---- spec/toml/prt-prp.toml | 93 +++++++------- test/test_dfn.py | 2 +- test/test_package.py | 266 +++++++++++++++++++++++++++++++++++++++++ 13 files changed, 511 insertions(+), 195 deletions(-) create mode 100644 spec/dfn/gwf-ic.dfn create mode 100644 spec/toml/gwf-ic.toml diff --git a/flopy4/array.py b/flopy4/array.py index e6cb9f6..48513fd 100644 --- a/flopy4/array.py +++ b/flopy4/array.py @@ -205,6 +205,7 @@ def __init__( ): MFParam.__init__( self, + shape=shape, block=block, name=name, type=type, @@ -405,26 +406,14 @@ def read_array(f): Read a MODFLOW 6 array from an open file into a flat NumPy array representation. """ + import re astr = [] while True: pos = f.tell() line = f.readline() line = line_strip(line) - if line in ( - CommonNames.empty, - CommonNames.internal, - CommonNames.external, - CommonNames.constant, - ): - f.seek(pos, 0) - break - elif ( - CommonNames.internal in line - or CommonNames.external in line - or CommonNames.constant in line - or CommonNames.end in line.upper() - ): + if not re.match("^[0-9. ]+$", line): f.seek(pos, 0) break astr.append(line) diff --git a/flopy4/block.py b/flopy4/block.py index da4a9f6..12390e8 100644 --- a/flopy4/block.py +++ b/flopy4/block.py @@ -21,7 +21,10 @@ def get_param(members, key, block): param = ks[0] else: param = members.get(key) - param.name = key + if param is not None: + param.name = key + else: + raise ValueError(f"Invalid parameter: {key.upper()}") param.block = block return param diff --git a/spec/dfn/gwf-ic.dfn b/spec/dfn/gwf-ic.dfn new file mode 100644 index 0000000..f580987 --- /dev/null +++ b/spec/dfn/gwf-ic.dfn @@ -0,0 +1,31 @@ +# --------------------- gwf ic options --------------------- + +block options +name export_array_ascii +type keyword +reader urword +optional true +mf6internal export_ascii +longname export array variables to layered ascii files. +description keyword that specifies input griddata arrays should be written to layered ascii output files. + +block options +name export_array_netcdf +type keyword +reader urword +optional true +mf6internal export_nc +longname export array variables to netcdf output files. +description keyword that specifies input griddata arrays should be written to the model output netcdf file. + +# --------------------- gwf ic griddata --------------------- + +block griddata +name strt +type double precision +shape (nodes) +reader readarray +layered true +longname starting head +description is the initial (starting) head---that is, head at the beginning of the GWF Model simulation. STRT must be specified for all simulations, including steady-state simulations. One value is read for every model cell. For simulations in which the first stress period is steady state, the values used for STRT generally do not affect the simulation (exceptions may occur if cells go dry and (or) rewet). The execution time, however, will be less if STRT includes hydraulic heads that are close to the steady-state solution. A head value lower than the cell bottom can be provided if a cell should start as dry. +default_value 1.0 diff --git a/spec/dfn2toml.py b/spec/dfn2toml.py index b5d6e85..cb1329a 100644 --- a/spec/dfn2toml.py +++ b/spec/dfn2toml.py @@ -85,7 +85,7 @@ def __init__( d["block"][b][name] = block_d[p] if self._multi_package: - d["multipkg"] = True + d["multi"] = True if self._stress_package: d["stress"] = True if self._advanced_package: @@ -201,40 +201,9 @@ def _substitute(self, blockname, component, subcomponent): if "block_variable" in v and v["block_variable"].upper() == "TRUE": continue - vtype = v["type"].upper() - if vtype == "DOUBLE PRECISION": - vtype = "DOUBLE" - recarray = vtype and vtype.startswith("RECARRAY") - - vname = v["name"].upper() - - shape = "" - shapelist = [] - if "shape" in v: - shape = v["shape"] - shape = shape.replace("(", "") - shape = shape.replace(")", "") - shape = shape.replace(",", "") - shape = shape.upper() - if shape == "NCOL*NROW; NCPL": - if ( - vname == "AUX" - and "reader" in v - and v["reader"] == "readarray" - ): - shape = "NAUX NCPL" - else: - shape = "NCPL" - shapelist = shape.strip().split() - - ndim = len(shapelist) - if ( - shape != "" - and ndim > 0 - and not recarray - and (vtype == "DOUBLE" or vtype == "INTEGER") - ): - vtype = f"{vtype}{ndim}D" + vtype = v["type"].lower() + if vtype == "double precision": + vtype = "double" d = None d = mf6_param_dfn.copy() @@ -249,8 +218,6 @@ def _substitute(self, blockname, component, subcomponent): valid = v[k].strip().split() if len(valid) > 0: d[k] = valid.copy() - elif k == "shape": - d[k] = shape elif k == "type": d[k] = vtype else: diff --git a/spec/dfns.txt b/spec/dfns.txt index 31f6d26..d6a3841 100644 --- a/spec/dfns.txt +++ b/spec/dfns.txt @@ -6,6 +6,7 @@ # gwf model gwf-dis.dfn +gwf-ic.dfn # gwt model gwt-dis.dfn diff --git a/spec/toml/gwe-dis.toml b/spec/toml/gwe-dis.toml index 8d68fc5..80214f3 100644 --- a/spec/toml/gwe-dis.toml +++ b/spec/toml/gwe-dis.toml @@ -6,7 +6,7 @@ stress = false advanced = false [block.options.length_units] -type = "STRING" +type = "string" block_variable = false valid = [] shape = "" @@ -23,7 +23,7 @@ description = "is the length units used for this model. Values can be ``FEET'', deprecated = "" [block.options.nogrb] -type = "KEYWORD" +type = "keyword" block_variable = false valid = [] shape = "" @@ -40,7 +40,7 @@ description = "keyword to deactivate writing of the binary grid file." deprecated = "" [block.options.xorigin] -type = "DOUBLE" +type = "double" block_variable = false valid = [] shape = "" @@ -57,7 +57,7 @@ description = "x-position of the lower-left corner of the model grid. A default deprecated = "" [block.options.yorigin] -type = "DOUBLE" +type = "double" block_variable = false valid = [] shape = "" @@ -74,7 +74,7 @@ description = "y-position of the lower-left corner of the model grid. If not sp deprecated = "" [block.options.angrot] -type = "DOUBLE" +type = "double" block_variable = false valid = [] shape = "" @@ -91,7 +91,7 @@ description = "counter-clockwise rotation angle (in degrees) of the lower-left c deprecated = "" [block.options.export_array_ascii] -type = "KEYWORD" +type = "keyword" block_variable = false valid = [] shape = "" @@ -108,7 +108,7 @@ description = "keyword that specifies input griddata arrays should be written to deprecated = "" [block.options.export_array_netcdf] -type = "KEYWORD" +type = "keyword" block_variable = false valid = [] shape = "" @@ -125,7 +125,7 @@ description = "keyword that specifies input griddata arrays should be written to deprecated = "" [block.options.ncf_filerecord] -type = "RECORD NCF6 FILEIN NCF6_FILENAME" +type = "record ncf6 filein ncf6_filename" block_variable = false valid = [] shape = "" @@ -142,7 +142,7 @@ description = "" deprecated = "" [block.options.ncf6] -type = "KEYWORD" +type = "keyword" block_variable = false valid = [] shape = "" @@ -159,7 +159,7 @@ description = "keyword to specify that record corresponds to a netcdf configurat deprecated = "" [block.options.filein] -type = "KEYWORD" +type = "keyword" block_variable = false valid = [] shape = "" @@ -176,7 +176,7 @@ description = "keyword to specify that an input filename is expected next." deprecated = "" [block.options.ncf6_filename] -type = "STRING" +type = "string" block_variable = false valid = [] shape = "" @@ -193,7 +193,7 @@ description = "defines a netcdf configuration (NCF) input file." deprecated = "" [block.dimensions.nlay] -type = "INTEGER" +type = "integer" block_variable = false valid = [] shape = "" @@ -211,7 +211,7 @@ description = "is the number of layers in the model grid." deprecated = "" [block.dimensions.nrow] -type = "INTEGER" +type = "integer" block_variable = false valid = [] shape = "" @@ -229,7 +229,7 @@ description = "is the number of rows in the model grid." deprecated = "" [block.dimensions.ncol] -type = "INTEGER" +type = "integer" block_variable = false valid = [] shape = "" @@ -247,10 +247,10 @@ description = "is the number of columns in the model grid." deprecated = "" [block.griddata.delr] -type = "DOUBLE1D" +type = "double" block_variable = false valid = [] -shape = "NCOL" +shape = "(ncol)" tagged = true in_record = false layered = false @@ -265,10 +265,10 @@ description = "is the column spacing in the row direction." deprecated = "" [block.griddata.delc] -type = "DOUBLE1D" +type = "double" block_variable = false valid = [] -shape = "NROW" +shape = "(nrow)" tagged = true in_record = false layered = false @@ -283,10 +283,10 @@ description = "is the row spacing in the column direction." deprecated = "" [block.griddata.top] -type = "DOUBLE2D" +type = "double" block_variable = false valid = [] -shape = "NCOL NROW" +shape = "(ncol, nrow)" tagged = true in_record = false layered = false @@ -301,10 +301,10 @@ description = "is the top elevation for each cell in the top model layer." deprecated = "" [block.griddata.botm] -type = "DOUBLE3D" +type = "double" block_variable = false valid = [] -shape = "NCOL NROW NLAY" +shape = "(ncol, nrow, nlay)" tagged = true in_record = false layered = true @@ -319,10 +319,10 @@ description = "is the bottom elevation for each cell." deprecated = "" [block.griddata.idomain] -type = "INTEGER3D" +type = "integer" block_variable = false valid = [] -shape = "NCOL NROW NLAY" +shape = "(ncol, nrow, nlay)" tagged = true in_record = false layered = true diff --git a/spec/toml/gwf-dis.toml b/spec/toml/gwf-dis.toml index 5c71d98..e06c07c 100644 --- a/spec/toml/gwf-dis.toml +++ b/spec/toml/gwf-dis.toml @@ -6,7 +6,7 @@ stress = false advanced = false [block.options.length_units] -type = "STRING" +type = "string" block_variable = false valid = [] shape = "" @@ -23,7 +23,7 @@ description = "is the length units used for this model. Values can be ``FEET'', deprecated = "" [block.options.nogrb] -type = "KEYWORD" +type = "keyword" block_variable = false valid = [] shape = "" @@ -40,7 +40,7 @@ description = "keyword to deactivate writing of the binary grid file." deprecated = "" [block.options.xorigin] -type = "DOUBLE" +type = "double" block_variable = false valid = [] shape = "" @@ -57,7 +57,7 @@ description = "x-position of the lower-left corner of the model grid. A default deprecated = "" [block.options.yorigin] -type = "DOUBLE" +type = "double" block_variable = false valid = [] shape = "" @@ -74,7 +74,7 @@ description = "y-position of the lower-left corner of the model grid. If not sp deprecated = "" [block.options.angrot] -type = "DOUBLE" +type = "double" block_variable = false valid = [] shape = "" @@ -91,7 +91,7 @@ description = "counter-clockwise rotation angle (in degrees) of the lower-left c deprecated = "" [block.options.export_array_ascii] -type = "KEYWORD" +type = "keyword" block_variable = false valid = [] shape = "" @@ -108,7 +108,7 @@ description = "keyword that specifies input griddata arrays should be written to deprecated = "" [block.options.export_array_netcdf] -type = "KEYWORD" +type = "keyword" block_variable = false valid = [] shape = "" @@ -125,7 +125,7 @@ description = "keyword that specifies input griddata arrays should be written to deprecated = "" [block.options.ncf_filerecord] -type = "RECORD NCF6 FILEIN NCF6_FILENAME" +type = "record ncf6 filein ncf6_filename" block_variable = false valid = [] shape = "" @@ -142,7 +142,7 @@ description = "" deprecated = "" [block.options.ncf6] -type = "KEYWORD" +type = "keyword" block_variable = false valid = [] shape = "" @@ -159,7 +159,7 @@ description = "keyword to specify that record corresponds to a netcdf configurat deprecated = "" [block.options.filein] -type = "KEYWORD" +type = "keyword" block_variable = false valid = [] shape = "" @@ -176,7 +176,7 @@ description = "keyword to specify that an input filename is expected next." deprecated = "" [block.options.ncf6_filename] -type = "STRING" +type = "string" block_variable = false valid = [] shape = "" @@ -193,7 +193,7 @@ description = "defines a netcdf configuration (NCF) input file." deprecated = "" [block.dimensions.nlay] -type = "INTEGER" +type = "integer" block_variable = false valid = [] shape = "" @@ -211,7 +211,7 @@ description = "is the number of layers in the model grid." deprecated = "" [block.dimensions.nrow] -type = "INTEGER" +type = "integer" block_variable = false valid = [] shape = "" @@ -229,7 +229,7 @@ description = "is the number of rows in the model grid." deprecated = "" [block.dimensions.ncol] -type = "INTEGER" +type = "integer" block_variable = false valid = [] shape = "" @@ -247,10 +247,10 @@ description = "is the number of columns in the model grid." deprecated = "" [block.griddata.delr] -type = "DOUBLE1D" +type = "double" block_variable = false valid = [] -shape = "NCOL" +shape = "(ncol)" tagged = true in_record = false layered = false @@ -265,10 +265,10 @@ description = "is the column spacing in the row direction." deprecated = "" [block.griddata.delc] -type = "DOUBLE1D" +type = "double" block_variable = false valid = [] -shape = "NROW" +shape = "(nrow)" tagged = true in_record = false layered = false @@ -283,10 +283,10 @@ description = "is the row spacing in the column direction." deprecated = "" [block.griddata.top] -type = "DOUBLE2D" +type = "double" block_variable = false valid = [] -shape = "NCOL NROW" +shape = "(ncol, nrow)" tagged = true in_record = false layered = false @@ -301,10 +301,10 @@ description = "is the top elevation for each cell in the top model layer." deprecated = "" [block.griddata.botm] -type = "DOUBLE3D" +type = "double" block_variable = false valid = [] -shape = "NCOL NROW NLAY" +shape = "(ncol, nrow, nlay)" tagged = true in_record = false layered = true @@ -319,10 +319,10 @@ description = "is the bottom elevation for each cell." deprecated = "" [block.griddata.idomain] -type = "INTEGER3D" +type = "integer" block_variable = false valid = [] -shape = "NCOL NROW NLAY" +shape = "(ncol, nrow, nlay)" tagged = true in_record = false layered = true diff --git a/spec/toml/gwf-ic.toml b/spec/toml/gwf-ic.toml new file mode 100644 index 0000000..e1236a3 --- /dev/null +++ b/spec/toml/gwf-ic.toml @@ -0,0 +1,58 @@ +component = "GWF" +subcomponent = "IC" +blocknames = [ "options", "griddata",] +multipkg = false +stress = false +advanced = false + +[block.options.export_array_ascii] +type = "keyword" +block_variable = false +valid = [] +shape = "" +tagged = true +in_record = false +layered = false +time_series = false +reader = "urword" +optional = true +preserve_case = false +numeric_index = false +longname = "export array variables to layered ascii files." +description = "keyword that specifies input griddata arrays should be written to layered ascii output files." +deprecated = "" + +[block.options.export_array_netcdf] +type = "keyword" +block_variable = false +valid = [] +shape = "" +tagged = true +in_record = false +layered = false +time_series = false +reader = "urword" +optional = true +preserve_case = false +numeric_index = false +longname = "export array variables to netcdf output files." +description = "keyword that specifies input griddata arrays should be written to the model output netcdf file." +deprecated = "" + +[block.griddata.strt] +type = "double" +block_variable = false +valid = [] +shape = "(nodes)" +tagged = true +in_record = false +layered = true +time_series = false +reader = "readarray" +optional = false +preserve_case = false +default_value = "1.0" +numeric_index = false +longname = "starting head" +description = "is the initial (starting) head---that is, head at the beginning of the GWF Model simulation. STRT must be specified for all simulations, including steady-state simulations. One value is read for every model cell. For simulations in which the first stress period is steady state, the values used for STRT generally do not affect the simulation (exceptions may occur if cells go dry and (or) rewet). The execution time, however, will be less if STRT includes hydraulic heads that are close to the steady-state solution. A head value lower than the cell bottom can be provided if a cell should start as dry." +deprecated = "" diff --git a/spec/toml/gwt-dis.toml b/spec/toml/gwt-dis.toml index 230708e..405eb98 100644 --- a/spec/toml/gwt-dis.toml +++ b/spec/toml/gwt-dis.toml @@ -6,7 +6,7 @@ stress = false advanced = false [block.options.length_units] -type = "STRING" +type = "string" block_variable = false valid = [] shape = "" @@ -23,7 +23,7 @@ description = "is the length units used for this model. Values can be ``FEET'', deprecated = "" [block.options.nogrb] -type = "KEYWORD" +type = "keyword" block_variable = false valid = [] shape = "" @@ -40,7 +40,7 @@ description = "keyword to deactivate writing of the binary grid file." deprecated = "" [block.options.xorigin] -type = "DOUBLE" +type = "double" block_variable = false valid = [] shape = "" @@ -57,7 +57,7 @@ description = "x-position of the lower-left corner of the model grid. A default deprecated = "" [block.options.yorigin] -type = "DOUBLE" +type = "double" block_variable = false valid = [] shape = "" @@ -74,7 +74,7 @@ description = "y-position of the lower-left corner of the model grid. If not sp deprecated = "" [block.options.angrot] -type = "DOUBLE" +type = "double" block_variable = false valid = [] shape = "" @@ -91,7 +91,7 @@ description = "counter-clockwise rotation angle (in degrees) of the lower-left c deprecated = "" [block.options.export_array_ascii] -type = "KEYWORD" +type = "keyword" block_variable = false valid = [] shape = "" @@ -108,7 +108,7 @@ description = "keyword that specifies input griddata arrays should be written to deprecated = "" [block.options.export_array_netcdf] -type = "KEYWORD" +type = "keyword" block_variable = false valid = [] shape = "" @@ -125,7 +125,7 @@ description = "keyword that specifies input griddata arrays should be written to deprecated = "" [block.options.ncf_filerecord] -type = "RECORD NCF6 FILEIN NCF6_FILENAME" +type = "record ncf6 filein ncf6_filename" block_variable = false valid = [] shape = "" @@ -142,7 +142,7 @@ description = "" deprecated = "" [block.options.ncf6] -type = "KEYWORD" +type = "keyword" block_variable = false valid = [] shape = "" @@ -159,7 +159,7 @@ description = "keyword to specify that record corresponds to a netcdf configurat deprecated = "" [block.options.filein] -type = "KEYWORD" +type = "keyword" block_variable = false valid = [] shape = "" @@ -176,7 +176,7 @@ description = "keyword to specify that an input filename is expected next." deprecated = "" [block.options.ncf6_filename] -type = "STRING" +type = "string" block_variable = false valid = [] shape = "" @@ -193,7 +193,7 @@ description = "defines a netcdf configuration (NCF) input file." deprecated = "" [block.dimensions.nlay] -type = "INTEGER" +type = "integer" block_variable = false valid = [] shape = "" @@ -211,7 +211,7 @@ description = "is the number of layers in the model grid." deprecated = "" [block.dimensions.nrow] -type = "INTEGER" +type = "integer" block_variable = false valid = [] shape = "" @@ -229,7 +229,7 @@ description = "is the number of rows in the model grid." deprecated = "" [block.dimensions.ncol] -type = "INTEGER" +type = "integer" block_variable = false valid = [] shape = "" @@ -247,10 +247,10 @@ description = "is the number of columns in the model grid." deprecated = "" [block.griddata.delr] -type = "DOUBLE1D" +type = "double" block_variable = false valid = [] -shape = "NCOL" +shape = "(ncol)" tagged = true in_record = false layered = false @@ -265,10 +265,10 @@ description = "is the column spacing in the row direction." deprecated = "" [block.griddata.delc] -type = "DOUBLE1D" +type = "double" block_variable = false valid = [] -shape = "NROW" +shape = "(nrow)" tagged = true in_record = false layered = false @@ -283,10 +283,10 @@ description = "is the row spacing in the column direction." deprecated = "" [block.griddata.top] -type = "DOUBLE2D" +type = "double" block_variable = false valid = [] -shape = "NCOL NROW" +shape = "(ncol, nrow)" tagged = true in_record = false layered = false @@ -301,10 +301,10 @@ description = "is the top elevation for each cell in the top model layer." deprecated = "" [block.griddata.botm] -type = "DOUBLE3D" +type = "double" block_variable = false valid = [] -shape = "NCOL NROW NLAY" +shape = "(ncol, nrow, nlay)" tagged = true in_record = false layered = true @@ -319,10 +319,10 @@ description = "is the bottom elevation for each cell." deprecated = "" [block.griddata.idomain] -type = "INTEGER3D" +type = "integer" block_variable = false valid = [] -shape = "NCOL NROW NLAY" +shape = "(ncol, nrow, nlay)" tagged = true in_record = false layered = true diff --git a/spec/toml/prt-dis.toml b/spec/toml/prt-dis.toml index 7a2f752..cc231e9 100644 --- a/spec/toml/prt-dis.toml +++ b/spec/toml/prt-dis.toml @@ -6,7 +6,7 @@ stress = false advanced = false [block.options.length_units] -type = "STRING" +type = "string" block_variable = false valid = [] shape = "" @@ -23,7 +23,7 @@ description = "is the length units used for this model. Values can be ``FEET'', deprecated = "" [block.options.nogrb] -type = "KEYWORD" +type = "keyword" block_variable = false valid = [] shape = "" @@ -40,7 +40,7 @@ description = "keyword to deactivate writing of the binary grid file." deprecated = "" [block.options.xorigin] -type = "DOUBLE" +type = "double" block_variable = false valid = [] shape = "" @@ -57,7 +57,7 @@ description = "x-position of the lower-left corner of the model grid. A default deprecated = "" [block.options.yorigin] -type = "DOUBLE" +type = "double" block_variable = false valid = [] shape = "" @@ -74,7 +74,7 @@ description = "y-position of the lower-left corner of the model grid. If not sp deprecated = "" [block.options.angrot] -type = "DOUBLE" +type = "double" block_variable = false valid = [] shape = "" @@ -91,7 +91,7 @@ description = "counter-clockwise rotation angle (in degrees) of the lower-left c deprecated = "" [block.options.export_array_ascii] -type = "KEYWORD" +type = "keyword" block_variable = false valid = [] shape = "" @@ -108,7 +108,7 @@ description = "keyword that specifies input griddata arrays should be written to deprecated = "" [block.options.export_array_netcdf] -type = "KEYWORD" +type = "keyword" block_variable = false valid = [] shape = "" @@ -125,7 +125,7 @@ description = "keyword that specifies input griddata arrays should be written to deprecated = "" [block.options.ncf_filerecord] -type = "RECORD NCF6 FILEIN NCF6_FILENAME" +type = "record ncf6 filein ncf6_filename" block_variable = false valid = [] shape = "" @@ -142,7 +142,7 @@ description = "" deprecated = "" [block.options.ncf6] -type = "KEYWORD" +type = "keyword" block_variable = false valid = [] shape = "" @@ -159,7 +159,7 @@ description = "keyword to specify that record corresponds to a netcdf configurat deprecated = "" [block.options.filein] -type = "KEYWORD" +type = "keyword" block_variable = false valid = [] shape = "" @@ -176,7 +176,7 @@ description = "keyword to specify that an input filename is expected next." deprecated = "" [block.options.ncf6_filename] -type = "STRING" +type = "string" block_variable = false valid = [] shape = "" @@ -193,7 +193,7 @@ description = "defines a netcdf configuration (NCF) input file." deprecated = "" [block.dimensions.nlay] -type = "INTEGER" +type = "integer" block_variable = false valid = [] shape = "" @@ -211,7 +211,7 @@ description = "is the number of layers in the model grid." deprecated = "" [block.dimensions.nrow] -type = "INTEGER" +type = "integer" block_variable = false valid = [] shape = "" @@ -229,7 +229,7 @@ description = "is the number of rows in the model grid." deprecated = "" [block.dimensions.ncol] -type = "INTEGER" +type = "integer" block_variable = false valid = [] shape = "" @@ -247,10 +247,10 @@ description = "is the number of columns in the model grid." deprecated = "" [block.griddata.delr] -type = "DOUBLE1D" +type = "double" block_variable = false valid = [] -shape = "NCOL" +shape = "(ncol)" tagged = true in_record = false layered = false @@ -265,10 +265,10 @@ description = "is the column spacing in the row direction." deprecated = "" [block.griddata.delc] -type = "DOUBLE1D" +type = "double" block_variable = false valid = [] -shape = "NROW" +shape = "(nrow)" tagged = true in_record = false layered = false @@ -283,10 +283,10 @@ description = "is the row spacing in the column direction." deprecated = "" [block.griddata.top] -type = "DOUBLE2D" +type = "double" block_variable = false valid = [] -shape = "NCOL NROW" +shape = "(ncol, nrow)" tagged = true in_record = false layered = false @@ -301,10 +301,10 @@ description = "is the top elevation for each cell in the top model layer." deprecated = "" [block.griddata.botm] -type = "DOUBLE3D" +type = "double" block_variable = false valid = [] -shape = "NCOL NROW NLAY" +shape = "(ncol, nrow, nlay)" tagged = true in_record = false layered = true @@ -319,10 +319,10 @@ description = "is the bottom elevation for each cell." deprecated = "" [block.griddata.idomain] -type = "INTEGER3D" +type = "integer" block_variable = false valid = [] -shape = "NCOL NROW NLAY" +shape = "(ncol, nrow, nlay)" tagged = true in_record = false layered = true diff --git a/spec/toml/prt-prp.toml b/spec/toml/prt-prp.toml index 0d42ead..95f1b4c 100644 --- a/spec/toml/prt-prp.toml +++ b/spec/toml/prt-prp.toml @@ -1,12 +1,13 @@ component = "PRT" subcomponent = "PRP" blocknames = [ "options", "dimensions", "packagedata", "period",] -multipkg = true +multipkg = false stress = false advanced = false +multi = true [block.options.boundnames] -type = "KEYWORD" +type = "keyword" block_variable = false valid = [] shape = "" @@ -23,7 +24,7 @@ description = "keyword to indicate that boundary names may be provided with the deprecated = "" [block.options.print_input] -type = "KEYWORD" +type = "keyword" block_variable = false valid = [] shape = "" @@ -40,7 +41,7 @@ description = "REPLACE print_input {'{#1}': 'all model stress package'}" deprecated = "" [block.options.dev_exit_solve_method] -type = "INTEGER" +type = "integer" block_variable = false valid = [] shape = "" @@ -57,7 +58,7 @@ description = "the method for iterative solution of particle exit location and t deprecated = "" [block.options.exit_solve_tolerance] -type = "DOUBLE" +type = "double" block_variable = false valid = [] shape = "" @@ -74,7 +75,7 @@ description = "the convergence tolerance for iterative solution of particle exit deprecated = "" [block.options.local_z] -type = "KEYWORD" +type = "keyword" block_variable = false valid = [] shape = "" @@ -91,7 +92,7 @@ description = "indicates that ``zrpt'' defines the local z coordinate of the rel deprecated = "" [block.options.extend_tracking] -type = "KEYWORD" +type = "keyword" block_variable = false valid = [] shape = "" @@ -108,7 +109,7 @@ description = "indicates that particles should be tracked beyond the end of the deprecated = "" [block.options.track_filerecord] -type = "RECORD TRACK FILEOUT TRACKFILE" +type = "record track fileout trackfile" block_variable = false valid = [] shape = "" @@ -125,7 +126,7 @@ description = "" deprecated = "" [block.options.track] -type = "KEYWORD" +type = "keyword" block_variable = false valid = [] shape = "" @@ -142,7 +143,7 @@ description = "keyword to specify that record corresponds to a binary track outp deprecated = "" [block.options.fileout] -type = "KEYWORD" +type = "keyword" block_variable = false valid = [] shape = "" @@ -159,7 +160,7 @@ description = "keyword to specify that an output filename is expected next." deprecated = "" [block.options.trackfile] -type = "STRING" +type = "string" block_variable = false valid = [] shape = "" @@ -176,7 +177,7 @@ description = "name of the binary output file to write tracking information." deprecated = "" [block.options.trackcsv_filerecord] -type = "RECORD TRACKCSV FILEOUT TRACKCSVFILE" +type = "record trackcsv fileout trackcsvfile" block_variable = false valid = [] shape = "" @@ -193,7 +194,7 @@ description = "" deprecated = "" [block.options.trackcsv] -type = "KEYWORD" +type = "keyword" block_variable = false valid = [] shape = "" @@ -210,7 +211,7 @@ description = "keyword to specify that record corresponds to a CSV track output deprecated = "" [block.options.trackcsvfile] -type = "STRING" +type = "string" block_variable = false valid = [] shape = "" @@ -227,7 +228,7 @@ description = "name of the comma-separated value (CSV) file to write tracking in deprecated = "" [block.options.stoptime] -type = "DOUBLE" +type = "double" block_variable = false valid = [] shape = "" @@ -244,7 +245,7 @@ description = "real value defining the maximum simulation time to which particle deprecated = "" [block.options.stoptraveltime] -type = "DOUBLE" +type = "double" block_variable = false valid = [] shape = "" @@ -261,7 +262,7 @@ description = "real value defining the maximum travel time over which particles deprecated = "" [block.options.stop_at_weak_sink] -type = "KEYWORD" +type = "keyword" block_variable = false valid = [] shape = "" @@ -278,7 +279,7 @@ description = "is a text keyword to indicate that a particle is to terminate whe deprecated = "" [block.options.istopzone] -type = "INTEGER" +type = "integer" block_variable = false valid = [] shape = "" @@ -295,7 +296,7 @@ description = "integer value defining the stop zone number. If cells have been deprecated = "" [block.options.drape] -type = "KEYWORD" +type = "keyword" block_variable = false valid = [] shape = "" @@ -312,7 +313,7 @@ description = "is a text keyword to indicate that if a particle's release point deprecated = "" [block.options.release_timesrecord] -type = "RECORD RELEASE_TIMES TIMES" +type = "record release_times times" block_variable = false valid = [] shape = "" @@ -329,7 +330,7 @@ description = "" deprecated = "" [block.options.release_times] -type = "KEYWORD" +type = "keyword" block_variable = false valid = [] shape = "" @@ -346,10 +347,10 @@ description = "keyword indicating release times will follow" deprecated = "" [block.options.times] -type = "DOUBLE1D" +type = "double" block_variable = false valid = [] -shape = "UNKNOWN" +shape = "(unknown)" tagged = false in_record = true layered = false @@ -363,7 +364,7 @@ description = "times to release, relative to the beginning of the simulation. R deprecated = "" [block.options.release_timesfilerecord] -type = "RECORD RELEASE_TIMESFILE TIMESFILE" +type = "record release_timesfile timesfile" block_variable = false valid = [] shape = "" @@ -380,7 +381,7 @@ description = "" deprecated = "" [block.options.release_timesfile] -type = "KEYWORD" +type = "keyword" block_variable = false valid = [] shape = "" @@ -397,7 +398,7 @@ description = "keyword indicating release times file name will follow" deprecated = "" [block.options.timesfile] -type = "STRING" +type = "string" block_variable = false valid = [] shape = "" @@ -414,7 +415,7 @@ description = "name of the release times file. RELEASE\\_TIMES and RELEASE\\_TI deprecated = "" [block.options.dev_forceternary] -type = "KEYWORD" +type = "keyword" block_variable = false valid = [] shape = "" @@ -431,7 +432,7 @@ description = "force use of the ternary tracking method regardless of cell type deprecated = "" [block.dimensions.nreleasepts] -type = "INTEGER" +type = "integer" block_variable = false valid = [] shape = "" @@ -448,10 +449,10 @@ description = "is the number of particle release points." deprecated = "" [block.packagedata.packagedata] -type = "RECARRAY IRPTNO CELLID XRPT YRPT ZRPT BOUNDNAME" +type = "recarray irptno cellid xrpt yrpt zrpt boundname" block_variable = false valid = [] -shape = "NRELEASEPTS" +shape = "(nreleasepts)" tagged = true in_record = false layered = false @@ -465,7 +466,7 @@ description = "" deprecated = "" [block.packagedata.irptno] -type = "INTEGER" +type = "integer" block_variable = false valid = [] shape = "" @@ -482,10 +483,10 @@ description = "integer value that defines the PRP release point number associate deprecated = "" [block.packagedata.cellid] -type = "INTEGER1D" +type = "integer" block_variable = false valid = [] -shape = "NCELLDIM" +shape = "(ncelldim)" tagged = false in_record = true layered = false @@ -499,7 +500,7 @@ description = "REPLACE cellid {}" deprecated = "" [block.packagedata.xrpt] -type = "DOUBLE" +type = "double" block_variable = false valid = [] shape = "" @@ -516,7 +517,7 @@ description = "real value that defines the x coordinate of the release point in deprecated = "" [block.packagedata.yrpt] -type = "DOUBLE" +type = "double" block_variable = false valid = [] shape = "" @@ -533,7 +534,7 @@ description = "real value that defines the y coordinate of the release point in deprecated = "" [block.packagedata.zrpt] -type = "DOUBLE" +type = "double" block_variable = false valid = [] shape = "" @@ -550,7 +551,7 @@ description = "real value that defines the z coordinate of the release point in deprecated = "" [block.packagedata.boundname] -type = "STRING" +type = "string" block_variable = false valid = [] shape = "" @@ -567,7 +568,7 @@ description = "name of the particle release point. BOUNDNAME is an ASCII charact deprecated = "" [block.period.perioddata] -type = "RECARRAY RELEASESETTING" +type = "recarray releasesetting" block_variable = false valid = [] shape = "" @@ -584,7 +585,7 @@ description = "" deprecated = "" [block.period.releasesetting] -type = "KEYSTRING ALL FIRST FREQUENCY STEPS FRACTION" +type = "keystring all first frequency steps fraction" block_variable = false valid = [] shape = "" @@ -601,7 +602,7 @@ description = "specifies when to release particles within the stress period. Ov deprecated = "" [block.period.all] -type = "KEYWORD" +type = "keyword" block_variable = false valid = [] shape = "" @@ -618,7 +619,7 @@ description = "keyword to indicate release of particles at the start of all time deprecated = "" [block.period.first] -type = "KEYWORD" +type = "keyword" block_variable = false valid = [] shape = "" @@ -635,7 +636,7 @@ description = "keyword to indicate release of particles at the start of the firs deprecated = "" [block.period.frequency] -type = "INTEGER" +type = "integer" block_variable = false valid = [] shape = "" @@ -652,10 +653,10 @@ description = "release particles at the specified time step frequency. This keyw deprecated = "" [block.period.steps] -type = "INTEGER1D" +type = "integer" block_variable = false valid = [] -shape = " Date: Wed, 24 Jul 2024 13:30:58 -0400 Subject: [PATCH 2/3] move import up --- flopy4/array.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flopy4/array.py b/flopy4/array.py index 48513fd..8c7e5c7 100644 --- a/flopy4/array.py +++ b/flopy4/array.py @@ -4,6 +4,7 @@ from typing import Optional import numpy as np +import re from flopy.utils.flopy_io import line_strip, multi_line_strip from flopy4.constants import CommonNames @@ -406,7 +407,6 @@ def read_array(f): Read a MODFLOW 6 array from an open file into a flat NumPy array representation. """ - import re astr = [] while True: From 5df58dfc9c41106649bc2c15464c9faac8010b98 Mon Sep 17 00:00:00 2001 From: mjreno Date: Wed, 24 Jul 2024 13:36:45 -0400 Subject: [PATCH 3/3] ruff --- flopy4/array.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flopy4/array.py b/flopy4/array.py index 8c7e5c7..f7198d2 100644 --- a/flopy4/array.py +++ b/flopy4/array.py @@ -1,10 +1,10 @@ +import re from enum import Enum from io import StringIO from pathlib import Path from typing import Optional import numpy as np -import re from flopy.utils.flopy_io import line_strip, multi_line_strip from flopy4.constants import CommonNames