Hydrologic Projects
ESPAM2 Recharge Tools 1.5 Documentation
espam.gridutil
Utilities for working with ESPA Grid and Stress Periods
- class espam.gridutil.GridCentroid(row, col, x_coord, y_coord)
ESPA Model Grid Centroid
Representation of ESPA Model Grid centroid, contains coordinates and ESPA Model grid row and column information.
- espam.gridutil.build_grid_centroid(espa_grid_def, scratch_workspace, new_feature_class)
Create ESPA Grid Centroid feature class
Generates a point representation of the ESPA Grid in a new shapefile
- espam.gridutil.daterange(start_date, end_date)
A generator class used to determine all days between two dates
Parameters: - start_date – Starting date
- end_date (datetime) – Ending date
Yields : Generator – Days between start_date and end_date
- espam.gridutil.determine_feature_grid_relationships(name_field, row_field, col_field, name_list, feature_layer_name, grid_layer_name, database_file)
Build table of each ESPA Cell Each Feature Is Located In
- espam.gridutil.filter_stress_periods(stress_period_prefix, column_names)
Return list of stress period fields.
Filter list of column names by a stress period prefix, returning only the fields that begin with the stress period prefix. This process is not case sensitive.
Parameters: - stress_period_prefix (str) – The prefix to search column names for.
- column_names (List) – List of column names as strings
Returns: List of all fields with stress period prefix.
- espam.gridutil.generate_monthly_stress_periods(start_date, end_date)
Build a list of dicts keyed by stressperiod, year, and month Representing the unique months/years between two dates and the corresponding stress period index
The monthly stress period are inclusive to both the starting and ending date
Parameters: - start_date – Starting date
- end_date (datetime) – Ending date
Returns: List – List of dicts keyed by stressperiod,year, and month
>>> import datetime >>> start = datetime.date(1980, 1, 1) >>> end = datetime.date(1980, 2, 1) >>> print generate_monthly_stress_periods(start, end) [{'month': 1, 'stressperiod': 1, 'year': 1980}, {'month': 2, 'stressperiod': 2,'year': 1980}]
- espam.gridutil.get_max_stress_period(database_file)
The number of stress periods in the stress period table
- espam.gridutil.is_int(input_string)
Determine if input string is an integer or not
Parameters: input_string (str.) – The string to test whether if it is an it Returns: bool – True if input string is an integer
- espam.gridutil.max_stress_period_sql()
Get the SQL statement for the maximum Stress Period
- espam.gridutil.stress_period_create_sql()
Build CREATE TABLE statement for Stress Period Table
- espam.gridutil.stress_period_index_sql()
Build CREATE INDEX statement for Stress Period table
- espam.gridutil.stress_period_insert_sql(name, stress_period, stress, pest)
Generate insert SQL statement for Stress Period table