def run(ini_file='plot_soil_moisture_maps.ini'):

    config.read(ini_file)
    print 'Read the file ',ini_file

    file_global_param=config.get('files','file_global_param')
    file_cell_param=config.get('files','file_cell_param')
    file_sim=config.get('files','file_sim')

    path_out=config.get('paths','path_out')

    fac_L=config.getfloat('calib_params','fac_L')
    fac_Ks=config.getfloat('calib_params','fac_Ks')
    fac_n_o=config.getfloat('calib_params','fac_n_o')
    fac_n_c=config.getfloat('calib_params','fac_n_c')

    t1=config.getfloat('flags','t1')
    t2=config.getfloat('flags','t2')
    variable=config.getfloat('flags','variable')

    ##~~~~~~PROGRAM~~~~~##
    # Create the folder if it doesn't exist
    ut.check_folder_exist(path_out)

    #~~~~Read Global parameters file
    X,Dt,alpha_s,alpha_o,alpha_c,A_thres,W_min,W_max\
      =pm.read_global_parameters(file_global_param)
    #~~~~Read Cell parameters file
    ar_cell_label, ar_coorx, \
    ar_coory, ar_lambda, \
    ar_Xc, ar_dam, \
    ar_tan_beta, ar_tan_beta_channel, \
    ar_L0, ar_Ks0, \
    ar_theta_r, ar_theta_s, \
    ar_n_o0, ar_n_c0, \
    ar_cell_down, ar_pVs_t0, \
    ar_Vo_t0, ar_Qc_t0, \
    ar_kc, psi_b, lamda = pm.read_cell_parameters(file_cell_param)
    #~~~~Number of cell in the catchment
    nb_cell=len(ar_cell_label)
    #~~~~Computation of cell order
    ar_label_sort=pm.sort_cell(ar_cell_label,ar_cell_down)
    #~~~~Computation of upcells
    li_cell_up=pm.direct_up_cell(ar_cell_label,ar_cell_down,ar_label_sort)
    #~~~~Computation of drained area
    ar_A_drained=pm.drained_area(ar_label_sort,li_cell_up,X)
    #~~~~Modifies the values of the parameters
    ar_L=ar_L0*fac_L
    ar_Ks=ar_Ks0*fac_Ks
    ar_n_o=ar_n_o0*fac_n_o
    ar_n_c=ar_n_c0*fac_n_c
    #~~~~Computation of model parameters from physical parameters
    ar_Vsm, ar_b_s, ar_b_o, ar_W, ar_b_c\
      =pm.compute_cell_param(X,ar_Xc,Dt,alpha_s,alpha_o,alpha_c,nb_cell,\
                              A_thres,W_max,W_min,\
                              ar_lambda,ar_tan_beta,ar_tan_beta_channel,ar_L,\
                              ar_Ks,ar_theta_r,ar_theta_s,ar_n_o,ar_n_c,\
                              ar_A_drained)

    #Read of data from the outputs of TOPKAPI in hdf5 format
    ndar_Vs=np.array(ut.read_one_array_hdf(file_sim,'/Soil/','V_s'))

    #Assign the variables
    if variable==1:
        im_out=os.path.join(path_out, 'field_Vs_')
        tab=ndar_Vs
    elif variable==2:
        im_out=os.path.join(path_out, 'field_Vo_')
        tab=ndar_Vo
    elif variable==3:
        im_out=os.path.join(path_out, 'field_Vo_bin_')
        tab=ndar_Vo
        tab[tab>0]=1.
    elif variable==4:
        im_out=os.path.join(path_out, 'field_SSI_')
        tab=ndar_Vs/ar_Vsm*100.

    # Plot the maps
    for t in np.arange(int(t1),int(t2+1)):
        print 'Map time-step ', t
        image_out=im_out+ut.string(t,len(str(t2)))+'.png'
        field_map_ndar(tab,t,ar_coorx,ar_coory,X,image_out,variable)
