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, ...[, ...])

advance_state()

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.

advance_time()

advances the simulation time step by one simulation time step

close_log_file()

delete_inquiry_data_file()

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

get_actual_stream_diversions_at_some_locations([...])

Return actual diversion amounts for a list of diversions during a model simulation

get_ag_diversion_supply_shortage_at_origin([...])

Return the supply shortage for agricultural diversions at the destination of those supplies plus any conveyance losses

get_ag_elempump_supply_shortage_at_origin([...])

Return the supply shortage for agricultural element pumping at the destination of those supplies plus any conveyance losses

get_ag_well_supply_shortage_at_origin([...])

Return the supply shortage for agricultural wells at the destination of those supplies plus any conveyance losses

get_aquifer_bottom_elevation()

Return the aquifer bottom elevations for each finite element node and each layer

get_aquifer_horizontal_k()

Return the aquifer horizontal hydraulic conductivity for each finite element node and each layer

get_aquifer_parameters()

Return all aquifer parameters at each model node and layer

get_aquifer_specific_storage()

Return the aquifer specific storage for each finite element node and each layer

get_aquifer_specific_yield()

Return the aquifer specific yield for each finite element node and each layer

get_aquifer_top_elevation()

Return the aquifer top elevations for each finite element node and each layer

get_aquifer_transmissivity()

Return the transmissivity of each model aquifer layer

get_aquifer_vertical_k()

Return the aquifer vertical hydraulic conductivity for each finite element node and each layer

get_aquitard_vertical_k()

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_budget_type_ids()

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.

get_bypass_ids()

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

get_current_date_and_time()

Return the current simulation date and time.

get_data_unit_type_id_area()

get_data_unit_type_id_length()

get_data_unit_type_ids()

get_data_unit_type_volume()

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.

get_diversion_ids()

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

get_downstream_node_in_stream_reaches()

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.

get_element_ids()

Return an array of element ids in an IWFM model

get_element_info()

Return element configuration information for all elements in an IWFM model

get_element_pump_ids()

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

get_element_spatial_info()

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

get_flow_destination_type_id()

get_flow_destination_type_id_element()

get_flow_destination_type_id_elementset()

get_flow_destination_type_id_gwelement()

get_flow_destination_type_id_lake()

get_flow_destination_type_id_outside()

get_flow_destination_type_id_streamnode()

get_flow_destination_type_id_subregion()

get_ground_surface_elevation()

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

get_groundwater_hydrograph_at_node_and_layer(...)

Return a simulated groundwater hydrograph for a node and layer

get_groundwater_hydrograph_coordinates()

Return the x,y-coordinates for the groundwater hydrographs specified in an IWFM model

get_groundwater_hydrograph_ids()

Return the ids for the groundwater hydrographs specified in an IWFM model

get_groundwater_hydrograph_info()

Return model information for the groundwater hydrographs, including hydrograph ID, x- and y- coordinates, name, and stratigraphy.

get_groundwater_hydrograph_names()

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.

get_hydrograph_type_list()

Return a list of different hydrograph types being printed by the IWFM model

get_lake_ids()

Return an array of lake IDs in an IWFM model

get_land_use_type_id_gen_ag()

get_land_use_type_id_native_riparian()

get_land_use_type_id_nonponded_ag()

get_land_use_type_id_refuge()

get_land_use_type_id_rice()

get_land_use_type_id_urban()

get_land_use_type_id_urban_indoor()

get_land_use_type_id_urban_outdoor()

get_land_use_type_ids()

get_land_use_type_ids_1()

get_last_message()

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_id_element()

get_location_type_id_gwheadobs()

get_location_type_id_lake()

get_location_type_id_node()

get_location_type_id_smallwatershed()

get_location_type_id_streamhydobs()

get_location_type_id_streamnode()

get_location_type_id_streamnodebud()

get_location_type_id_streamreach()

get_location_type_id_subregion()

get_location_type_id_subsidenceobs()

get_location_type_id_tiledrainobs()

get_location_type_id_zone()

get_location_type_ids()

get_location_type_ids_1()

get_model_stratigraphy()

Return the model stratigraphy as provided in stratigraphy input file

get_n_ag_crops()

Return the number of agricultural crops simulated in an IWFM model

get_n_bypasses()

Return the number of bypasses in an IWFM model

get_n_diversions()

Return the number of surface water diversions in an IWFM model

get_n_element_pumps()

Return the number of element pumps simulated in an IWFM model

get_n_elements()

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

get_n_groundwater_hydrographs()

Return the number of groundwater hydrographs specified in an IWFM model

get_n_hydrograph_types()

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

get_n_lakes()

Return the number of lakes in an IWFM model

get_n_layers()

Return the number of layers in an IWFM model

get_n_nodes()

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

get_n_small_watersheds()

Return the number of small watersheds specified in an IWFM model

get_n_stream_hydrographs()

Return the number of stream flow hydrographs specified in an IWFM model

get_n_stream_inflows()

Return the number of stream boundary inflows specified by the user as timeseries input data

get_n_stream_nodes()

Return the number of stream nodes in an IWFM model

get_n_stream_nodes_upstream_of_stream_node(...)

Return the number of stream nodes immediately upstream of the provided stream node id

get_n_stream_reaches()

Return the number of stream reaches in an IWFM model

get_n_subregions()

Return the number of subregions in an IWFM model

get_n_subsidence_hydrographs()

Return the number of subsidence hydrographs specified in an IWFM model

