Skip to content

Commit

Permalink
Merge pull request #45 from CIAT-DAPA/develop
Browse files Browse the repository at this point in the history
raise valueError when all areas.json file are empty
  • Loading branch information
Dan3s authored Apr 10, 2024
2 parents 8a69346 + 25eab08 commit 0c82f17
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/aclimate_cpt/01_prediccion.py
Original file line number Diff line number Diff line change
Expand Up @@ -1212,17 +1212,20 @@ def cpt_merge_x_files(file_paths):
items_lgth = {k: sum([len(x["areas"]) for x in val]) for k,val in init_params.items()}
empty_dpt = [k for k,v in items_lgth.items() if v == 0]
lgth_list = [v for k,v in items_lgth.items()]
bool_lgth = [x == 0 for x in lgth_list]

if len(empty_dpt) >0:
Warning("Empty areas.json file found")
for idx in range(len(items_lgth)):
if lgth_list[idx] == 0:
dir_names.pop(idx)
path_json.pop(idx)
path_stations.pop(idx)
for nm in empty_dpt:
init_params.pop(nm)



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

month = int(date.today().strftime("%m"))
year = int(date.today().strftime("%Y"))
Expand Down

0 comments on commit 0c82f17

Please sign in to comment.