pywfm.IWFMModel#
- class pywfm.IWFMModel(preprocessor_file_name, simulation_file_name, has_routed_streams=1, is_for_inquiry=1, instantiate=True, delete_inquiry_data_file=True, log_file='message.log')#
IWFM Model Class for interacting with the IWFM API.
- Parameters:
preprocessor_file_name (str) – file path and name of the model preprocessor input file.
simulation_file_name (str) – file path and name of the model simulation input file.
has_routed_streams ({1 or 0}, default 1) – If 1: model has routed streams. If 0: does not have routed streams.
is_for_inquiry ({1 or 0}, default 1) –
Options for instantiating model.
1: model is instantiated for inquiry.
0: model is instantiated for simulations.
instantiate (bool, default True) – flag to instantiate the model object
delete_inquiry_data_file (bool, default True) – flag to delete inquiry data file, if it exists
log_file (str, default 'message.log') – name of the file used for logging simulation messages
- Returns:
instance of the IWFMModel class and access to the IWFM Model Object fortran procedures.
- Return type:
IWFMModel Object
- __init__(preprocessor_file_name, simulation_file_name, has_routed_streams=1, is_for_inquiry=1, instantiate=True, delete_inquiry_data_file=True, log_file='message.log')#
Methods
__init__
(preprocessor_file_name, ...[, ...])advances the state of the hydrologic system in time (e.g. groundwater heads at current timestep are switched to groundwater heads at previous timestep) during a model run.
advances the simulation time step by one simulation time step
deletes the binary file, IW_ModelData_ForInquiry.bin, generated by the IWFM DLL when the Model Object is instantiated
fe_interpolate
(x, y)Return interpolation coefficients for converting nodal properties to x,y-coordinates within an element
Return actual diversion amounts for a list of diversions during a model simulation
Return the supply shortage for agricultural diversions at the destination of those supplies plus any conveyance losses
Return the supply shortage for agricultural element pumping at the destination of those supplies plus any conveyance losses
Return the supply shortage for agricultural wells at the destination of those supplies plus any conveyance losses
Return the aquifer bottom elevations for each finite element node and each layer
Return the aquifer horizontal hydraulic conductivity for each finite element node and each layer
Return all aquifer parameters at each model node and layer
Return the aquifer specific storage for each finite element node and each layer
Return the aquifer specific yield for each finite element node and each layer
Return the aquifer top elevations for each finite element node and each layer
get_aquifer_transmissivity
()Return the transmissivity of each model aquifer layer
Return the aquifer vertical hydraulic conductivity for each finite element node and each layer
Return the aquitard vertical hydraulic conductivity for each finite element node and each layer
get_boundary_nodes
([subregions, ...])Return nodes that make up the boundary of an IWFM model
get_bypass_export_nodes
(bypass_list)Return the stream node IDs corresponding to bypass locations
get_bypass_exports_destinations
(bypass_list)Return stream node IDs and destination types and IDS where bypass flows are delivered.
Return the bypass identification numbers specified in an IWFM model
get_bypass_nonrecoverable_loss_factor
(bypass_id)Return the nonrecoverable loss factor for a bypass
get_bypass_outflows
([bypass_conversion_factor])Return the bypass outflows for the current simulation timestep
get_bypass_recoverable_loss_factor
(bypass_id)Return the recoverable loss factor for a bypass
Return the current simulation date and time.
get_depth_to_water
(layer_number[, ...])calculates a depth to water for an IWFM model layer for all dates between the provided start date and end date.
Return the surface water diversion identification numbers specified in an IWFM model
get_diversion_purpose
([diversions])Return the flags for the initial purpose of the diversions as ag, urban, or both
Return the IDs for the downstream stream node in each stream reach
get_element_areas
()Return the area of each element in an IWFM model
get_element_config
(element_id)Return an array of node ids for an IWFM element.
Return an array of element ids in an IWFM model
Return element configuration information for all elements in an IWFM model
Return the element pump IDs specified in an IWFM model
get_element_pump_purpose
([element_pumps])Return the flags for the initial purpose of the element pumping as ag, urban, or both
Return element configuration information including x-y coordinates for nodes
get_elements_in_lake
(lake_id)Return the element ids with the specified lake ID
Return the ground surface elevation for each node specified in the IWFM model
get_groundwater_hydrograph
(...[, ...])Return the simulated groundwater hydrograph for the provided groundwater hydrograph ID
Return a simulated groundwater hydrograph for a node and layer
Return the x,y-coordinates for the groundwater hydrographs specified in an IWFM model
Return the ids for the groundwater hydrographs specified in an IWFM model
Return model information for the groundwater hydrographs, including hydrograph ID, x- and y- coordinates, name, and stratigraphy.
Return the groundwater hydrograph location names specified in an IWFM model
get_gwheads_all
([end_of_timestep, ...])Return the groundwater heads at all nodes in every aquifer layer for the current simulation time step
get_gwheads_foralayer
(layer_number[, ...])Return the simulated groundwater heads for a single user-specified model layer for every model node over a user-specified time interval.
Return a list of different hydrograph types being printed by the IWFM model
Return an array of lake IDs in an IWFM model
get_land_use_type_id_urban_indoor
()get_land_use_type_id_urban_outdoor
()get_land_use_type_ids_1
()the error message in case a procedure call from IWFM API returns an error code (status) other than 0
get_location_type_id_bypass
()get_location_type_id_diversion
()get_location_type_ids_1
()get_model_stratigraphy
()Return the model stratigraphy as provided in stratigraphy input file
Return the number of agricultural crops simulated in an IWFM model
Return the number of bypasses in an IWFM model
Return the number of surface water diversions in an IWFM model
Return the number of element pumps simulated in an IWFM model
Return the number of elements in an IWFM model
get_n_elements_in_lake
(lake_id)Return the number of finite element grid cells that make up a lake
Return the number of groundwater hydrographs specified in an IWFM model
Return the number of different hydrograph types being printed by the IWFM model
get_n_intervals
(begin_date, end_date, ...[, ...])returns the number of time intervals between a provided start date and end date
Return the number of lakes in an IWFM model
Return the number of layers in an IWFM model
Return the number of nodes in an IWFM model
get_n_nodes_in_stream_reach
(reach_id)Return the number of stream nodes in a stream reach
get_n_rating_table_points
(stream_node_id)Return the number of data points in the stream flow rating table for a stream node
get_n_reaches_upstream_of_reach
(reach_id)Return the number of stream reaches immediately upstream of the specified reach
Return the number of small watersheds specified in an IWFM model
Return the number of stream flow hydrographs specified in an IWFM model
Return the number of stream boundary inflows specified by the user as timeseries input data
Return the number of stream nodes in an IWFM model
Return the number of stream nodes immediately upstream of the provided stream node id
Return the number of stream reaches in an IWFM model
Return the number of subregions in an IWFM model
Return the number of subsidence hydrographs specified in an IWFM model
Return the number of tile drain hydrographs specified in an IWFM model
Return the number of tile drain nodes in an IWFM model
Return the number of timesteps in an IWFM simulation
Return the number of wells simulated in an IWFM model
get_net_bypass_inflows
([...])Return net bypass inflows for every stream node for the current timestep
Return the x,y coordinates of the nodes in an IWFM model
Return an array of node ids in an IWFM model
Return node id, x-, and y-coordinates for each node in an IWFM model
Return a list of the possible time intervals a selected time-series data can be retrieved at.
Return the destination index that each stream reach flows into.
Return the outflow destination types that each stream reach flows into.
get_reaches_upstream_of_reach
(reach_id)Return the IDs of the reaches that are immediately upstream of the specified reach
Return the small watershed identification numbers specified in the IWFM model
get_stratigraphy_atXYcoordinate
(x, y[, ...])Return the stratigraphy at given X,Y coordinates
Return the stream channel bottom elevation at each stream node
get_stream_diversion_elements
(diversion_id)Return the element IDs where water is provided by diversion
Return the stream node IDs corresponding to diversion locations
get_stream_diversion_n_elements
(diversion_id)Return number of elements that are provided water by the specified diversion
get_stream_flow_at_location
(stream_node_id)Return stream flow at a stream node for the current time step in a simulation
get_stream_flows
([flow_conversion_factor])Return stream flows at every stream node for the current timestep
Return gain from groundwater for every stream node for the current timestep
get_stream_gain_from_lakes
([...])Return gain from lakes for every stream node for the current timestep
get_stream_hydrograph
(stream_hydrograph_id)Return the simulated stream hydrograph for the provided stream hydrograph id
Return the x,y-coordinates for the stream flow observation locations specified in an IWFM model
Return the ids for the stream hydrographs specified in an IWFM model
Return the stream flow hydrograph location names specified in an IWFM model
Return the identification numbers for the stream boundary inflows specified by the user as timeseries input data
Return the stream node IDs that receive boundary inflows specified by the user as timeseries input data
Return stream boundary inflows at a specified set of inflow locations listed by their indices for the current simulation timestep
Return the stream nodes and groundwater nodes for every reach in an IWFM model
Return an array of stream node IDs in the IWFM model
Return an array of the stream node ids immediately upstream of the provided stream node id
get_stream_pond_drains
([...])Return drainage from rice and refuge ponds into every stream node for the current timestep
get_stream_rainfall_runoff
([...])Return rainfall runoff at every stream node for the current timestep
get_stream_rating_table
(stream_node_id)Return the stream rating table for a specified stream node
get_stream_reach_groundwater_nodes
(reach_id)Return the groundwater node IDs corresponding to stream nodes in a specified reach
Return an array of stream reach IDs in an IWFM Model stream reaches in an IWFM model
Return the stream reach names specified in an IWFM model
get_stream_reach_stream_nodes
(reach_id)Return the stream node IDs corresponding to stream nodes in a specified reach
Return the stream reach IDs that correspond to one or more stream node IDs
get_stream_return_flows
([...])Return agricultural and urban return flows at every stream node for the current timestep
Return riparian evapotranspiration from every stream node for the current timestep
get_stream_stages
([stage_conversion_factor])Return stream stages at every stream node for the current timestep
get_stream_tile_drain_flows
([...])Return tile drain flows into every stream node for the current timestep
get_stream_tributary_inflows
([...])Return small watershed inflows at every stream node for the current timestep
Return subregional depth-to-groundwater values that are weighted-averaged with respect to agricultural pumping rates during a model run
Return an array of IDs for subregions identified in an IWFM model
get_subregion_name
(subregion_id)Return the name corresponding to the subregion_id in an IWFM model
Return the subregions names specified in an IWFM model
Return an array identifying the IWFM Model elements contained within each subregion.
get_subsidence_all
([...])Return the simulated subsidence at all nodes in every aquifer layer for the current simulation time step
get_subsidence_hydrograph
(...[, begin_date, ...])Return the simulated subsidence hydrograph for the provided subsidence hydrograph ID
Return the x,y-coordinates for the subsidence hydrograph locations specified in an IWFM model
Return the ids for the subsidence hydrographs specified in an IWFM model
Return the subsidence hydrograph location names specified in an IWFM model
Return the agricultural supply requirement for one or more model elements
Return the agricultural supply requirement for one or more model subregions
Return the urban supply requirement for one or more model elements
Return the urban supply requirement for one or more model subregions
Return the x,y-coordinates for the tile drain observations specified in an IWFM model
Return the ids for the tile drain hydrographs specified in an IWFM model
Return the user-specified IDs for tile drains simulated in an IWFM model
Return the node ids where tile drains are specified
Return the IWFM simulation dates and time step
Return the IDs for the upstream stream node in each stream reach
Return the supply shortage for urban diversions at the destination of those supplies plus any conveyance losses
Return the supply shortage for urban element pumping at the destination of those supplies plus any conveyance losses
Return the supply shortage for urban wells at the destination of those supplies plus any conveyance losses
returns the version of the IWFM DLL
get_well_coordinates
()Return the pumping well x- and y-coordinates
Return the pumping well IDs specified in an IWFM model
get_well_pumping_purpose
([wells])Return the flags for the initial purpose of the well pumping as ag, urban, or both
Return zonal depth-to-groundwater values that are weighted-averaged with respect to agricultural pumping rates during a model run
increment_time
(date_string, time_interval, ...)increments the date provided by the specified time interval
is_date_greater
(first_date, comparison_date)returns True if first_date is greater than comparison_date
check if the end of simulation period has been reached during a model run
check if a Model object is instantiated
is_stream_upstream_node
(stream_node_1, ...)checks if a specified stream node .is located upstream from another specified stream node within the stream network of the IWFM model
kill
()Terminate the IWFM Model Object.
prints the last error message (generated when a procedure call from IWFM API returns an error code (status) other than 0) to the message log file
new
()Instantiate the IWFM Model Object.
order_boundary_nodes
(in_boundary_nodes, ...)takes an unordered dataframe with two columns of node ids and orders them such that the start id of the next is equal to the end id of the previous.
plot_elements
(axes[, values, cmap, ...])plots model elements on predefined axes
plot_nodes
(axes[, values, cmap, ...])plots model nodes on predefined axes
prints out all the simulation results at the end of a simulation
reads in all of the time series data for the current simulation time step
reads time series data for the current simulation time step and allows overwriting certain time series data
restores the pumping rates to the values read from the Pumping Rate input file during a model run.
set_log_file
([file_name])opens a text log file to print out error and warning messages
set_preprocessor_path
(preprocessor_path)sets the path to the directory where the preprocessor main input file is located
set_simulation_path
(simulation_path)sets the path to the directory where the simulation main input file is located
sets the maximum number of iterations that will be used in automatic supply adjustment
set_supply_adjustment_tolerance
(tolerance)sets the tolerance, given as a fraction of the water demand that will be used in automatic supply adjustment
performs all of the computations for the entire simulation period
simulate_for_an_interval
(time_interval)simulates the model application for a specified time interval
simulates a single timestep of the model application
turns the automatic supply adjustment of diversions and pumping to meet agricultural and/or urban water demands on or off during a model run