-
Notifications
You must be signed in to change notification settings - Fork 107
Closed
Description
Hi again,
I am trying to add list file parameterization for a single column in a file with multiple columns and auxiliary variable names (for example below, a GHB in a 2D x-section variable density model).
1 1 151 0.00000000 0.10000000 0.70000000 riverBC
1 1 152 0.00000000 0.10000000 0.70000000 riverBC
From the documentation, I assume that assigning index_cols=[0,1,2], use_cols=[5] informs pst_from to use the first three columns as [row, lay, col], and column 5 as the column to be parameterised (am I misinterpreting?).
However, this returns the error below. Am I setting this up incorrectly? Can you provide any insight on how to structure the code in such a case? I haven't found a similar case in the example notebooks(edit1: nvm, I see the Freyburg example does).
edit2: using par_style='multiplier', does not result in this error.
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
<ipython-input-17-b3817055a53a> in <module>
10 pargp="ghb_gr",
11 upper_bound = 1e8, lower_bound=1e-8,
---> 12 index_cols=[0,1,2], use_cols=[5])
..\pyemu\pyemu\utils\pst_from.py in add_parameters(self, filenames, par_type, zone_array, dist_type, sigma_range, upper_bound, lower_bound, transform, par_name_base, index_cols, use_cols, pargp, pp_space, use_pp_zones, num_eig_kl, spatial_reference, geostruct, datetime, mfile_fmt, mfile_skip, ult_ubound, ult_lbound, rebuild_pst, alt_inst_str, comment_char, par_style)
1478 zero_based=self.zero_based,
1479 input_filename=in_fileabs,
-> 1480 par_style=par_style,
1481 )
1482 assert (
..\pyemu\pyemu\utils\pst_from.py in write_list_tpl(filenames, dfs, name, tpl_filename, index_cols, par_type, use_cols, suffix, zone_array, gpname, longnames, get_xy, ij_in_idx, xy_in_idx, zero_based, input_filename, par_style)
2129 ij_in_idx=ij_in_idx,
2130 xy_in_idx=xy_in_idx,
-> 2131 zero_based=zero_based,
2132 )
2133 else:
..\pyemu\pyemu\utils\pst_from.py in _write_direct_df_tpl(in_filename, tpl_filename, df, name, index_cols, typ, use_cols, suffix, zone_array, longnames, get_xy, ij_in_idx, xy_in_idx, zero_based, gpname)
2322 df_ti.loc[:, "sidx"] = df_ti.sidx.apply(lambda x: tuple(xx - 1 for xx in x))
2323 df_ti.loc[:, "idx_strs"] = df_ti.sidx.apply(
-> 2324 lambda x: j.join([fmt.format(iname, xx) for xx, iname in zip(x, inames)])
2325 ).str.replace(" ", "")
2326
C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\series.py in apply(self, func, convert_dtype, args, **kwds)
4198 else:
4199 values = self.astype(object)._values
-> 4200 mapped = lib.map_infer(values, f, convert=convert_dtype)
4201
4202 if len(mapped) and isinstance(mapped[0], Series):
pandas\_libs\lib.pyx in pandas._libs.lib.map_infer()
..\pyemu\pyemu\utils\pst_from.py in <lambda>(x)
2322 df_ti.loc[:, "sidx"] = df_ti.sidx.apply(lambda x: tuple(xx - 1 for xx in x))
2323 df_ti.loc[:, "idx_strs"] = df_ti.sidx.apply(
-> 2324 lambda x: j.join([fmt.format(iname, xx) for xx, iname in zip(x, inames)])
2325 ).str.replace(" ", "")
2326
..\pyemu\pyemu\utils\pst_from.py in <listcomp>(.0)
2322 df_ti.loc[:, "sidx"] = df_ti.sidx.apply(lambda x: tuple(xx - 1 for xx in x))
2323 df_ti.loc[:, "idx_strs"] = df_ti.sidx.apply(
-> 2324 lambda x: j.join([fmt.format(iname, xx) for xx, iname in zip(x, inames)])
2325 ).str.replace(" ", "")
2326
KeyError: '1|3'
Metadata
Metadata
Assignees
Labels
No labels