Closed MAXIMUM950814 closed 2 years ago
TypeError Traceback (most recent call last) ~\AppData\Local\Temp/ipykernel_27080/1699484629.py in ----> 1 data['LONCOL'],data['LATCOL'] = tbd.GPS_to_grids(data['longitude'],data['latitude'],params)
D:\anaconda3\envs\pytorch\lib\site-packages\transbigdata\grids.py in GPS_to_grids(*args, kwargs) 1227 def GPS_to_grids(*args, *kwargs): 1228 warnings.warn("This method is renamed as transbigdata.GPS_to_grid") -> 1229 return GPS_to_grid(args, kwargs) 1230 1231
D:\anaconda3\envs\pytorch\lib\site-packages\transbigdata\grids.py in GPS_to_grid(lon, lat, params) 240 method = params['method'] 241 if method == 'rect': --> 242 loncol, latcol = GPS_to_grids_rect(lon, lat, params) 243 return [loncol, latcol] 244 if method == 'tri':
D:\anaconda3\envs\pytorch\lib\site-packages\transbigdata\grids.py in GPS_to_grids_rect(lon, lat, params, from_origin) 814 coords = coords - (np.array([lonStart, latStart])) 815 else: --> 816 coords = coords - (np.array([lonStart, latStart]) - R[0, :] / 2 - 817 R[1, :] / 2) 818 res = np.floor(np.dot(coords, np.linalg.inv(R)))
TypeError: unsupported operand type(s) for -: 'str' and 'float'
Make sure that longitude and latitude are float type before doing the visualization
longitude
latitude
data['longitude']=data['longitude'].astype('float') data['latitude']=data['latitude'].astype('float')
TypeError Traceback (most recent call last) ~\AppData\Local\Temp/ipykernel_27080/1699484629.py in
----> 1 data['LONCOL'],data['LATCOL'] = tbd.GPS_to_grids(data['longitude'],data['latitude'],params)
D:\anaconda3\envs\pytorch\lib\site-packages\transbigdata\grids.py in GPS_to_grids(*args, kwargs) 1227 def GPS_to_grids(*args, *kwargs): 1228 warnings.warn("This method is renamed as transbigdata.GPS_to_grid") -> 1229 return GPS_to_grid(args, kwargs) 1230 1231
D:\anaconda3\envs\pytorch\lib\site-packages\transbigdata\grids.py in GPS_to_grid(lon, lat, params) 240 method = params['method'] 241 if method == 'rect': --> 242 loncol, latcol = GPS_to_grids_rect(lon, lat, params) 243 return [loncol, latcol] 244 if method == 'tri':
D:\anaconda3\envs\pytorch\lib\site-packages\transbigdata\grids.py in GPS_to_grids_rect(lon, lat, params, from_origin) 814 coords = coords - (np.array([lonStart, latStart])) 815 else: --> 816 coords = coords - (np.array([lonStart, latStart]) - R[0, :] / 2 - 817 R[1, :] / 2) 818 res = np.floor(np.dot(coords, np.linalg.inv(R)))
TypeError: unsupported operand type(s) for -: 'str' and 'float'