Skip to content

Commit a4eefbe

Browse files
committed
redear of only one channel to avoid MemoryError
1 parent 30e53e1 commit a4eefbe

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

climada/entity/exposures/nightlight.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,8 @@ def load_nightlight_nasa(bounds, req_files, year):
250250
if not req_files[idx]:
251251
continue
252252

253-
aux_nl = sparse.csc.csc_matrix(plt.imread(path.join(SYSTEM_DIR, \
254-
file.replace('*', str(year))))[:, :, 0])
253+
aux_nl = Image.open(path.join(SYSTEM_DIR, file.replace('*', str(year))))
254+
aux_nl = sparse.csc.csc_matrix(aux_nl.getchannel(0))
255255
# flip X axis
256256
aux_nl.indices = -aux_nl.indices + aux_nl.shape[0] - 1
257257
aux_nl = aux_nl.tolil()

0 commit comments

Comments
 (0)