8000 monthly-means request with inconsistent product type returns hourly data without warning · Issue #161 · ecmwf/cdsapi · GitHub
[go: up one dir, main page]

Skip to content

monthly-means request with inconsistent product type returns hourly data without warning #161

Open

Description

@hmjbarbosa

What happened?

I requested the dataset reanalysis-era5-single-levels-monthly-means, but mistakenly specified product_type="reanalysis" and omitted the time parameter (this used to work for previous reanalysis, with the previous API).

Problem: The request completed without an error or warning. However, the returned data contain instantaneous hourly fields (1st of the month, at 12:00) rather than monthly averages.

I got this conclusion after downloading and comparing the same variable using the correct product_type="monthly_averaged_reanalysis" and time="00:00" (as suggested by the CDS web interface). I also downloaded and compared with the same variable at hourly resolution.

I would expect an unsupported product type for the selected dataset, or a missing required parameter, to produce a validation error rather than return data with a different temporal meaning.

Could request validation reject this combination to prevent users from unknowingly treating hourly fields as monthly means?

I have attached three scripts with API pull request to download a few data (~20Mb) for "hcc" (high cloud cover) for 2022:

  • inconsistent monthly-means request
  • corrected monthly-means request
  • hourly request

I have also attached a plotting script and the three figures showing the returned field, the correctly requested monthly mean, and differences against the hourly reference fields.

Steps:

  • execute the 3 scripts to download 20Mb of sample files
  • execute the plotting script to create the comparison figures
  • check the header of the "good" and "bad" files (check hcc:GRIB_stepType)

What are the steps to reproduce the bug?

example_hcc_compare.py
example_hcc_2022_mmeans_good_pullrequest.py
example_hcc_2022_mmeans_bad_pullrequest.py
example_hcc_2022_hourly_pullrequest.py
Image
Image
Image

Version

0.7.7

Platform (OS and architecture)

Ubuntu 24.04.4 LTS (64 bits)

Relevant log output

/opt/miniconda3/envs/geo/bin/python -m pip show cdsapi
Name: cdsapi
Version: 0.7.7
Summary: Climate Data Store API
Home-page: https://github.com/ecmwf/cdsapi
Author: ECMWF
Author-email: software.support@ecmwf.int
License: Apache 2.0
Location: /opt/miniconda3/envs/geo/lib/python3.12/site-packages
Requires: ecmwf-datastores-client, requests, tqdm
Required-by:

Accompanying data

No response

Organisation

University of Maryland Baltimore County (UMBC), MD, USA

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0