Esempio n. 2
0
def run(ini_file='plot_soil_moisture_maps.ini'):

    config.read(ini_file)
    print('Read the file ',ini_file)

    file_global_param=config.get('files','file_global_param')
    file_cell_param=config.get('files','file_cell_param')
    file_sim=config.get('files','file_sim')

    path_out=config.get('paths','path_out')

    fac_L=config.getfloat('calib_params','fac_L')
    fac_Ks=config.getfloat('calib_params','fac_Ks')
    fac_n_o=config.getfloat('calib_params','fac_n_o')
    fac_n_c=config.getfloat('calib_params','fac_n_c')

    t1=config.getfloat('flags','t1')
    t2=config.getfloat('flags','t2')
    variable=config.getfloat('flags','variable')

    ##~~~~~~PROGRAM~~~~~##
    # Create the folder if it doesn't exist
    ut.check_folder_exist(path_out)

    #~~~~Read Global parameters file
    X,Dt,alpha_s,alpha_o,alpha_c,A_thres,W_min,W_max\
      =pm.read_global_parameters(file_global_param)
    #~~~~Read Cell parameters file
    ar_cell_label, ar_coorx, \
    ar_coory, ar_lambda, \
    ar_Xc, ar_dam, \
    ar_tan_beta, ar_tan_beta_channel, \
    ar_L0, ar_Ks0, \
    ar_theta_r, ar_theta_s, \
    ar_n_o0, ar_n_c0, \
    ar_cell_down, ar_pVs_t0, \
    ar_Vo_t0, ar_Qc_t0, \
    ar_kc, psi_b, lamda = pm.read_cell_parameters(file_cell_param)
    #~~~~Number of cell in the catchment
    nb_cell=len(ar_cell_label)
    #~~~~Computation of cell order
    ar_label_sort=pm.sort_cell(ar_cell_label,ar_cell_down)
    #~~~~Computation of upcells
    li_cell_up=pm.direct_up_cell(ar_cell_label,ar_cell_down,ar_label_sort)
    #~~~~Computation of drained area
    ar_A_drained=pm.drained_area(ar_label_sort,li_cell_up,X)
    #~~~~Modifies the values of the parameters
    ar_L=ar_L0*fac_L
    ar_Ks=ar_Ks0*fac_Ks
    ar_n_o=ar_n_o0*fac_n_o
    ar_n_c=ar_n_c0*fac_n_c
    #~~~~Computation of model parameters from physical parameters
    ar_Vsm, ar_b_s, ar_b_o, ar_W, ar_b_c\
      =pm.compute_cell_param(X,ar_Xc,Dt,alpha_s,alpha_o,alpha_c,nb_cell,\
                              A_thres,W_max,W_min,\
                              ar_lambda,ar_tan_beta,ar_tan_beta_channel,ar_L,\
                              ar_Ks,ar_theta_r,ar_theta_s,ar_n_o,ar_n_c,\
                              ar_A_drained)

    #Read of data from the outputs of TOPKAPI in hdf5 format
    ndar_Vs=np.array(ut.read_one_array_hdf(file_sim,'Soil','V_s'))

    #Assign the variables
    if variable==1:
        im_out=os.path.join(path_out, 'field_Vs_')
        tab=ndar_Vs
    elif variable==2:
        im_out=os.path.join(path_out, 'field_Vo_')
        tab=ndar_Vo
    elif variable==3:
        im_out=os.path.join(path_out, 'field_Vo_bin_')
        tab=ndar_Vo
        tab[tab>0]=1.
    elif variable==4:
        im_out=os.path.join(path_out, 'field_SSI_')
        tab=ndar_Vs/ar_Vsm*100.

    # Plot the maps
    for t in np.arange(int(t1),int(t2+1)):
        print('Map time-step ', t)
        image_out=im_out+ut.string(t,len(str(t2)))+'.png'
        field_map_ndar(tab,t,ar_coorx,ar_coory,X,image_out,variable)
Esempio n. 3
0
def mean_simuVsi(ini_file='mean_simuVsi.ini'):
    """
    * Objective

    """

    ### READ THE INI FILE ###
    config.read(ini_file)
    print('Read the file ',ini_file)

    ##~~~~~~ file_in ~~~~~~##
    file_in=config.get('file_in','file_in')
    file_in_global=config.get('file_in','file_in_global')
    file_h5=config.get('file_in','file_h5')

    ##~~~~~~ file_out ~~~~~~##
    file_out=config.get('file_out','file_out')

    ##~~~~~~ variables ~~~~~~##
    mean_pVs_t0=config.getfloat('variables','mean_pVs_t0')
    fac_L_simu=config.getfloat('variables','fac_L_simu')
    fac_Ks_simu=config.getfloat('variables','fac_Ks_simu')
    fac_n_o_simu=config.getfloat('variables','fac_n_o_simu')
    fac_n_c_simu=config.getfloat('variables','fac_n_c_simu')

    ##~~~~~~ flags ~~~~~~##
    nb_param=config.getfloat('flags','nb_param')

    #--Read and compute the parameters to have the values of parameter and ar_Vsm
    #~~~~Read Global parameters file
    print('Pretreatment of input data')
    #~~~~Read Global parameters file
    X,Dt,alpha_s,alpha_o,alpha_c,A_thres,W_min,W_max\
      =pm.read_global_parameters(file_in_global)
    #~~~~Read Cell parameters file
    ar_cell_label,ar_coorx,ar_coory,ar_lambda,ar_Xc,ar_dam,ar_tan_beta,ar_tan_beta_channel,ar_L,ar_Ks,\
    ar_theta_r,ar_theta_s,ar_n_o,ar_n_c,\
    ar_cell_down,ar_pVs_t0,ar_Vo_t0,ar_Qc_t0,ar_kc\
        =pm.read_cell_parameters(file_in)
    #~~~~Number of cell in the catchment
    nb_cell=len(ar_cell_label)
    #~~~~Computation of cell order
    ar_label_sort=pm.sort_cell(ar_cell_label,ar_cell_down)
    #~~~~Computation of upcells
    li_cell_up=pm.direct_up_cell(ar_cell_label,ar_cell_down,ar_label_sort)
    #~~~~Computation of drained area
    ar_A_drained=pm.drained_area(ar_label_sort,li_cell_up,X)
    #~~~~Modifies the values of the parameters
    ar_L1=ar_L*fac_L_simu
    ar_Ks1=ar_Ks*fac_Ks_simu
    ar_n_o1=ar_n_o*fac_n_o_simu
    ar_n_c1=ar_n_c*fac_n_c_simu
    #~~~~Computation of model parameters from physical parameters
    ar_Vsm, ar_b_s, ar_b_o, ar_W, ar_b_c\
      =pm.compute_cell_param(X,ar_Xc,Dt,alpha_s,alpha_o,alpha_c,nb_cell,\
                              A_thres,W_max,W_min,\
                              ar_lambda,ar_tan_beta,ar_tan_beta_channel,ar_L1,\
                              ar_Ks1,ar_theta_r,ar_theta_s,ar_n_o1,ar_n_c1,\
                              ar_A_drained)

    #Read the soil volume file
    ndar_Vs=np.array(ut.read_one_array_hdf(file_h5,'Soil','V_s'))

    #Read the file of catchment saturation rates
    ndar_Vs_sat=ndar_Vs/ar_Vsm*100.
    tab_rate=np.average(ndar_Vs_sat,axis=1)
    tab_rate_sort=np.sort(tab_rate)
    indice_sort=np.argsort(tab_rate)

    #Look for the rate closest to the expected mean value
    if mean_pVs_t0<tab_rate_sort[0]:
        ind=0
        print('mean_pVs_t0 expected:', mean_pVs_t0,'effective:',tab_rate_sort[0])
    elif mean_pVs_t0>tab_rate_sort[-1]:
        ind=-1
        print('mean_pVs_t0 expected:', mean_pVs_t0,' effective',tab_rate_sort[-1])
    else:
        loop=True
        i=-1
        while loop:
            i=i+1
            if mean_pVs_t0>=tab_rate_sort[i] and mean_pVs_t0<tab_rate_sort[i+1]:
                ind=i
                loop=False
                print('mean_pVs_t0 expected:', mean_pVs_t0,' effective:',tab_rate_sort[i])

    ind_end=indice_sort[ind]
    print(ind,ind_end)
    ar_Vs=ndar_Vs[ind_end,:]
    ar_Vsi=ar_Vs/ar_Vsm*100.
    print(ar_Vsi)
    ar_pVs_t0=ar_Vsi

    #~~~~~~Write parameter file~~~~~~#
    tab_param=np.zeros((len(ar_cell_label),nb_param))

    tab_param[:,0]=ar_cell_label
    tab_param[:,1]=ar_coorx
    tab_param[:,2]=ar_coory
    tab_param[:,3]=ar_lambda
    tab_param[:,4]=ar_Xc
    tab_param[:,5]=ar_dam
    tab_param[:,6]=ar_tan_beta
    tab_param[:,7]=ar_tan_beta_channel
    tab_param[:,8]=ar_L
    tab_param[:,9]=ar_Ks
    tab_param[:,10]=ar_theta_r
    tab_param[:,11]=ar_theta_s
    tab_param[:,12]=ar_n_o
    tab_param[:,13]=ar_n_c
    tab_param[:,14]=ar_cell_down
    tab_param[:,15]=ar_pVs_t0
    tab_param[:,16]=ar_Vo_t0
    tab_param[:,17]=ar_Qc_t0
    tab_param[:,18]=ar_kc

    np.savetxt(file_out, tab_param)
Esempio n. 4
0
def initial_pVs_Vo_Qc_from_simu(ini_file='initial_pVs_Vo_Qc_from_simu.ini'):
    """
    * Objective

     """
    ### READ THE INI FILE ###
    config.read(ini_file)
    print('Read the file ',ini_file)

    ##~~~~~~ file_in ~~~~~~##
    file_in=config.get('file_in','file_in')
    file_in_global=config.get('file_in','file_in_global')
    file_h5=config.get('file_in','file_h5')

    ##~~~~~~ file_out ~~~~~~##
    file_out=config.get('file_out','file_out')

    ##~~~~~~ variables ~~~~~~##
    time_step=config.getint('variables','time_step')
    fac_L_simu=config.getfloat('variables','fac_L_simu')
    fac_Ks_simu=config.getfloat('variables','fac_Ks_simu')
    fac_n_o_simu=config.getfloat('variables','fac_n_o_simu')
    fac_n_c_simu=config.getfloat('variables','fac_n_c_simu')

    ##~~~~~~ flags ~~~~~~##
    nb_param=config.getfloat('flags','nb_param')

    #--Read and compute the parameters to have the values of parameter and ar_Vsm
    #~~~~Read Global parameters file
    #~~~~Read Global parameters file
    X,Dt,alpha_s,alpha_o,alpha_c,A_thres,W_min,W_max\
      =pm.read_global_parameters(file_in_global)
    #~~~~Read Cell parameters file
    ar_cell_label,ar_coorx,ar_coory,ar_lambda,ar_Xc,ar_dam,ar_tan_beta,ar_tan_beta_channel,ar_L,ar_Ks,\
    ar_theta_r,ar_theta_s,ar_n_o,ar_n_c,\
    ar_cell_down,ar_pVs_t0,ar_Vo_t0,ar_Qc_t0,ar_kc\
        =pm.read_cell_parameters(file_in)
    #~~~~Number of cell in the catchment
    nb_cell=len(ar_cell_label)
    #~~~~Computation of cell order
    ar_label_sort=pm.sort_cell(ar_cell_label,ar_cell_down)
    #~~~~Computation of upcells
    li_cell_up=pm.direct_up_cell(ar_cell_label,ar_cell_down,ar_label_sort)
    #~~~~Computation of drained area
    ar_A_drained=pm.drained_area(ar_label_sort,li_cell_up,X)
    #~~~~Modifies the values of the parameters
    ar_L1=ar_L*fac_L_simu
    ar_Ks1=ar_Ks*fac_Ks_simu
    ar_n_o1=ar_n_o*fac_n_o_simu
    ar_n_c1=ar_n_c*fac_n_c_simu
    #~~~~Computation of model parameters from physical parameters
    ar_Vsm, ar_b_s, ar_b_o, ar_W, ar_b_c\
      =pm.compute_cell_param(X,ar_Xc,Dt,alpha_s,alpha_o,alpha_c,nb_cell,\
                              A_thres,W_max,W_min,\
                              ar_lambda,ar_tan_beta,ar_tan_beta_channel,ar_L1,\
                              ar_Ks1,ar_theta_r,ar_theta_s,ar_n_o1,ar_n_c1,\
                              ar_A_drained)

    #Read the soil volume file
    ndar_Vs=np.array(ut.read_one_array_hdf(file_h5,'Soil','V_s'))
    #Read the overland volume file
    ndar_Vo=np.array(ut.read_one_array_hdf(file_h5,'Overland','V_o'))
    #Read the channel dischargefile
    ndar_Qc=np.array(ut.read_one_array_hdf(file_h5,'Channel','Qc_out'))

    ar_Vs=ndar_Vs[time_step,:]
    ar_pVs_t0=ar_Vs/ar_Vsm*100.
    ar_Vo_t0=ndar_Vo[time_step,:]
    ar_Qc_t0=ndar_Qc[time_step,:]


    #~~~~~~Write parameter file~~~~~~#
    tab_param=np.zeros((len(ar_cell_label),nb_param))

    tab_param[:,0]=ar_cell_label
    tab_param[:,1]=ar_coorx
    tab_param[:,2]=ar_coory
    tab_param[:,3]=ar_lambda
    tab_param[:,4]=ar_Xc
    tab_param[:,5]=ar_dam
    tab_param[:,6]=ar_tan_beta
    tab_param[:,7]=ar_tan_beta_channel
    tab_param[:,8]=ar_L
    tab_param[:,9]=ar_Ks
    tab_param[:,10]=ar_theta_r
    tab_param[:,11]=ar_theta_s
    tab_param[:,12]=ar_n_o
    tab_param[:,13]=ar_n_c
    tab_param[:,14]=ar_cell_down
    tab_param[:,15]=ar_pVs_t0
    tab_param[:,16]=ar_Vo_t0
    tab_param[:,17]=ar_Qc_t0
    tab_param[:,18]=ar_kc

    np.savetxt(file_out, tab_param)
