Skip to content

Commit

Permalink
Sorted grid (#42)
Browse files Browse the repository at this point in the history
* template-update

* do not sort grid
  • Loading branch information
malmans2 authored Oct 12, 2023
1 parent 9237768 commit e09b531
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .cruft.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"template": "https://github.com/ecmwf-projects/cookiecutter-conda-package",
"commit": "c752678d4c47a0c9b31603326cdeadb2b4e48dde",
"commit": "191546428eb8df6cb0d48b6a0a2726803b085143",
"checkout": null,
"context": {
"cookiecutter": {
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -20,7 +20,7 @@ repos:
- id: blackdoc
additional_dependencies: [black==22.3.0]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.291
rev: v0.0.292
hooks:
- id: ruff
args: [--fix, --show-fixes]
Expand Down
6 changes: 4 additions & 2 deletions c3s_eqc_automatic_quality_control/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
"pandas_read_csv_kwargs": {"comment": "#"},
}

_SORTED_REQUEST_PARAMETERS = ("area", "grid")


def compute_stop_date(switch_month_day: int | None = None) -> pd.Period:
today = pd.Timestamp.today()
Expand Down Expand Up @@ -254,7 +256,7 @@ def split_request(
chunks = {
k: 1
for k, v in request.items()
if isinstance(v, tuple | list | set) and k != "area"
if isinstance(v, tuple | list | set) and k not in _SORTED_REQUEST_PARAMETERS
}

requests = []
Expand Down Expand Up @@ -285,7 +287,7 @@ def ensure_request_gets_cached(request: dict[str, Any]) -> dict[str, Any]:
cacheable_request = {}
for k, v in sorted(request.items()):
v = ensure_list(v)
if k != "area":
if k not in _SORTED_REQUEST_PARAMETERS:
v = sorted(v)
cacheable_request[k] = v[0] if len(v) == 1 else v
return cacheable_request
Expand Down

0 comments on commit e09b531

Please sign in to comment.