Skip to content

pst_from.add_parameters: do the values in index_cols need to be ints? #184

@aleaf

Description

@aleaf

I came across this by accidentally not specifying a comment_char in the following call to add_parameters, which caused the index_cols (including the header) to be read a strings.

            pf.add_parameters(filenames=wel_file, par_type="constant",
                              par_name_base="wel_cn",
                              pargp="wel_cn",
                              upper_bound=1.2, lower_bound=0.8,
                              index_cols=[0, 1, 2], use_cols=[3],
                              datetime=perioddata.loc[per, 'start_datetime'],
                              geostruct=temporal_gs, par_style="multiplier"
                              )

this then caused this line (2532) to fail:

if not zero_based:
    df_ti.loc[:, "sidx"] = df_ti.sidx.apply(lambda x: tuple(xx - 1 for xx in x))

If index_cols should be comprised of ints, then would be good to add a check for this in _get_tpl_or_ins_df so that the user gets a more helpful error message. Or if not, we would need another way to handle the zero_based option.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions