Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def soil(data, xinds, yinds, soil_file):
"""Write VIC formatted soil parameter file"""
c = grid_params.cols(nlayers=3)
f = grid_params.format(nlayers=3)
arrayshape = (len(xinds), 1 + np.max([np.max(c.soil_param[var])
for var in c.soil_param]))
soil_params = np.zeros(arrayshape)
dtypes = [0] * arrayshape[1]
for var in c.soil_param:
if data[var].ndim == 2:
soil_params[:, c.soil_param[var]] = np.atleast_2d(
data[var][yinds, xinds]).transpose()
elif data[var].ndim == 3:
soil_params[:, c.soil_param[var]] = np.atleast_2d(
data[var][:, yinds, xinds]).transpose()
for col in c.soil_param[var]:
dtypes[col] = f.soil_param[var]