Skip to content

ult_bnds getting changed unexpectedly #573

Open
@wkitlasten

Description

@wkitlasten

I have been able to track my parfile_relations to line 338 in pst_from.py and all looks good at that point. The following values are in pr:

      upper_bound lower_bound
0   [100000000.0]     [1e-06]
1   [100000000.0]     [1e-06]
2   [100000000.0]     [1e-06]
3        [4000.0]      [-1.0]
4        [4000.0]      [-1.0]
5   [100000000.0]     [1e-06]
6   [100000000.0]     [1e-06]
7   [100000000.0]     [1e-06]
8   [100000000.0]     [1e-06]
9          [0.05]     [1e-08]
10         [0.05]    [-0.003]
11    100000000.0    0.000001
....

But the following code (and similar for lbound) changes the upper and lower bound to the max and min of the columns for a give file.

if ubound.nunique(0, False).gt(1).any():
    ub_min = ubound.min().fillna(self.ult_ubound_fill).to_dict()
    pr.loc[g.index, "upper_bound"] = g.use_cols.apply(
        lambda x: [ub_min["ubound{0}".format(c)] for c in x]
        if x is not None
        else ub_min["ubound"]
    )

To give this:

    upper_bound lower_bound
0        [0.05]     [1e-06]
1        [0.05]     [1e-06]
2        [0.05]     [1e-06]
3        [0.05]     [1e-06]
4        [0.05]     [1e-06]
5        [0.05]     [1e-06]
6        [0.05]     [1e-06]
7        [0.05]     [1e-06]
8        [0.05]     [1e-06]
9        [0.05]     [1e-06]
10       [0.05]     [1e-06]
11  100000000.0    0.000001

The file being parameterized (using use_rows in the 'pf.add_parameters` call) has parnames as rows and parvals in a column (plus some other columns I use for other stuff, so simply transposing the table gets awkward):

                      value
parnme                     
coast.cond_c_layer1       1
coast.cond_c_layer2       1
reach.rhk_c_layer1        1
stage.value_c_layer1      0
satx.elev_c_layer1        0
k_c_layer1                1
k_c_layer2                1
k33_c_layer1              1
k33_c_layer2              1
mrch_c                    1
pmet_c                    0

Is there a reason all parameters (rows) should have the same bounds?

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