diff --git a/docs/sphinx/source/whatsnew/v0.9.6.rst b/docs/sphinx/source/whatsnew/v0.9.6.rst index 86f819a784..32f19dd4f3 100644 --- a/docs/sphinx/source/whatsnew/v0.9.6.rst +++ b/docs/sphinx/source/whatsnew/v0.9.6.rst @@ -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 diff --git a/pvlib/iotools/ecmwf_macc.py b/pvlib/iotools/ecmwf_macc.py index 96902b2a9b..9e2379f04e 100644 --- a/pvlib/iotools/ecmwf_macc.py +++ b/pvlib/iotools/ecmwf_macc.py @@ -4,6 +4,8 @@ import threading import pandas as pd +import warnings +from pvlib._deprecation import pvlibDeprecationWarning try: import netCDF4 @@ -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 @@ -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]'))