gsflow.builder.builder_utils Module

gsflow.builder.builder_utils.add_prms_date_columns_to_df(df, column)[source]

Method to add date columns for PRMS to a pandas dataframe

Parameters
dfpd.DataFrame
columnstr

date column name

Returns
pd.Dataframe
gsflow.builder.builder_utils.build_lut(f, dtype=<class 'int'>)[source]

Method to load a remap file into a lut

Parameters
fstr

file name

dtypetype

int or float type, defaults to int

Returns
dict
gsflow.builder.builder_utils.calculate_jensen_haise(dem, tmin_mean, tmax_mean)[source]

Method to calculate the Jensen Haise coefficient for PRMS

Parameters
demnp.ndarray
tmin_meannp.ndarray

list of monthly mean values for tmin

tmax_meannp.ndarray

array of monthly mean values for tmax

Returns
gsflow.prms.ParameterRecord object
gsflow.builder.builder_utils.carea_max(resampled_imperv)[source]

Method to set carea_max parameter

Parameters
resampled_impervnp.ndarray
Returns
gsflow.prms.ParameterRecord object
gsflow.builder.builder_utils.covden_sum(cov_resampled, lut)[source]

Method to associate resampled vegitation coverage to PRMS covden_sum

Parameters
cov_resamplednp.ndarray
lutdict
Returns
gsflow.prms.ParameterRecord object
gsflow.builder.builder_utils.covden_win(cov_resampled, lut)[source]

Method to associate resampled vegitation coverage to PRMS covden_win

Parameters
cov_resamplednp.ndarray
lutdict
Returns
gsflow.prms.ParameterRecord object
gsflow.builder.builder_utils.covtype(cov_resampled, lut)[source]

Method to associate resampled vegitation type to PRMS covtype

Parameters
cov_resamplednp.ndarray
lutdict
Returns
gsflow.prms.ParameterRecord object
gsflow.builder.builder_utils.d8_to_hru_aspect(flow_directions)[source]

Method to get cell aspect from a D8 flow accumulation array

Parameters
flow_directionsnp.ndarray

numpy array of flow directions

Returns
gsflow.prms.ParameterRecord object of aspect angles (0 - 360 deg)
gsflow.builder.builder_utils.d8_to_hru_slope(flow_directions, dem, xcenters, ycenters)[source]

Method to calculate slopes from a D8 flow accumulation array

Parameters
flow_directionsnp.ndarray

2d numpy array of flow directions

demnp.ndarray

2d numpy array of dem elevations

xcentersnp.ndarray

modelgrid x-centers

ycentersnp.ndarray

modelgrid y-centers

Returns
gsflow.prms.ParameterRecord object
gsflow.builder.builder_utils.ea(tempc)[source]

Method to calculate ea for Jensen Haise equation

Parameters
tempcnp.ndarray

monthly mean temperatures

Returns
np.ndarray
gsflow.builder.builder_utils.fahrenheit_to_celsius(deg_f, nodataval=-999.0)[source]

Method to convert fahrenheit to celsius

Parameters
deg_ffloat, np.ndarray
nodatavalfloat

value of nodata instances

Returns
float, np.ndarray
gsflow.builder.builder_utils.get_mean_monthly_from_df(df, column, nodataval=-999, temperature=False)[source]

Method to calculate mean monthly values from a dataframe

Parameters
dfpd.Dataframe
columnstr

data column name

nodatavalfloat

