Skip to content

Commit 25eab08

Browse files
committed
raise valueError when all areas.json file are empty
1 parent 9fe54d8 commit 25eab08

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/aclimate_cpt/01_prediccion.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -1212,17 +1212,20 @@ def cpt_merge_x_files(file_paths):
12121212
items_lgth = {k: sum([len(x["areas"]) for x in val]) for k,val in init_params.items()}
12131213
empty_dpt = [k for k,v in items_lgth.items() if v == 0]
12141214
lgth_list = [v for k,v in items_lgth.items()]
1215+
bool_lgth = [x == 0 for x in lgth_list]
1216+
12151217
if len(empty_dpt) >0:
1218+
Warning("Empty areas.json file found")
12161219
for idx in range(len(items_lgth)):
12171220
if lgth_list[idx] == 0:
12181221
dir_names.pop(idx)
12191222
path_json.pop(idx)
12201223
path_stations.pop(idx)
12211224
for nm in empty_dpt:
12221225
init_params.pop(nm)
1223-
1224-
12251226

1227+
if all(bool_lgth):
1228+
raise ValueError("departments has ares.json file empty")
12261229

12271230
month = int(date.today().strftime("%m"))
12281231
year = int(date.today().strftime("%Y"))

0 commit comments

Comments
 (0)