Skip to content

Conversation

kandersolar
Copy link
Member

  • Closes ERA5 single-point time series database #2420
  • I am familiar with the contributing guidelines
  • Tests added
  • Updates entries in docs/sphinx/source/reference for API changes.
  • Adds description and name entries in the appropriate "what's new" file in docs/sphinx/source/whatsnew for all changes. Includes link to the GitHub Issue with :issue:`num` or this Pull Request with :pull:`num`. Includes contributor name and/or GitHub username (link with :ghuser:`user`).
  • New code is fully documented. Includes numpydoc compliant docstrings, examples, and comments where necessary.
  • Pull request is nearly complete and ready for detailed review.
  • Maintainer: Appropriate GitHub Labels (including remote-data) and Milestone are assigned to the Pull Request and linked Issue.

As described in #2420, the ECMWF CDS now provides a simple and fast API for retrieving timeseries ERA5 data. No need for any new dependencies (not even cdsapi), although the nature of the API requires a sequence of requests, and one poll-and-wait step, to complete.

@kandersolar kandersolar added this to the v0.13.2 milestone Oct 17, 2025
@kandersolar kandersolar added enhancement remote-data triggers --remote-data pytests labels Oct 17, 2025
@kandersolar kandersolar added remote-data triggers --remote-data pytests and removed remote-data triggers --remote-data pytests labels Oct 17, 2025
@kandersolar kandersolar added remote-data triggers --remote-data pytests and removed remote-data triggers --remote-data pytests labels Oct 17, 2025
@kandersolar kandersolar added remote-data triggers --remote-data pytests and removed remote-data triggers --remote-data pytests labels Oct 17, 2025
@AdamRJensen
Copy link
Member

Discussion on available parameter though the ERA5 time series API can be found here.

@AdamRJensen
Copy link
Member

Right now you can't pass pvlib variable names as strings:

This doesn't work:

variables = 'ghi'

data, meta = pvlib.iotools.get_era5(
    latitude, longitude, start, end, variables, api_key, timeout=60)

Copy link
Member

@AdamRJensen AdamRJensen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a phenomenal contribution 🥳

I do suggest renaming the module to "era5" instead of "ecmwf" as I foresee we might add other datasets such as the IFS forecasts, where it would be preferred to have the code in different files.

Comment on lines +110 to +111
start = pd.to_datetime(start).strftime("%Y-%m-%d")
end = pd.to_datetime(end).strftime("%Y-%m-%d")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these be localized to UTC first?

'reducing the request size.'
)

time.sleep(1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could consider reducing this to 0.5

@kandersolar kandersolar added remote-data triggers --remote-data pytests and removed remote-data triggers --remote-data pytests labels Oct 20, 2025
Comment on lines +25 to +56
def same(x):
return x


def k_to_c(temp_k):
return temp_k - 273.15


def j_to_w(j):
return j / 3600


def m_to_cm(m):
return m / 100


UNITS = {
'u100': same,
'v100': same,
'u10': same,
'v10': same,
'd2m': k_to_c,
't2m': k_to_c,
'msl': same,
'sst': k_to_c,
'skt': k_to_c,
'sp': same,
'ssrd': j_to_w,
'strd': j_to_w,
'tp': m_to_cm,
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefix all of this with _ to discourage others from using it, even within pvlib.

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

Labels

enhancement remote-data triggers --remote-data pytests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ERA5 single-point time series database

3 participants