get_n_tile_drain_hydrographs()

Return the number of tile drain hydrographs specified in an IWFM model

get_n_tile_drains()

Return the number of tile drain nodes in an IWFM model

get_n_time_steps()

Return the number of timesteps in an IWFM simulation

get_n_wells()

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

get_node_coordinates()

Return the x,y coordinates of the nodes in an IWFM model

get_node_ids()

Return an array of node ids in an IWFM model

get_node_info()

Return node id, x-, and y-coordinates for each node in an IWFM model

get_output_interval()

Return a list of the possible time intervals a selected time-series data can be retrieved at.

get_reach_outflow_destination()

Return the destination index that each stream reach flows into.

get_reach_outflow_destination_types()

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

get_small_watershed_ids()

Return the small watershed identification numbers specified in the IWFM model

get_stratigraphy_atXYcoordinate(x, y[, ...])

Return the stratigraphy at given X,Y coordinates

get_stream_bottom_elevations()

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

get_stream_diversion_locations([...])

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

get_stream_gain_from_groundwater([...])

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

get_stream_hydrograph_coordinates()

Return the x,y-coordinates for the stream flow observation locations specified in an IWFM model

get_stream_hydrograph_ids()

Return the ids for the stream hydrographs specified in an IWFM model

get_stream_hydrograph_names()

Return the stream flow hydrograph location names specified in an IWFM model

get_stream_inflow_ids()

Return the identification numbers for the stream boundary inflows specified by the user as timeseries input data

get_stream_inflow_nodes()

Return the stream node IDs that receive boundary inflows specified by the user as timeseries input data

get_stream_inflows_at_some_locations([...])

Return stream boundary inflows at a specified set of inflow locations listed by their indices for the current simulation timestep

get_stream_network()

Return the stream nodes and groundwater nodes for every reach in an IWFM model

get_stream_node_ids()

Return an array of stream node IDs in the IWFM model

get_stream_nodes_upstream_of_stream_node(...)

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

get_stream_reach_ids()

Return an array of stream reach IDs in an IWFM Model stream reaches in an IWFM model

get_stream_reach_names()

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

get_stream_reaches_for_stream_nodes([...])

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

get_stream_riparian_evapotranspiration([...])

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

get_subregion_ag_pumping_average_depth_to_water()

Return subregional depth-to-groundwater values that are weighted-averaged with respect to agricultural pumping rates during a model run

get_subregion_ids()

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

get_subregion_names()

Return the subregions names specified in an IWFM model

get_subregions_by_element()

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

get_subsidence_hydrograph_coordinates()

Return the x,y-coordinates for the subsidence hydrograph locations specified in an IWFM model

get_subsidence_hydrograph_ids()

Return the ids for the subsidence hydrographs specified in an IWFM model

get_subsidence_hydrograph_names()

Return the subsidence hydrograph location names specified in an IWFM model

get_supply_requirement_ag_elements([...])

Return the agricultural supply requirement for one or more model elements

get_supply_requirement_ag_subregions([...])

Return the agricultural supply requirement for one or more model subregions

get_supply_requirement_urban_elements([...])

Return the urban supply requirement for one or more model elements

get_supply_requirement_urban_subregions([...])

Return the urban supply requirement for one or more model subregions

get_supply_type_id_diversion()

get_supply_type_id_elempump()

get_supply_type_id_well()

get_tile_drain_hydrograph_coordinates()

Return the x,y-coordinates for the tile drain observations specified in an IWFM model

get_tile_drain_hydrograph_ids()

Return the ids for the tile drain hydrographs specified in an IWFM model

get_tile_drain_ids()

Return the user-specified IDs for tile drains simulated in an IWFM model

get_tile_drain_nodes()

Return the node ids where tile drains are specified

get_time_specs()

Return the IWFM simulation dates and time step

get_upstream_nodes_in_stream_reaches()

Return the IDs for the upstream stream node in each stream reach

get_urban_diversion_supply_shortage_at_origin([...])

Return the supply shortage for urban diversions at the destination of those supplies plus any conveyance losses

get_urban_elempump_supply_shortage_at_origin([...])

Return the supply shortage for urban element pumping at the destination of those supplies plus any conveyance losses

get_urban_well_supply_shortage_at_origin([...])

Return the supply shortage for urban wells at the destination of those supplies plus any conveyance losses

get_version()

returns the version of the IWFM DLL

get_well_coordinates()

Return the pumping well x- and y-coordinates

get_well_ids()

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

get_zbudget_type_ids()

get_zone_ag_pumping_average_depth_to_water(...)

Return zonal depth-to-groundwater values that are weighted-averaged with respect to agricultural pumping rates during a model run

get_zone_extent_id_horizontal()

get_zone_extent_id_vertical()

get_zone_extent_ids()

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

is_end_of_simulation()

check if the end of simulation period has been reached during a model run

is_model_instantiated()

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.

log_last_message()

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

print_results()

prints out all the simulation results at the end of a simulation

read_timeseries_data()

reads in all of the time series data for the current simulation time step

read_timeseries_data_overwrite(...)

reads time series data for the current simulation time step and allows overwriting certain time series data

restore_pumping_to_read_values()

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

set_supply_adjustment_max_iterations(...)

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

simulate_all()

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

simulate_for_one_timestep()

simulates a single timestep of the model application

turn_supply_adjustment_on_off(...)

turns the automatic supply adjustment of diversions and pumping to meet agricultural and/or urban water demands on or off during a model run