Skip to content

PstFrom add_parameters() failing for list-like par files when using dict spatial reference #587

@briochh

Description

@briochh

There is an issue with how location information is extracted from dictionary style spatial reference when processing list-like par files.
e.g.

    xs = np.arange(1000, 2000, 10)
    ys = np.arange(2000, 3000, 10)
    sr_dict = {(i, j): (x,y) for i, y in enumerate(ys) for j, x in enumerate(xs)}
    gs = pyemu.geostats.GeoStruct(variograms=pyemu.geostats.ExpVario(contribution=1, a=250))

    parfile = pd.DataFrame(sr_dict.keys(), columns=['i', 'j'])
    parfile['q'] = range(len(parfile.index))

    md = Path(tmp_path, 'eg')
    md.mkdir(parents=True, exist_ok=True)
    parfile.to_csv(Path(md, "parfile.csv"), index=False, header=False)

    pf = PstFrom(original_d=md, new_d=Path(tmp_path, 'template'),
                 remove_existing=True,
                 longnames=True, spatial_reference=sr_dict,
                 zero_based=True)
    pf.add_parameters("parfile.csv",
                      par_type="grid",
                      index_cols=[0, 1],
                      use_cols=[2],
                      geostruct=gs)

Fails

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