Revise numpy/polars conversion between _es_update.py and misfit_preprocessor.main
- Dominant language
- Python
- Stars
- 161
- Forks
- 141
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 138
Description
In `es_update.py`, there is a conversion from polars to numpy, and numpy to polars. This might be possible to streamline, code:
```
scaling_factors_updated = (
observations_and_responses[_OutlierColumns.obs_scaling].to_numpy().copy()
)
obs_keys = observations_and_responses["observation_key"].to_numpy().astype(str)
for input_group in auto_scale_observations:
group = _expand_wildcards(obs_keys, input_group)
logger.info(f"Scaling observation group: {group}")
obs_group_mask = np.isin(obs_keys, group) & obs_mask
...
scaling_factors, clusters, nr_components = misfit_preprocessor.main(
data_for_obs.select(active_realizations).to_numpy(),
data_for_obs.select(_OutlierColumns.scaled_std).to_numpy(),
)
scaling_factors_updated[obs_group_mask] *= scaling_factors
...
```
Contributor guide
Research direction
Read es_update.py around the polars-to-NumPy conversions and inspect misfit_preprocessor.main, which receives the converted arrays. Trace how scaling_factors_updated and the returned scaling factors flow through the observation-group loop; done means streamlining the conversions without changing scaling or clustering behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python
- Domain
- data
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100