def getWindGraph(dayIndex, startHour): windGraph = np.zeros((hourNum, xsize, ysize)) df = pd.read_csv(testTrueFile, chunksize=chunksize) df = jumpDays(df, dayIndex - 1, chunksize) for _ in range(startHour, hourNum): windGra = df.get_chunk(chunksize)["wind"] windGraph[_, :, :] = windGra.values.reshape(xsize, ysize).copy() return windGraph
def get_Wind_Rain_Graph(dayIndex): feasible = np.zeros((hourNum,xsize,ysize)) df = pd.read_csv(testTrueFile, chunksize = chunksize) df = jumpDays(df, dayIndex-1, chunksize) for _ in range(hourNum): wind_rain_Gra = df.get_chunk(chunksize)[["wind","rainfall"]] windGraph_j = wind_rain_Gra["wind"].values.reshape(xsize,ysize).copy() rainGraph_j = wind_rain_Gra["rainfall"].values.reshape(xsize,ysize).copy() feasible_j = np.zeros(windGraph_j.shape) feasible_j[(windGraph_j >= 15) | (rainGraph_j >= 4)] = 1 feasible[_,:,:] = feasible_j.copy() return feasible
xsize = 548 ysize = 421 maxDay = 5 maxCity = 10 chunksize = xsize * ysize df1 = pd.read_csv(file, chunksize=chunksize) block = [] windGraph = np.zeros((18, xsize, ysize)) fullScore = [] for dayNum in [3]: #range(1, maxDay + 1): df = pd.read_csv(file, chunksize=chunksize) df = jumpDays(df, dayNum - 1, chunksize) for _ in range(18): windGra = df.get_chunk(chunksize)["wind"] windGraph[_, :, :] = windGra.values.reshape(xsize, ysize).copy() for cityNum in [5]: #range(1, maxCity + 1): thre_wind = 15 height = 0 Pathinfo = Path_generator(windGraph, xCity[0], yCity[0], xCity[cityNum], yCity[cityNum], thre_wind, height) # # original algorithm ## Pathinfo = Path_design(windGraph, star_point, end_point, end_point, 0) # #updated algorithm # # try: