Exemplo n.º 1
0
def num_mons_all(fdir, fname):
    """
    Number of monitoring points for model_name.
    """
    num_mons = rm.read_records_input(fdir + '/' + fname, '# monitor,')

    return num_mons
Exemplo n.º 2
0
def nt(model_name, dat, let):
    """
    Read the number of time steps (used in observation file)
    """

    # Define path and file
    output_path = rm.make_output_dirs(model_name, dat, let)[0]
    input_file = rm.make_file_dir_names(model_name)[2]

    # Read records (number lines in time step input)
    num_time_records = rm.read_records_input(output_path + '/' + input_file,
                                             '# time periods')

    # Read hashtag input
    lines = rm.read_hashtag_input(output_path + '/' + input_file,
                                  '# time periods', num_time_records)

    # Split hashtag input by white space
    split_lines = str.split(lines)

    # Read entry 3/4 in each line
    right_entries = split_lines[2::4]

    # Sum of the entries
    # -> Adding one accounts for the first time step at time = 0
    nt = sum([int(right_entries[i]) for i in range(len(right_entries))]) + 1

    return nt
Exemplo n.º 3
0
def num_mons(model_name, dat, let):
    """
    Number of monitoring points for model_name.
    """
    output_path = rm.make_output_dirs(model_name, dat, let)[0]
    true_input_file = rm.make_file_dir_names(model_name)[4]

    num_mons = rm.read_records_input(output_path + '/' + true_input_file,
                                     '# monitor,')

    return num_mons
Exemplo n.º 4
0
def num_pres_vel(model_name, dat, let):
    """
    Number of velocity components for model_name.
    """
    output_path = rm.make_output_dirs(model_name, dat, let)[0]
    enkf_input_file = rm.make_file_dir_names(model_name)[3]

    num_pres_vel = rm.read_records_input(output_path + '/' + enkf_input_file,
                                         '# prescribed velocity')

    return num_pres_vel
Exemplo n.º 5
0
def num_single_cell(model_name, dat, let):
    """
    Number of single cell observation points for model_name.

    Remark: We use the comma in the hashtag-search in order to exclude
    '# single cell output times' from the read_records_input search.
    """
    output_path = rm.make_output_dirs(model_name, dat, let)[0]
    enkf_input_file = rm.make_file_dir_names(model_name)[3]

    num_single_cell = rm.read_records_input(
        output_path + '/' + enkf_input_file, '# single cell output,')

    return num_single_cell