MetOffice / MetOffice/CDDS

Replace sub-processed ppfp usage with the pp-format python library for extract validation

Open
#621 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
8
Forks
7
Avg merge
1d 15h
Merged PRs (30d)
23

Description

There's a significant overhead introduced by subprocessing out to the `ppfp` command. We can rewrite the `get_stash_from_pp` function using `ppformat` directly with something like the following.

```python
from pp_format.pp_format import list_fields

def get_stash_from_pp(filepath) -> dict[str, int]:
fields = list_fields(filepath, ["STASH"])
stash_list = [str(field_dict["STASH"]) for field_dict in fields]
return Counter(stash_list)
```

The tricky bit is how we manage the dependency as `pp-format` is on neither pypi or conda.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating get_stash_from_pp and the current subprocess call to the ppfp command, then inspect the project's dependency configuration. Determine how pp-format can be made available without PyPI or conda, replace the validation lookup with the direct list_fields approach, and verify that extract validation still produces the expected STASH counts.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-engineering
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.