def read_basin_indices(path, minimum_accumulated_cells = -1): result = [] nc = Dataset(path) for k, v in nc.variables.iteritems(): result.append(BasinIndices(k, v.data)) #select only cells with the number of previous cells bigger than minimum_accumulated_cells if minimum_accumulated_cells > 0: basins = infocell.get_basins_with_cells_connected_using_hydrosheds_data() for basin in basins: for basin_index in result: if basin.name == basin_index.name: the_basin_index = basin_index break for the_cell in basin.cells: # @type the_cell Cell acc_cells = the_cell.calculate_number_of_upstream_cells() if acc_cells < minimum_accumulated_cells: the_basin_index.mask[the_cell.x, the_cell.y] = 0 return result pass
def plot_mean_hydrograph_with_gw_ouflow(data_path = 'data/streamflows/hydrosheds_euler10_spinup100yrs'): #TODO: Implement basins = infocell.get_basins_with_cells_connected_using_hydrosheds_data() basinName = 'RDO' theBasin = None for basin in basins: # @type basin Basin if basin.name == basinName: theBasin = basin break data = data_select.get_data_from_file(path = data_path, field_name = 'gw_outflow') gw_outflow = data[0] times = data[1] x_index = data[2] y_index = data[3] data = data_select.get_data_from_file(path = data_path, field_name = 'surface_runoff') surface_runoff = data[0] for t in times: pass