Skip to content

Commit

Permalink
Merge pull request #9 from ecmwf-projects/forma-params-fix
Browse files Browse the repository at this point in the history
variable -> variables in the forms jsons
  • Loading branch information
garciampred authored Mar 15, 2024
2 parents 6c16f59 + ef97a2f commit 4ae5e5d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions cdsobs/forms_jsons.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ def get_constraints_json(session, output_path: Path, dataset) -> Path:
# Turn into a dataframe and remove the bools column (named 0 by default)
flat_constraints = (
flat_constraints.reset_index()
.rename(dict(level_2="variable"), axis=1)
.rename(dict(level_2="variables"), axis=1)
.drop(0, axis=1)
.rename(dict(source="dataset_source"), axis=1)
)
flat_constraints["variable"] = flat_constraints["variable"].astype(str)
flat_constraints["variables"] = flat_constraints["variables"].astype(str)
times = flat_constraints.time.astype("datetime64[s]")
flat_constraints["year"] = times.dt.year.astype("str")
flat_constraints["month"] = times.dt.month.astype("str").str.rjust(2, "0")
Expand All @@ -120,7 +120,7 @@ def get_widgets_json(session, output_path: Path, dataset: str) -> Path:
catalogue_entries = get_catalogue_entries_stream(session, dataset)
summary = stats_summary(catalogue_entries)
widgets_json_content = dict()
widgets_json_content["variable"] = summary["available variables"]
widgets_json_content["variables"] = summary["available variables"]
time_coverage_start, time_coverage_end = summary["total time coverage"]
start_year = int(time_coverage_start[0:4])
end_year = int(time_coverage_end[0:4])
Expand All @@ -130,7 +130,6 @@ def get_widgets_json(session, output_path: Path, dataset: str) -> Path:
# year! We still check that the coverage ends the first of Jan just to be sure
# in case something changes in the future.
end_year -= 1
widgets_json_content["variable"] = summary["available variables"]
widgets_json_content["stations"] = summary["available stations"]
widgets_json_content["dataset_source"] = summary["available dataset sources"]
widgets_json_content["year"] = _to_str_list(range(start_year, end_year + 1))
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ dependencies:
- libnetcdf
- netcdf4
- numpy
- pandas
- pandas=2.1.4
- psycopg2
- pydantic
- pytest-mock
Expand Down

0 comments on commit 4ae5e5d

Please sign in to comment.