CALIPSO-project / SPINacc

A spinup acceleration procedure for land surface models (LSM)
4 stars 0 forks source link

Crash with increasing maximum number of Ks #8

Closed obfiscator closed 3 years ago

obfiscator commented 3 years ago

I tried increasing the number of clusters tested in Task 1 to 15.

# config[11] : maximum number of Ks to test for Kmean algorithm
15

It crashed with an error. It seems like there is an array somewhere with fixed size.

Traceback (most recent call last):
  File "main.py", line 78, in <module>
    dis_all=Cluster.Cluster_test(packdata,auxil,varlist,logfile) 
  File "/home/orchidee03/mmcgrath/SPINacc/Tools/Cluster.py", line 96, in Cluster_test
    ClusD,disx,traID=Cluster_Ana(packdata,auxil,PFT_mask,veg,var_pred,var_pred_name,kkk,10)
  File "/home/orchidee03/mmcgrath/SPINacc/Tools/Cluster.py", line 62, in Cluster_Ana
    cluster_dic[clus_str[clus]+'loc']=locations
IndexError: list index out of range

I'm not sure if increasing the number of Ks tested makes sense, but if not, perhaps we put a check in the code to exit gracefully and inform the user what the maximum number should be?

YilongWang commented 3 years ago

I improved the code. Now it should works without prompting errors. However, I did understand the meaning of the two lines L130-L131 in Cluster.py, which I will confirm with Yan after her defense.

dsgoll123 commented 3 years ago

The cluster number should be as small as possible, going beyond 10 or so isn't foreseen.

We need to check with Yan at which threshold the code should start warning the user about his/her choice or stop