The MODFLOW-2005 to 6 Module¶
Code for converting MODFLOW-2005 style SFR Package input to MODFLOW-6 style SFR package input.
- class sfrmaker.mf5to6.Mf6SFR(ModflowSfr2=None, SFRData=None, period_data=None, idomain=None, options=None, auxiliary_line_numbers=True)[source]¶
Bases:
object
Class for writing MODFLOW-6 SFR package input from a (MODFLOW-2005 style) flopy.modflow.ModflowSfr2 instance or an sfrmaker.SFRData instance.
- Parameters:
- ModflowSfr2flopy.modflow.ModflowSfr2 instance, optional
Input SFR dataset
- SFRDatasfrmaker.SFRData instance, optional
Input SFR dataset
- period_dataDataFrame, optional
DataFrame of MODFLOW-6-style stress period data, as made by
SFRData.add_to_perioddata()
. Only needed if SFRData isn’t supplied, by default None- idomainndarray, optional
3D numpy array designating active cells (idomain==1). SFR reaches in inactive cells will be written with ‘none’ in the cellid field. by default None
- optionslist, optional
List of strings to write to the MODFLOW-6 SFR options block. For example:
options=['save_flows', 'BUDGET FILEOUT model.sfr.cbc', 'STAGE FILEOUT model.sfr.stage.bin']
An appropriate unit_conversion is written by default. See MODFLOW-6 documentation for other options. By default None.
- auxiliary_line_numbersbool, optional
If true, add ‘line_id’ as an auxiliary variable to the options block and write hydrography line IDs to the packagedata block in the auxiliary ‘line_id’ column, by default True.
- cols = ['rno', 'cellid', 'k', 'i', 'j', 'rlen', 'rwid', 'rgrd', 'rtp', 'rbth', 'rhk', 'man', 'ncon', 'ustrf', 'ndv', 'idomain', 'line_id']¶
- property connections¶
- property graph_r¶
- mf5names = {'cellid': 'node', 'depth1': 'depth1', 'depth2': 'depth2', 'evaporation': 'etsw', 'inflow': 'flow', 'man': 'roughch', 'rainfall': 'pptsw', 'rbth': 'strthick', 'rgrd': 'slope', 'rhk': 'strhc1', 'rlen': 'rchlen', 'rno': 'rno', 'rtp': 'strtop', 'runoff': 'runoff'}¶
- mf6names = {'depth1': 'depth1', 'depth2': 'depth2', 'etsw': 'evaporation', 'flow': 'inflow', 'node': 'cellid', 'pptsw': 'rainfall', 'rchlen': 'rlen', 'rno': 'rno', 'roughch': 'man', 'runoff': 'runoff', 'slope': 'rgrd', 'strhc1': 'rhk', 'strthick': 'rbth', 'strtop': 'rtp'}¶
- property options_block¶
- property packagedata¶
- property period_data¶
- write_file(filename=None, outpath='', options=None, external_files_path=None)[source]¶
Write a MODFLOW-6 format SFR package file.
- Parameters:
- filenamestr, optional
SFR package filename. Default setting is to use the ModflowSfr2.file_name attribute for the ModflowSfr2 instance entered on init of the Mf6SFR class, by default None.
- outpathstr, optional
Path to write sfr file (with ModflowSfr2.file_name) to. Usually this is the simulation workspace. Only used if filename is None.
- optionslist, optional
List of strings to write to the MODFLOW-6 SFR options block. For example:
options=['save_flows', 'BUDGET FILEOUT model.sfr.cbc', 'STAGE FILEOUT model.sfr.stage.bin']
An appropriate unit_conversion is written by default. See MODFLOW-6 documentation for other options. By default None.
- external_files_pathstr, optional
Path for writing an external file for packagedata, relative to the location of the SFR package file. If specified, an open/close statement referencing the file is written to the packagedata block. By default, None (packagedata table is written to the SFR package file)
- Raises:
- OSError
If an invalid external_files_path is specified.
- sfrmaker.mf5to6.cellids_to_kij(cellids, drop_inactive=True)[source]¶
Unpack tuples of MODFLOW-6 cellids (k, i, j) to lists of k, i, j values; ignoring instances where cellid is None (unconnected cells).
- Parameters:
- cellidssequence of (k, i, j) tuples
- drop_inactivebool
If True, drop cellids == ‘none’. If False, distribute these to k, i, j.
- Returns:
- k, i, j1D numpy arrays of integers