def UpdateParameters(Overwrite=False):
print('<STR_LIT>')<EOL>time.sleep(<NUM_LIT:1.0>)<EOL>_DownloadTS05Data(Overwrite)<EOL>kp.UpdateLocalData()<EOL>tabdir = Globals.DataPath+'<STR_LIT>'<EOL>if not os.path.isdir(tabdir):<EOL><INDENT>os.system('<STR_LIT>'+tabdir)<EOL><DEDENT>files = os.listdir(tabdir)<EOL>nf = np.size(files)<EOL>Years = <NUM_LIT> + np.arange(nf)<EOL>tabs = []<EOL>for i in range(<NUM_LIT:0>,nf):<EOL><INDENT>print('<STR_LIT>'.format(Years[i]),end='<STR_LIT>')<EOL>tabs.append(_ReadTab(Years[i]))<EOL><DEDENT>print()<EOL>print('<STR_LIT>') <EOL>n = <NUM_LIT:0><EOL>for i in range(<NUM_LIT:0>,nf):<EOL><INDENT>n += tabs[i].size<EOL><DEDENT>data = np.recarray(n,dtype=tabs[<NUM_LIT:0>].dtype)<EOL>p = <NUM_LIT:0><EOL>for i in range(<NUM_LIT:0>,nf):<EOL><INDENT>data[p:p+tabs[i].size] = tabs[i]<EOL>p += tabs[i].size<EOL><DEDENT>udate = np.unique(data.Date)<EOL>nu = np.size(udate)<EOL>for i in range(<NUM_LIT:0>,nu):<EOL><INDENT>print('<STR_LIT>'.format(<NUM_LIT>*(i+<NUM_LIT:1>)/nu),end='<STR_LIT>')<EOL>use = np.where(data.Date == udate[i])[<NUM_LIT:0>]<EOL>k = kp.GetKp(udate[i])<EOL>if k.size > <NUM_LIT:0>:<EOL><INDENT>kind = np.int32(data.ut[use]/<NUM_LIT>)<EOL>data.Kp[use] = k.Kp[kind]<EOL><DEDENT>else:<EOL><INDENT>data.Kp[use] = <NUM_LIT:1><EOL><DEDENT><DEDENT>print()<EOL>for i in range(<NUM_LIT:0>,n):<EOL><INDENT>print('<STR_LIT>'.format(i+<NUM_LIT:1>,n),end='<STR_LIT>')<EOL>i0 = np.max([<NUM_LIT:0>,i-<NUM_LIT:11>])<EOL>i1 = i + <NUM_LIT:1><EOL>tmp = data[i0:i1]<EOL>use = np.where(np.isfinite(tmp.By) & np.isfinite(tmp.Bz) & (tmp.IMFFlag > -<NUM_LIT:1>) & (tmp.ISWFlag > -<NUM_LIT:1>))[<NUM_LIT:0>]<EOL>if use.size > <NUM_LIT:0>:<EOL><INDENT>CA = np.arctan2(-tmp.By,tmp.Bz)<EOL>Bp = np.sqrt(tmp.By**<NUM_LIT:2> + tmp.Bz**<NUM_LIT:2>)<EOL>Bs = np.abs(tmp.Bz)<EOL>pos = np.where(tmp.Bz > <NUM_LIT:0>)[<NUM_LIT:0>]<EOL>Bs[pos] = <NUM_LIT:0.0><EOL>h = ((Bp/<NUM_LIT>)**<NUM_LIT:2>)/(<NUM_LIT:1.0> + Bp/<NUM_LIT>)<EOL>data.G1[i] = np.sum(<NUM_LIT>*h*(np.sin(CA/<NUM_LIT:2>))**<NUM_LIT:3>)/use.size<EOL>data.G2[i] = <NUM_LIT>*np.sum(<NUM_LIT>*Bs)/use.size<EOL><DEDENT>else:<EOL><INDENT>data.G1[i] = <NUM_LIT:0.0><EOL>data.G2[i] = <NUM_LIT:0.0>  <EOL><DEDENT><DEDENT>print()<EOL>fname = Globals.DataPath+'<STR_LIT>'<EOL>RT.SaveRecarray(data,fname)<EOL>
This program will download and convert all of the model parameters
required from Tsyganenko's own website along with the Kp index data.

This may take a while.