# autogenerated file, do not modify

from os import PathLike, curdir
from typing import Union

from flopy.mf6.data.mfdatautil import ArrayTemplateGenerator, ListTemplateGenerator
from flopy.mf6.mfpackage import MFChildPackages, MFPackage


class ModflowGwfdis(MFPackage):
    """
    ModflowGwfdis defines a DIS package.

    Parameters
    ----------
    model
        Model that this package is a part of. Package is automatically
        added to model when it is initialized.
    loading_package : bool, default False
        Do not set this parameter. It is intended for debugging and internal
        processing purposes only.
    length_units : string
        is the length units used for this model.  values can be 'feet', 'meters', or
        'centimeters'.  if not specified, the default is 'unknown'.
    nogrb : keyword
        keyword to deactivate writing of the binary grid file.
    grb_filerecord : (grb6_filename)
        * grb6_filename : string
                defines a binary grid output file. If this option is not provided, the output
                file will have the same name as the discretization input file, plus extension
                '.grb'.

    xorigin : double precision
        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 : double precision
        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 : double precision
        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 : keyword
        keyword that specifies input griddata arrays should be written to layered ascii
        output files.
    export_array_netcdf : keyword
        keyword that specifies input griddata arrays should be written to the model
        output netcdf file.
    packagedata : record ncf6 filein ncf6_filename
        Contains data for the ncf package. Data can be passed as a dictionary to the
        ncf package with variable names as keys and package data as values. Data for
        the packagedata variable is also acceptable. See ncf package documentation for
        more information.
    nlay : integer
        is the number of layers in the model grid.
    nrow : integer
        is the number of rows in the model grid.
    ncol : integer
        is the number of columns in the model grid.
    delr : [double precision]
        is the column spacing in the row direction.
    delc : [double precision]
        is the row spacing in the column direction.
    top : [double precision]
        is the top elevation for each cell in the top model layer.
    botm : [double precision]
        is the bottom elevation for each cell.
    idomain : [integer]
        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.

    filename : str or PathLike, optional
        Name or path of file where this package is stored.
    pname : str, optional
        Package name.
    **kwargs
        Extra keywords for :class:`flopy.mf6.mfpackage.MFPackage`.

    """

    grb_filerecord = ListTemplateGenerator(("gwf6", "dis", "options", "grb_filerecord"))
    ncf_filerecord = ListTemplateGenerator(("gwf6", "dis", "options", "ncf_filerecord"))
    delr = ArrayTemplateGenerator(("gwf6", "dis", "griddata", "delr"))
    delc = ArrayTemplateGenerator(("gwf6", "dis", "griddata", "delc"))
    top = ArrayTemplateGenerator(("gwf6", "dis", "griddata", "top"))
    botm = ArrayTemplateGenerator(("gwf6", "dis", "griddata", "botm"))
    idomain = ArrayTemplateGenerator(("gwf6", "dis", "griddata", "idomain"))
    package_abbr = "gwfdis"
    _package_type = "dis"
    dfn_file_name = "gwf-dis.dfn"
    dfn = [
        ["header"],
        [
            "block options",
            "name length_units",
            "type string",
            "reader urword",
            "optional true",
        ],
        [
            "block options",
            "name nogrb",
            "type keyword",
            "reader urword",
            "optional true",
        ],
        [
            "block options",
            "name grb_filerecord",
            "type record grb6 fileout grb6_filename",
            "reader urword",
            "tagged true",
            "optional true",
        ],
        [
            "block options",
            "name grb6",
            "type keyword",
            "in_record true",
            "reader urword",
            "tagged true",
            "optional false",
        ],
        [
            "block options",
            "name fileout",
            "type keyword",
            "in_record true",
            "reader urword",
            "tagged true",
            "optional false",
        ],
        [
            "block options",
            "name grb6_filename",
            "type string",
            "preserve_case true",
            "in_record true",
            "reader urword",
            "optional false",
            "tagged false",
        ],
        [
            "block options",
            "name xorigin",
            "type double precision",
            "reader urword",
            "optional true",
        ],
        [
            "block options",
            "name yorigin",
            "type double precision",
            "reader urword",
            "optional true",
        ],
        [
            "block options",
            "name angrot",
            "type double precision",
            "reader urword",
            "optional true",
        ],
        [
            "block options",
            "name export_array_ascii",
            "type keyword",
            "reader urword",
            "optional true",
            "mf6internal export_ascii",
        ],
        [
            "block options",
            "name export_array_netcdf",
            "type keyword",
            "reader urword",
            "optional true",
            "mf6internal export_nc",
            "extended true",
        ],
        [
            "block options",
            "name crs",
            "type string",
            "shape lenbigline",
            "preserve_case true",
            "reader urword",
            "optional true",
            "prerelease true",
        ],
        [
            "block options",
            "name ncf_filerecord",
            "type record ncf6 filein ncf6_filename",
            "reader urword",
            "tagged true",
            "optional true",
            "construct_package ncf",
            "construct_data packagedata",
            "parameter_name packagedata",
        ],
        [
            "block options",
            "name ncf6",
            "type keyword",
            "in_record true",
            "reader urword",
            "tagged true",
            "optional false",
            "extended true",
        ],
        [
            "block options",
            "name filein",
            "type keyword",
            "in_record true",
            "reader urword",
            "tagged true",
            "optional false",
        ],
        [
            "block options",
            "name ncf6_filename",
            "type string",
            "preserve_case true",
            "in_record true",
            "reader urword",
            "optional false",
            "tagged false",
            "extended true",
        ],
        [
            "block dimensions",
            "name nlay",
            "type integer",
            "reader urword",
            "optional false",
            "default 1",
        ],
        [
            "block dimensions",
            "name nrow",
            "type integer",
            "reader urword",
            "optional false",
            "default 2",
        ],
        [
            "block dimensions",
            "name ncol",
            "type integer",
            "reader urword",
            "optional false",
            "default 2",
        ],
        [
            "block griddata",
            "name delr",
            "type double precision",
            "shape (ncol)",
            "reader readarray",
            "netcdf true",
            "default 1.0",
        ],
        [
            "block griddata",
            "name delc",
            "type double precision",
            "shape (nrow)",
            "reader readarray",
            "netcdf true",
            "default 1.0",
        ],
        [
            "block griddata",
            "name top",
            "type double precision",
            "shape (ncol, nrow)",
            "reader readarray",
            "netcdf true",
            "default 1.0",
        ],
        [
            "block griddata",
            "name botm",
            "type double precision",
            "shape (ncol, nrow, nlay)",
            "reader readarray",
            "layered true",
            "netcdf true",
            "default 0.",
        ],
        [
            "block griddata",
            "name idomain",
            "type integer",
            "shape (ncol, nrow, nlay)",
            "reader readarray",
            "layered true",
            "netcdf true",
            "optional true",
        ],
    ]

    def __init__(
        self,
        model,
        loading_package=False,
        length_units=None,
        nogrb=None,
        grb_filerecord=None,
        xorigin=None,
        yorigin=None,
        angrot=None,
        export_array_ascii=None,
        export_array_netcdf=None,
        packagedata=None,
        nlay=1,
        nrow=2,
        ncol=2,
        delr=1.0,
        delc=1.0,
        top=1.0,
        botm=0.0,
        idomain=None,
        filename=None,
        pname=None,
        **kwargs,
    ):
        """Initialize ModflowGwfdis."""
        super().__init__(
            parent=model,
            package_type="dis",
            filename=filename,
            pname=pname,
            loading_package=loading_package,
            **kwargs,
        )

        self.length_units = self.build_mfdata("length_units", length_units)
        self.nogrb = self.build_mfdata("nogrb", nogrb)
        self.grb_filerecord = self.build_mfdata("grb_filerecord", grb_filerecord)
        self.xorigin = self.build_mfdata("xorigin", xorigin)
        self.yorigin = self.build_mfdata("yorigin", yorigin)
        self.angrot = self.build_mfdata("angrot", angrot)
        self.export_array_ascii = self.build_mfdata(
            "export_array_ascii", export_array_ascii
        )
        self.export_array_netcdf = self.build_mfdata(
            "export_array_netcdf", export_array_netcdf
        )
        self._ncf_filerecord = self.build_mfdata("ncf_filerecord", None)
        self._ncf_package = self.build_child_package(
            "ncf", packagedata, "packagedata", self._ncf_filerecord
        )
        self.nlay = self.build_mfdata("nlay", nlay)
        self.nrow = self.build_mfdata("nrow", nrow)
        self.ncol = self.build_mfdata("ncol", ncol)
        self.delr = self.build_mfdata("delr", delr)
        self.delc = self.build_mfdata("delc", delc)
        self.top = self.build_mfdata("top", top)
        self.botm = self.build_mfdata("botm", botm)
        self.idomain = self.build_mfdata("idomain", idomain)

        self._init_complete = True