Esempio n. 5
0
def mean_simuVsi(ini_file='mean_simuVsi.ini'):
    """
    * Objective

    """

    ### READ THE INI FILE ###
    config.read(ini_file)
    print 'Read the file ', ini_file

    ##~~~~~~ file_in ~~~~~~##
    file_in = config.get('file_in', 'file_in')
    file_in_global = config.get('file_in', 'file_in_global')
    file_h5 = config.get('file_in', 'file_h5')

    ##~~~~~~ file_out ~~~~~~##
    file_out = config.get('file_out', 'file_out')

    ##~~~~~~ variables ~~~~~~##
    mean_pVs_t0 = config.getfloat('variables', 'mean_pVs_t0')
    fac_L_simu = config.getfloat('variables', 'fac_L_simu')
    fac_Ks_simu = config.getfloat('variables', 'fac_Ks_simu')
    fac_n_o_simu = config.getfloat('variables', 'fac_n_o_simu')
    fac_n_c_simu = config.getfloat('variables', 'fac_n_c_simu')

    ##~~~~~~ flags ~~~~~~##
    nb_param = config.getfloat('flags', 'nb_param')

    #--Read and compute the parameters to have the values of parameter and ar_Vsm
    #~~~~Read Global parameters file
    print 'Pretreatment of input data'
    #~~~~Read Global parameters file
    X,Dt,alpha_s,alpha_o,alpha_c,A_thres,W_min,W_max\
      =pm.read_global_parameters(file_in_global)
    #~~~~Read Cell parameters file
    ar_cell_label,ar_coorx,ar_coory,ar_lambda,ar_Xc,ar_dam,ar_tan_beta,ar_tan_beta_channel,ar_L,ar_Ks,\
    ar_theta_r,ar_theta_s,ar_n_o,ar_n_c,\
    ar_cell_down,ar_pVs_t0,ar_Vo_t0,ar_Qc_t0,ar_kc\
        =pm.read_cell_parameters(file_in)
    #~~~~Number of cell in the catchment
    nb_cell = len(ar_cell_label)
    #~~~~Computation of cell order
    ar_label_sort = pm.sort_cell(ar_cell_label, ar_cell_down)
    #~~~~Computation of upcells
    li_cell_up = pm.direct_up_cell(ar_cell_label, ar_cell_down, ar_label_sort)
    #~~~~Computation of drained area
    ar_A_drained = pm.drained_area(ar_label_sort, li_cell_up, X)
    #~~~~Modifies the values of the parameters
    ar_L1 = ar_L * fac_L_simu
    ar_Ks1 = ar_Ks * fac_Ks_simu
    ar_n_o1 = ar_n_o * fac_n_o_simu
    ar_n_c1 = ar_n_c * fac_n_c_simu
    #~~~~Computation of model parameters from physical parameters
    ar_Vsm, ar_b_s, ar_b_o, ar_W, ar_b_c\
      =pm.compute_cell_param(X,ar_Xc,Dt,alpha_s,alpha_o,alpha_c,nb_cell,\
                              A_thres,W_max,W_min,\
                              ar_lambda,ar_tan_beta,ar_tan_beta_channel,ar_L1,\
                              ar_Ks1,ar_theta_r,ar_theta_s,ar_n_o1,ar_n_c1,\
                              ar_A_drained)

    #Read the soil volume file
    ndar_Vs = np.array(ut.read_one_array_hdf(file_h5, '/Soil/', 'V_s'))

    #Read the file of catchment saturation rates
    ndar_Vs_sat = ndar_Vs / ar_Vsm * 100.
    tab_rate = np.average(ndar_Vs_sat, axis=1)
    tab_rate_sort = np.sort(tab_rate)
    indice_sort = np.argsort(tab_rate)

    #Look for the rate closest to the expected mean value
    if mean_pVs_t0 < tab_rate_sort[0]:
        ind = 0
        print 'mean_pVs_t0 expected:', mean_pVs_t0, 'effective:', tab_rate_sort[
            0]
    elif mean_pVs_t0 > tab_rate_sort[-1]:
        ind = -1
        print 'mean_pVs_t0 expected:', mean_pVs_t0, ' effective', tab_rate_sort[
            -1]
    else:
        loop = True
        i = -1
        while loop:
            i = i + 1
            if mean_pVs_t0 >= tab_rate_sort[i] and mean_pVs_t0 < tab_rate_sort[
                    i + 1]:
                ind = i
                loop = False
                print 'mean_pVs_t0 expected:', mean_pVs_t0, ' effective:', tab_rate_sort[
                    i]

    ind_end = indice_sort[ind]
    print ind, ind_end
    ar_Vs = ndar_Vs[ind_end, :]
    ar_Vsi = ar_Vs / ar_Vsm * 100.
    print ar_Vsi
    ar_pVs_t0 = ar_Vsi

    #~~~~~~Write parameter file~~~~~~#
    tab_param = np.zeros((len(ar_cell_label), nb_param))

    tab_param[:, 0] = ar_cell_label
    tab_param[:, 1] = ar_coorx
    tab_param[:, 2] = ar_coory
    tab_param[:, 3] = ar_lambda
    tab_param[:, 4] = ar_Xc
    tab_param[:, 5] = ar_dam
    tab_param[:, 6] = ar_tan_beta
    tab_param[:, 7] = ar_tan_beta_channel
    tab_param[:, 8] = ar_L
    tab_param[:, 9] = ar_Ks
    tab_param[:, 10] = ar_theta_r
    tab_param[:, 11] = ar_theta_s
    tab_param[:, 12] = ar_n_o
    tab_param[:, 13] = ar_n_c
    tab_param[:, 14] = ar_cell_down
    tab_param[:, 15] = ar_pVs_t0
    tab_param[:, 16] = ar_Vo_t0
    tab_param[:, 17] = ar_Qc_t0
    tab_param[:, 18] = ar_kc

    np.savetxt(file_out, tab_param)
Esempio n. 6
0
def initial_pVs_Vo_Qc_from_simu(ini_file='initial_pVs_Vo_Qc_from_simu.ini'):
    """
    * Objective

     """
    ### READ THE INI FILE ###
    config.read(ini_file)
    print 'Read the file ', ini_file

    ##~~~~~~ file_in ~~~~~~##
    file_in = config.get('file_in', 'file_in')
    file_in_global = config.get('file_in', 'file_in_global')
    file_h5 = config.get('file_in', 'file_h5')

    ##~~~~~~ file_out ~~~~~~##
    file_out = config.get('file_out', 'file_out')

    ##~~~~~~ variables ~~~~~~##
    time_step = config.getint('variables', 'time_step')
    fac_L_simu = config.getfloat('variables', 'fac_L_simu')
    fac_Ks_simu = config.getfloat('variables', 'fac_Ks_simu')
    fac_n_o_simu = config.getfloat('variables', 'fac_n_o_simu')
    fac_n_c_simu = config.getfloat('variables', 'fac_n_c_simu')

    ##~~~~~~ flags ~~~~~~##
    nb_param = config.getfloat('flags', 'nb_param')

    #--Read and compute the parameters to have the values of parameter and ar_Vsm
    #~~~~Read Global parameters file
    #~~~~Read Global parameters file
    X,Dt,alpha_s,alpha_o,alpha_c,A_thres,W_min,W_max\
      =pm.read_global_parameters(file_in_global)
    #~~~~Read Cell parameters file
    ar_cell_label,ar_coorx,ar_coory,ar_lambda,ar_Xc,ar_dam,ar_tan_beta,ar_tan_beta_channel,ar_L,ar_Ks,\
    ar_theta_r,ar_theta_s,ar_n_o,ar_n_c,\
    ar_cell_down,ar_pVs_t0,ar_Vo_t0,ar_Qc_t0,ar_kc\
        =pm.read_cell_parameters(file_in)
    #~~~~Number of cell in the catchment
    nb_cell = len(ar_cell_label)
    #~~~~Computation of cell order
    ar_label_sort = pm.sort_cell(ar_cell_label, ar_cell_down)
    #~~~~Computation of upcells
    li_cell_up = pm.direct_up_cell(ar_cell_label, ar_cell_down, ar_label_sort)
    #~~~~Computation of drained area
    ar_A_drained = pm.drained_area(ar_label_sort, li_cell_up, X)
    #~~~~Modifies the values of the parameters
    ar_L1 = ar_L * fac_L_simu
    ar_Ks1 = ar_Ks * fac_Ks_simu
    ar_n_o1 = ar_n_o * fac_n_o_simu
    ar_n_c1 = ar_n_c * fac_n_c_simu
    #~~~~Computation of model parameters from physical parameters
    ar_Vsm, ar_b_s, ar_b_o, ar_W, ar_b_c\
      =pm.compute_cell_param(X,ar_Xc,Dt,alpha_s,alpha_o,alpha_c,nb_cell,\
                              A_thres,W_max,W_min,\
                              ar_lambda,ar_tan_beta,ar_tan_beta_channel,ar_L1,\
                              ar_Ks1,ar_theta_r,ar_theta_s,ar_n_o1,ar_n_c1,\
                              ar_A_drained)

    #Read the soil volume file
    ndar_Vs = np.array(ut.read_one_array_hdf(file_h5, '/Soil/', 'V_s'))
    #Read the overland volume file
    ndar_Vo = np.array(ut.read_one_array_hdf(file_h5, '/Overland/', 'V_o'))
    #Read the channel dischargefile
    ndar_Qc = np.array(ut.read_one_array_hdf(file_h5, '/Channel/', 'Qc_out'))

    ar_Vs = ndar_Vs[time_step, :]
    ar_pVs_t0 = ar_Vs / ar_Vsm * 100.
    ar_Vo_t0 = ndar_Vo[time_step, :]
    ar_Qc_t0 = ndar_Qc[time_step, :]

    #~~~~~~Write parameter file~~~~~~#
    tab_param = np.zeros((len(ar_cell_label), nb_param))

    tab_param[:, 0] = ar_cell_label
    tab_param[:, 1] = ar_coorx
    tab_param[:, 2] = ar_coory
    tab_param[:, 3] = ar_lambda
    tab_param[:, 4] = ar_Xc
    tab_param[:, 5] = ar_dam
    tab_param[:, 6] = ar_tan_beta
    tab_param[:, 7] = ar_tan_beta_channel
    tab_param[:, 8] = ar_L
    tab_param[:, 9] = ar_Ks
    tab_param[:, 10] = ar_theta_r
    tab_param[:, 11] = ar_theta_s
    tab_param[:, 12] = ar_n_o
    tab_param[:, 13] = ar_n_c
    tab_param[:, 14] = ar_cell_down
    tab_param[:, 15] = ar_pVs_t0
    tab_param[:, 16] = ar_Vo_t0
    tab_param[:, 17] = ar_Qc_t0
    tab_param[:, 18] = ar_kc

    np.savetxt(file_out, tab_param)