Working with GSFLOW control file parameters¶
This tutorial shows how to access, edit, remove, and add new control file parameters and packages to a GSFLOW model using pyGSFLOW
[1]:
# Package import
import os
import gsflow
Load a demonstration model¶
[2]:
model_ws = os.path.join("..", "..", "data", "sagehen", "gsflow")
[3]:
control_file = os.path.join(model_ws, "saghen_new_cont.control")
gsf = gsflow.GsflowModel.load_from_file(control_file)
Control file is loaded
Working on loading PRMS model ...
Prms model loading ...
------------------------------------
Reading parameter file : saghen_new_par_0.params
------------------------------------
Warning: ncascade data type will be infered from data supplied
Warning: ncascdgw data type will be infered from data supplied
Warning: ndays data type will be infered from data supplied
Warning: ndepl data type will be infered from data supplied
Warning: ndeplval data type will be infered from data supplied
Warning: nevap data type will be infered from data supplied
Warning: ngw data type will be infered from data supplied
Warning: ngwcell data type will be infered from data supplied
Warning: nhru data type will be infered from data supplied
Warning: nhrucell data type will be infered from data supplied
Warning: nlake data type will be infered from data supplied
Warning: nlake_hrus data type will be infered from data supplied
Warning: nmonths data type will be infered from data supplied
Warning: nobs data type will be infered from data supplied
Warning: nrain data type will be infered from data supplied
Warning: nreach data type will be infered from data supplied
Warning: nsegment data type will be infered from data supplied
Warning: nsnow data type will be infered from data supplied
Warning: nsol data type will be infered from data supplied
Warning: nssr data type will be infered from data supplied
Warning: nsub data type will be infered from data supplied
Warning: ntemp data type will be infered from data supplied
Warning: one data type will be infered from data supplied
------------------------------------
Reading parameter file : saghen_new_par_1.params
------------------------------------
------------------------------------
Reading parameter file : saghen_new_par_2.params
------------------------------------
------------------------------------
Reading parameter file : saghen_new_par_3.params
------------------------------------
PRMS model loaded ...
Working on loading MODFLOW files ....
loading iuzfbnd array...
loading irunbnd array...
loading vks array...
loading eps array...
loading thts array...
stress period 1:
loading finf array...
stress period 2:
MODFLOW files are loaded ...
Accessing the ControlFile object¶
[4]:
control = gsf.control
Getting parameter values from the ControlFile object¶
The get_values()
method allows the user to get a list of parameter values
[5]:
csv_out = control.get_values("csv_output_file")
Adjusting parameter values¶
The set_values()
method allows the user to adjust control file parameter values
[6]:
csv_out = "gsflow_example.csv"
control.set_values("csv_output_file", [csv_out,])
Removing a parameter¶
The remove_record()
method will remove a parameter value from the ControlFile object
[7]:
control.remove_record("csv_output_file")
Adding a new parameter¶
The add_record()
method allows users to add new records to the ControlFile object.
[8]:
csv_out = "gsflow_example.csv"
control.add_record("csv_output_file", [csv_out,])
Warning: csv_output_file data type will be infered from data supplied