Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic jinja template support #12

Merged
merged 1 commit into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions spec/dfns.txt

This file was deleted.

167 changes: 167 additions & 0 deletions spec/ipkg/gwe_dis.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
import numpy as np

from flopy4.array import MFArray
from flopy4.block import MFBlock
from flopy4.package import MFPackage
from flopy4.scalar import MFDouble, MFFilename, MFInteger, MFKeyword, MFString
from flopy4.compound import MFRecord

# generated file
class GweDis(MFPackage):
length_units = MFString(
block = "options",
shape = "",
reader = "urword",
optional = True,
longname = "model length units",
description = "is the length units used for this model. Values can be ``FEET'', ``METERS'', or ``CENTIMETERS''. If not specified, the default is ``UNKNOWN''.",
)
nogrb = MFKeyword(
block = "options",
shape = "",
reader = "urword",
optional = True,
longname = "do not write binary grid file",
description = "keyword to deactivate writing of the binary grid file.",
)
xorigin = MFDouble(
block = "options",
shape = "",
reader = "urword",
optional = True,
longname = "x-position of the model grid origin",
description = "x-position of the lower-left corner of the model grid. A default value of zero is assigned if not specified. The value for XORIGIN does not affect the model simulation, but it is written to the binary grid file so that postprocessors can locate the grid in space.",
)
yorigin = MFDouble(
block = "options",
shape = "",
reader = "urword",
optional = True,
longname = "y-position of the model grid origin",
description = "y-position of the lower-left corner of the model grid. If not specified, then a default value equal to zero is used. The value for YORIGIN does not affect the model simulation, but it is written to the binary grid file so that postprocessors can locate the grid in space.",
)
angrot = MFDouble(
block = "options",
shape = "",
reader = "urword",
optional = True,
longname = "rotation angle",
description = "counter-clockwise rotation angle (in degrees) of the lower-left corner of the model grid. If not specified, then a default value of 0.0 is assigned. The value for ANGROT does not affect the model simulation, but it is written to the binary grid file so that postprocessors can locate the grid in space.",
)
export_array_ascii = MFKeyword(
block = "options",
shape = "",
reader = "urword",
optional = True,
longname = "export array variables to layered ascii files.",
description = "keyword that specifies input griddata arrays should be written to layered ascii output files.",
)
export_array_netcdf = MFKeyword(
block = "options",
shape = "",
reader = "urword",
optional = True,
longname = "export array variables to netcdf output files.",
description = "keyword that specifies input griddata arrays should be written to the model output netcdf file.",
)
ncf_filerecord = MFRecord(
params = {
"ncf6": MFKeyword(),
"filein": MFKeyword(),
"ncf6_filename": MFString(),
},
block = "options",
shape = "",
reader = "urword",
optional = True,
longname = "",
description = "",
)
ncf6 = MFKeyword(
block = "options",
shape = "",
reader = "urword",
optional = False,
longname = "ncf keyword",
description = "keyword to specify that record corresponds to a netcdf configuration (NCF) file.",
)
filein = MFKeyword(
block = "options",
shape = "",
reader = "urword",
optional = False,
longname = "file keyword",
description = "keyword to specify that an input filename is expected next.",
)
ncf6_filename = MFString(
block = "options",
shape = "",
reader = "urword",
optional = False,
longname = "file name of NCF information",
description = "defines a netcdf configuration (NCF) input file.",
)
nlay = MFInteger(
block = "dimensions",
shape = "",
reader = "urword",
optional = False,
longname = "number of layers",
description = "is the number of layers in the model grid.",
)
nrow = MFInteger(
block = "dimensions",
shape = "",
reader = "urword",
optional = False,
longname = "number of rows",
description = "is the number of rows in the model grid.",
)
ncol = MFInteger(
block = "dimensions",
shape = "",
reader = "urword",
optional = False,
longname = "number of columns",
description = "is the number of columns in the model grid.",
)
delr = MFArray(
block = "griddata",
shape = "(ncol)",
reader = "readarray",
optional = False,
longname = "spacing along a row",
description = "is the column spacing in the row direction.",
)
delc = MFArray(
block = "griddata",
shape = "(nrow)",
reader = "readarray",
optional = False,
longname = "spacing along a column",
description = "is the row spacing in the column direction.",
)
top = MFArray(
block = "griddata",
shape = "(ncol, nrow)",
reader = "readarray",
optional = False,
longname = "cell top elevation",
description = "is the top elevation for each cell in the top model layer.",
)
botm = MFArray(
block = "griddata",
shape = "(ncol, nrow, nlay)",
reader = "readarray",
optional = False,
longname = "cell bottom elevation",
description = "is the bottom elevation for each cell.",
)
idomain = MFArray(
block = "griddata",
shape = "(ncol, nrow, nlay)",
reader = "readarray",
optional = True,
longname = "idomain existence array",
description = "is an optional array that characterizes the existence status of a cell. If the IDOMAIN array is not specified, then all model cells exist within the solution. If the IDOMAIN value for a cell is 0, the cell does not exist in the simulation. Input and output values will be read and written for the cell, but internal to the program, the cell is excluded from the solution. If the IDOMAIN value for a cell is 1, the cell exists in the simulation. If the IDOMAIN value for a cell is -1, the cell does not exist in the simulation. Furthermore, the first existing cell above will be connected to the first existing cell below. This type of cell is referred to as a ``vertical pass through'' cell.",
)
167 changes: 167 additions & 0 deletions spec/ipkg/gwf_dis.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
import numpy as np

