Skip to content

Deprecate ECMWF MACC #1729

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/sphinx/source/whatsnew/v0.9.6.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ v0.9.6 (Anticipated June 2023)

Deprecations
~~~~~~~~~~~~
* The ``pvlib.iotools.get_ecmwf_macc`` and ``pvlib.iotools.read_ecmwf_macc`` functions
are deprecated. The reason is that ECMWF has retired the dataset. Users are recommended
to use alternative newer reanalysis datasets such as ERA5 or MERRA-2.
(:issue:`1691`, :pull:`1729`)


Enhancements
Expand Down
13 changes: 13 additions & 0 deletions pvlib/iotools/ecmwf_macc.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

import threading
import pandas as pd
import warnings
from pvlib._deprecation import pvlibDeprecationWarning

try:
import netCDF4
Expand Down Expand Up @@ -168,6 +170,11 @@ def get_ecmwf_macc(filename, params, start, end, lookup_params=True,
t = threading.Thread(target=target, daemon=True,
args=(server, startdate, enddate, params, filename))
t.start()

warnings.warn(
'The ``get_ecmwf_macc`` function is deprecated starting in pvlib'
'v0.9.6. The function will be removed starting in pvlib v0.10.0',
pvlibDeprecationWarning)
return t


Expand Down Expand Up @@ -309,4 +316,10 @@ def read_ecmwf_macc(filename, latitude, longitude, utc_time_range=None):
df['precipitable_water'] = df[ECMWF_MACC.TCWV] / 10.0
finally:
ecmwf_macc.data.close()

warnings.warn(
'The ``read_ecmwf_macc`` function is deprecated starting in pvlib'
'v0.9.6. The function will be removed starting in pvlib v0.10.0',
pvlibDeprecationWarning)

return pd.DataFrame(df, index=times.astype('datetime64[s]'))