|
42 | 42 | from limao.limao import Limao |
43 | 43 |
|
44 | 44 |
|
45 | | -def intensityProjection(fileNameDSM, fileNameDTM, latLon, size): |
| 45 | +def intensityProjection(fileNameDSM, fileNameDTM, latLon, size, horizontal, vertical): |
46 | 46 |
|
47 | | - nx = 20 |
48 | | - ny = 8 |
| 47 | + nx = horizontal |
| 48 | + ny = vertical |
49 | 49 |
|
50 | 50 | intensities = np.zeros((nx, ny)) |
51 | 51 |
|
@@ -105,30 +105,30 @@ def dailyAvgIntensity(fileNameDSM, fileNameDTM, latLon, size): |
105 | 105 |
|
106 | 106 | table = limao.yearlyIntensityTable() |
107 | 107 |
|
108 | | - plt.plot(table[table["altitude"] > 0]["azimuth"], ".") |
109 | | - plt.plot(table[table["altitude"] < 0]["azimuth"], ".") |
110 | | - plt.savefig("az.pdf") |
111 | | - plt.clf() |
112 | | - |
113 | | - plt.plot(table["altitude"], ".") |
114 | | - plt.savefig("alt.pdf") |
115 | | - plt.clf() |
| 108 | + # plt.plot(table[table["altitude"] > 0]["azimuth"], ".") |
| 109 | + # plt.plot(table[table["altitude"] < 0]["azimuth"], ".") |
| 110 | + # plt.savefig("az.pdf") |
| 111 | + # plt.clf() |
| 112 | + # |
| 113 | + # plt.plot(table["altitude"], ".") |
| 114 | + # plt.savefig("alt.pdf") |
| 115 | + # plt.clf() |
116 | 116 |
|
117 | 117 | isNorth, _, _ = limao.intensityOnElevation(table) |
118 | 118 | table["isNorth"] = isNorth |
119 | 119 |
|
120 | | - plt.plot(table[table["isNorth"]]["azimuth"], ".") |
121 | | - plt.savefig("north_az.pdf") |
122 | | - plt.clf() |
123 | | - |
124 | | - plt.plot(table[~table["isNorth"]]["intensity_passed"], alpha=0.5, label="South") |
125 | | - plt.plot(table[table["isNorth"]]["intensity_passed"], alpha=0.5, label="North") |
126 | | - |
127 | | - plt.xlabel("Hours from 1/1", fontsize=14) |
128 | | - plt.ylabel("Direct sunlight intensity $(W/m^2)$", fontsize=14) |
129 | | - plt.legend(loc=0, fontsize=14) |
130 | | - plt.savefig("test.pdf") |
131 | | - plt.clf() |
| 120 | + # plt.plot(table[table["isNorth"]]["azimuth"], ".") |
| 121 | + # plt.savefig("north_az.pdf") |
| 122 | + # plt.clf() |
| 123 | + # |
| 124 | + # plt.plot(table[~table["isNorth"]]["intensity_passed"], alpha=0.5, label="South") |
| 125 | + # plt.plot(table[table["isNorth"]]["intensity_passed"], alpha=0.5, label="North") |
| 126 | + # |
| 127 | + # plt.xlabel("Hours from 1/1", fontsize=14) |
| 128 | + # plt.ylabel("Direct sunlight intensity $(W/m^2)$", fontsize=14) |
| 129 | + # plt.legend(loc=0, fontsize=14) |
| 130 | + # plt.savefig("test.pdf") |
| 131 | + # plt.clf() |
132 | 132 |
|
133 | 133 | tableDayAvg = ( |
134 | 134 | table.groupby(["day", "isNorth"]) |
@@ -173,7 +173,7 @@ def dailyAvgIntensity(fileNameDSM, fileNameDTM, latLon, size): |
173 | 173 | plt.xlabel("Day", fontsize=14) |
174 | 174 | plt.ylabel("Direct sunlight intensity $(W/m^2)$", fontsize=14) |
175 | 175 | plt.legend(loc=0, fontsize=14) |
176 | | - plt.savefig("testDayAvg.pdf") |
| 176 | + plt.savefig("dayAvg.pdf") |
177 | 177 | plt.clf() |
178 | 178 |
|
179 | 179 | plt.plot( |
@@ -209,11 +209,11 @@ def dailyAvgIntensity(fileNameDSM, fileNameDTM, latLon, size): |
209 | 209 | plt.xlabel("Week number", fontsize=14) |
210 | 210 | plt.ylabel("Direct sunlight intensity $(W/m^2)$", fontsize=14) |
211 | 211 | plt.legend(loc=0, fontsize=14) |
212 | | - plt.savefig("testWeekAvg.pdf") |
| 212 | + plt.savefig("weekAvg.pdf", dpi = 300) |
| 213 | + plt.savefig("weekAvg.png", dpi = 300) |
213 | 214 | plt.clf() |
214 | 215 |
|
215 | | - |
216 | | -if __name__ == "__main__": |
| 216 | +def run(): |
217 | 217 |
|
218 | 218 | # I'd like an argument, please |
219 | 219 | argParser = argparse.ArgumentParser() |
@@ -250,16 +250,37 @@ def dailyAvgIntensity(fileNameDSM, fileNameDTM, latLon, size): |
250 | 250 | help="Plot a spatial 2d projection map of intensity.", |
251 | 251 | ) |
252 | 252 |
|
| 253 | + argParser.add_argument( |
| 254 | + "--vertical", |
| 255 | + type=int, |
| 256 | + dest="vertical", |
| 257 | + default=10, |
| 258 | + help="Vertical extent of the projection.", |
| 259 | + ) |
| 260 | + |
| 261 | + argParser.add_argument( |
| 262 | + "--horizontal", |
| 263 | + type=int, |
| 264 | + dest="horizontal", |
| 265 | + default=10, |
| 266 | + help="Horizontal extent of the projection.", |
| 267 | + ) |
| 268 | + |
253 | 269 | args = argParser.parse_args() |
254 | 270 |
|
255 | 271 | if args.proj: |
256 | 272 |
|
257 | 273 | intensityProjection( |
258 | | - args.fileNameDSM, args.fileNameDTM, (args.lat, args.lon), args.size |
| 274 | + args.fileNameDSM, args.fileNameDTM, (args.lat, args.lon), args.size, args.horizontal, args.vertical |
259 | 275 | ) |
260 | 276 |
|
261 | 277 | else: |
262 | 278 |
|
263 | 279 | dailyAvgIntensity( |
264 | 280 | args.fileNameDSM, args.fileNameDTM, (args.lat, args.lon), args.size |
265 | 281 | ) |
| 282 | + |
| 283 | + |
| 284 | +if __name__ == "__main__": |
| 285 | + |
| 286 | + run() |
0 commit comments