from flopy4.array import MFArray
from flopy4.block import MFBlock
from flopy4.package import MFPackage
from flopy4.scalar import MFDouble, MFFilename, MFInteger, MFKeyword, MFString
from flopy4.compound import MFRecord

# generated file
class GwfDis(MFPackage):
length_units = MFString(
block = "options",
shape = "",
reader = "urword",
optional = True,
longname = "model length units",
description = "is the length units used for this model. Values can be ``FEET'', ``METERS'', or ``CENTIMETERS''. If not specified, the default is ``UNKNOWN''.",
)
nogrb = MFKeyword(
block = "options",
shape = "",
reader = "urword",
optional = True,
longname = "do not write binary grid file",
description = "keyword to deactivate writing of the binary grid file.",
)
xorigin = MFDouble(
block = "options",
shape = "",
reader = "urword",
optional = True,
longname = "x-position of the model grid origin",
description = "x-position of the lower-left corner of the model grid. A default value of zero is assigned if not specified. The value for XORIGIN does not affect the model simulation, but it is written to the binary grid file so that postprocessors can locate the grid in space.",
)
yorigin = MFDouble(
block = "options",
shape = "",
reader = "urword",
optional = True,
longname = "y-position of the model grid origin",
description = "y-position of the lower-left corner of the model grid. If not specified, then a default value equal to zero is used. The value for YORIGIN does not affect the model simulation, but it is written to the binary grid file so that postprocessors can locate the grid in space.",
)
angrot = MFDouble(
block = "options",
shape = "",
reader = "urword",
optional = True,
longname = "rotation angle",
description = "counter-clockwise rotation angle (in degrees) of the lower-left corner of the model grid. If not specified, then a default value of 0.0 is assigned. The value for ANGROT does not affect the model simulation, but it is written to the binary grid file so that postprocessors can locate the grid in space.",
)
export_array_ascii = MFKeyword(
block = "options",
shape = "",
reader = "urword",
optional = True,
longname = "export array variables to layered ascii files.",
description = "keyword that specifies input griddata arrays should be written to layered ascii output files.",
)
export_array_netcdf = MFKeyword(
block = "options",
shape = "",
reader = "urword",
optional = True,
longname = "export array variables to netcdf output files.",
description = "keyword that specifies input griddata arrays should be written to the model output netcdf file.",
)
ncf_filerecord = MFRecord(
params = {
"ncf6": MFKeyword(),
"filein": MFKeyword(),
"ncf6_filename": MFString(),
},
block = "options",
shape = "",
reader = "urword",
optional = True,
longname = "",
description = "",
)
ncf6 = MFKeyword(
block = "options",
shape = "",
reader = "urword",
optional = False,
longname = "ncf keyword",
description = "keyword to specify that record corresponds to a netcdf configuration (NCF) file.",
)
filein = MFKeyword(
block = "options",
shape = "",
reader = "urword",
optional = False,
longname = "file keyword",
description = "keyword to specify that an input filename is expected next.",
)
ncf6_filename = MFString(
block = "options",
shape = "",
reader = "urword",
optional = False,
longname = "file name of NCF information",
description = "defines a netcdf configuration (NCF) input file.",
)
nlay = MFInteger(
block = "dimensions",
shape = "",
reader = "urword",
optional = False,
longname = "number of layers",
description = "is the number of layers in the model grid.",
)
nrow = MFInteger(
block = "dimensions",
shape = "",
reader = "urword",
optional = False,
longname = "number of rows",
description = "is the number of rows in the model grid.",
)
ncol = MFInteger(
block = "dimensions",
shape = "",
reader = "urword",
optional = False,
longname = "number of columns",
description = "is the number of columns in the model grid.",
)
delr = MFArray(
block = "griddata",
shape = "(ncol)",
reader = "readarray",
optional = False,
longname = "spacing along a row",
description = "is the column spacing in the row direction.",
)
delc = MFArray(
block = "griddata",
shape = "(nrow)",
reader = "readarray",
optional = False,
longname = "spacing along a column",
description = "is the row spacing in the column direction.",
)
top = MFArray(
block = "griddata",
shape = "(ncol, nrow)",
reader = "readarray",
optional = False,
longname = "cell top elevation",
description = "is the top elevation for each cell in the top model layer.",
)
botm = MFArray(
block = "griddata",
shape = "(ncol, nrow, nlay)",
reader = "readarray",
optional = False,
longname = "cell bottom elevation",
description = "is the bottom elevation for each cell.",
)
idomain = MFArray(
block = "griddata",
shape = "(ncol, nrow, nlay)",
reader = "readarray",
optional = True,
longname = "idomain existence array",
description = "is an optional array that characterizes the existence status of a cell. If the IDOMAIN array is not specified, then all model cells exist within the solution. If the IDOMAIN value for a cell is 0, the cell does not exist in the simulation. Input and output values will be read and written for the cell, but internal to the program, the cell is excluded from the solution. If the IDOMAIN value for a cell is 1 or greater, the cell exists in the simulation. If the IDOMAIN value for a cell is -1, the cell does not exist in the simulation. Furthermore, the first existing cell above will be connected to the first existing cell below. This type of cell is referred to as a ``vertical pass through'' cell.",
)
34 changes: 34 additions & 0 deletions spec/ipkg/gwf_ic.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import numpy as np

from flopy4.array import MFArray
from flopy4.block import MFBlock
from flopy4.package import MFPackage
from flopy4.scalar import MFDouble, MFFilename, MFInteger, MFKeyword, MFString
from flopy4.compound import MFRecord

# generated file
class GwfIc(MFPackage):
export_array_ascii = MFKeyword(
block = "options",
shape = "",
reader = "urword",
optional = True,
longname = "export array variables to layered ascii files.",
description = "keyword that specifies input griddata arrays should be written to layered ascii output files.",
)
export_array_netcdf = MFKeyword(
block = "options",
shape = "",
reader = "urword",
optional = True,
longname = "export array variables to netcdf output files.",
description = "keyword that specifies input griddata arrays should be written to the model output netcdf file.",
)
strt = MFArray(
block = "griddata",
shape = "(nodes)",
reader = "readarray",
optional = 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.",
)
Loading
Loading