Download and process the Global Air Temperature dataset Parameters: norm_y = logical; should outcome be normalized norm_x = logical; should features be normalized coords_as_feats = logical; should lat/lon coordinates be added as features Return: c = spatial coordinates
(norm_y=True, norm_x=True, coords_as_feats=False)
| 76 | return c, x, y |
| 77 | |
| 78 | def get_air_temp_data(norm_y=True, norm_x=True, coords_as_feats=False): |
| 79 | ''' |
| 80 | Download and process the Global Air Temperature dataset |
| 81 | |
| 82 | Parameters: |
| 83 | norm_y = logical; should outcome be normalized |
| 84 | norm_x = logical; should features be normalized |
| 85 | coords_as_feats = logical; should lat/lon coordinates be added as features |
| 86 | |
| 87 | Return: |
| 88 | c = spatial coordinates (lon/lat) |
| 89 | x = features at location |
| 90 | y = outcome variable |
| 91 | ''' |
| 92 | path_to_data = './data/air_temp' |
| 93 | |
| 94 | c = torch.load(path_to_data + '/c.pt') |
| 95 | x = torch.load(path_to_data + '/x.pt') |
| 96 | y = torch.load(path_to_data + '/y.pt') |
| 97 | |
| 98 | if norm_y==True: |
| 99 | y = ((y - y.min()) / (y.max() - y.min())) |
| 100 | if norm_x==True: |
| 101 | x = ((x - x.min()) / (x.max() - x.min())) |
| 102 | if coords_as_feats: |
| 103 | x = torch.cat((x.reshape(-1,1),c),1) |
| 104 | |
| 105 | return c, x.reshape(x.shape[0],-1), y |
nothing calls this directly
no outgoing calls
no test coverage detected