Skip to content

Commit 590aa77

Browse files
committed
Fix corner case
1 parent 6bd7f7f commit 590aa77

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

demos/land_cover.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@
1515
from pyproj import Proj, transform, Transformer
1616

1717
dc_files_dir = 'Data/extreme_data/extreme_context_data_paths'
18-
ex_lc_dir = 'Data/extreme/extreme_test_split/lc'
18+
ex_lc_dir = 'D:/DS_Lab/Data/extreme_data/extreme_test_split/lc'
1919

20-
lc_files_dir='C:/Users/Oto/Downloads/ESA_WorldCover_10m_2021_v200_60deg_macrotile_N30E000'
20+
lc_files_dir='D:/DS_Lab/Data/ESA_WorldCover_10m_2021_v200_60deg_macrotile_N30E000'
2121
ESA_file_prefix = 'ESA_WorldCover_10m_2021_V200_'
2222
ESA_file_suffix = '_Map.tif'
2323

2424
if not isdir(join(os.getcwd(), ex_lc_dir)):
2525
os.mkdir(join(os.getcwd(), ex_lc_dir))
2626

27-
with open(join(os.getcwd(), "Data/extreme_data/extreme_context_data_paths.pkl"),'rb') as f:
27+
with open(join(os.getcwd(), "Data/extreme_data/extreme_data_context_data_paths.pkl"),'rb') as f:
2828
dc_paths = pickle.load(f)
2929

3030
ESA_num_pixes = 36000
@@ -63,6 +63,11 @@ def get_lc_map_for_dc(dc_name):
6363
open_tifs[ESA_file] = tif_file.read()
6464

6565
rel_ESA_N, rel_ESA_E = get_rel_ESA_coord(x, y)
66+
# Slightly hacky way of dealing with ESA cude boundaries
67+
if rel_ESA_E == ESA_num_pixes or rel_ESA_N == ESA_num_pixes:
68+
rel_ESA_E -= 1
69+
rel_ESA_N -= 1
70+
# Fails at idx 553
6671
pixel_lc = get_lc_for_pixel(rel_ESA_N, rel_ESA_E, open_tifs[ESA_file])
6772

6873
dc_lc_map[j, k] = pixel_lc

0 commit comments

Comments
 (0)