no data value (sets to nan when calculating

temperaturebool

boolean flag to indicate this is temperature (does not sum())

Returns
np.ndarray
gsflow.builder.builder_utils.hru_percent_imperv(resampled_imperv)[source]

Method to set hru_percent_imperv parameter

Parameters
resampled_impervnp.ndarray
Returns
gsflow.prms.ParameterRecord object
gsflow.builder.builder_utils.rad_trncf(covden_win)[source]

Method to calculate rad_trncf from the covden_win parameter values

Parameters
covden_winnp.ndarray
Returns
gsflow.prms.ParameterRecord object
gsflow.builder.builder_utils.rain_adj(resampled_ppt, mean_monthly_sta)[source]

Method to calculate rain_adj from a single station

Parameters
resampled_pptnp.ndarray
mean_monthly_stanp.ndarray
Returns
gsflow.prms.ParameterRecord object
gsflow.builder.builder_utils.root_depth(cov_resampled, lut)[source]

Method to get a rooting depth from cover type. This is an intermediate array used to calculate other parameters

Parameters
cov_resamplednp.ndarray
lutd
Returns
np.ndarray of rooting depths
gsflow.builder.builder_utils.slowcoef_lin(ksat, aspect, dx, dy)[source]

Method to calculate the slowcoef_lin parameter in prms

Parameters
ksatnp.ndarray
aspectnp.ndarray
dxfloat

grid dx dimension for a single cell

dyfloat

grid dy dimension for a single cell

Returns
gsflow.prms.ParameterRecord object
gsflow.builder.builder_utils.slowcoef_sq(ksat, aspect, sand, soil_moist_max, dx, dy)[source]

Method to calculate the slowcoef_lin parameter in prms

Parameters
ksatnp.ndarray
aspectnp.ndarray
sandnp.ndarray

fraction of sand in soil

soil_moist_maxnp.ndarray

soil moist max

dxfloat

grid dx dimension for a single cell

dyfloat

grid dy dimension for a single cell

Returns
gsflow.prms.ParameterRecord object
gsflow.builder.builder_utils.snow_adj(resampled_ppt, mean_monthly_sta)[source]

Method to calculate rain_adj from a single station

Parameters
resampled_pptnp.ndarray
mean_monthly_stanp.ndarray
Returns
gsflow.prms.ParameterRecord object
gsflow.builder.builder_utils.snow_intcp(cov_resampled, lut)[source]

Method to associate resampled vegitation type to PRMS snow_intcp

Parameters
cov_resamplednp.ndarray
lutdict
Returns
gsflow.prms.ParameterRecord object
gsflow.builder.builder_utils.soil_moist_init(soil_moist_max, factor=0.1)[source]

Method to calculate the soil_rech_init parameter

Parameters
soil_moist_maxnp.ndarray

maximum soil moisture water content

factorfloat

scaling factor

Returns
gsflow.prms.ParameterRecord object
gsflow.builder.builder_utils.soil_moist_max(awc, root_depth)[source]

Method to calculate the soil_moist_max parameter

Parameters
awcnp.ndarray

available water content

root_depthnp.ndarray
Returns
gsflow.prms.ParameterRecord object
gsflow.builder.builder_utils.soil_rech_init(soil_rech_max, factor=0.1)[source]

Method to calculate the soil_rech_init parameter

Parameters
soil_rech_maxnp.ndarray

maximum recharge water content

factorfloat

scaling factor

Returns
gsflow.prms.ParameterRecord object
gsflow.builder.builder_utils.soil_rech_max(awc, root_depth, max_depth=18)[source]

Method to calculate the soil_rech_max parameter

Parameters
awcnp.ndarray

available water content

root_depthnp.ndarray
max_depthfloat

maximum rooting depth to calculate recharge (default 18)

Returns
gsflow.prms.ParameterRecord object
gsflow.builder.builder_utils.soil_type(clay, sand)[source]

Method to determine soil type from resampled clay and sand percentages

Parameters
claynp.ndarray
sandnp.ndarray
Returns
gsflow.prms.ParameterRecord
gsflow.builder.builder_utils.srain_intcp(cov_resampled, lut)[source]

Method to associate resampled vegitation type to PRMS srain_intcp

Parameters
cov_resamplednp.ndarray
lutdict
Returns
gsflow.prms.ParameterRecord object
gsflow.builder.builder_utils.ssr2gw_exp(nhru)[source]

Method to calculate the ssr2gw_sq for PRMS

Parameters
nhruint
Returns
gsflow.prms.ParameterRecord object
gsflow.builder.builder_utils.ssr2gw_rate(ksat, sand, soil_moist_max)[source]

Method to calculate the ssr2gw_rate from ksat (inches/day) and % sand

Parameters
ksatnp.ndarray
sandnp.ndarray
soil_moist_maxnp.ndarray
Returns
gsflow.prms.ParameterRecord object
gsflow.builder.builder_utils.tmax_adj(nhru, nmonths=12)[source]

Method to calculate tmax_adj from a single station Parameters ———- nhru : int nmonths : np.ndarray Returns ——-

gsflow.prms.ParameterRecord object

gsflow.builder.builder_utils.tmax_lapse(lapse_rates)[source]

Method to calculate tmax_lapse parameter

Parameters
lapse_ratesnp.ndarray
Returns
gsflow.prms.ParameterRecord object
gsflow.builder.builder_utils.tmin_adj(nhru, nmonths=12)[source]

Method to calculate tmin_adj from a single station Parameters ———- nhru : int nmonths : np.ndarray Returns ——-

gsflow.prms.ParameterRecord object

gsflow.builder.builder_utils.tmin_lapse(lapse_rates)[source]

Method to calculate tmax_lapse parameter

Parameters
lapse_ratesnp.ndarray
Returns
gsflow.prms.ParameterRecord object
gsflow.builder.builder_utils.wrain_intcp(cov_resampled, lut)[source]

Method to associate resampled vegitation type to PRMS wrain_intcp

Parameters
cov_resamplednp.ndarray
lutdict
Returns
gsflow.prms.ParameterRecord object