2

我是新来的 Python 初学者,所以请放轻松。我曾经使用 pvlib-python 预测模块和 GFS 模型使用get_data()方法成功预测 GHI 和环境温度两年多没有问题,但一周前(更新到 0.8.1 版本后)我遇到以下错误作为查询数据时来自 UNIDATA THREDDS 服务器的答案:

HTTPError: Error accessing https://thredds.ucar.edu/thredds/ncss/grib/NCEP/GFS/Global_0p5deg/Best?var=u-component_of_wind_isobaric&var=Total_cloud_cover_low_cloud_Mixed_intervals_Average&var=Total_cloud_cover_boundary_layer_cloud_Mixed_intervals_Average&var=Total_cloud_cover_middle_cloud_Mixed_intervals_Average&var=Wind_speed_gust_surface&var=Temperature_surface&var=Total_cloud_cover_entire_atmosphere_Mixed_intervals_Average&var=Total_cloud_cover_convective_cloud&var=Total_cloud_cover_high_cloud_Mixed_intervals_Average&var=Downward_Short-Wave_Radiation_Flux_surface_Mixed_intervals_Average&var=v-component_of_wind_isobaric&time_start=2021-04-27T23%3A00%3A00%2B02%3A00&time_end=2021-04-30T02%3A00%3A00%2B02%3A00&longitude=15.966568&latitude=45.815399&vertCoord=100000&accept=netcdf
Server Error (400: Variable: Total_cloud_cover_low_cloud_Mixed_intervals_Average is not contained in the requested dataset)

显然,向服务器发送请求时变量Total_cloud_cover_low_cloud_Mixed_intervals_Average不可用。UNIDATA THREDDS我在互联网上搜索了这个问题,但没有发现类似的问题。我还在预测模块的 pvlib 源代码中找到了GFS类,该变量Total_cloud_cover_low_cloud_Mixed_intervals_Average被重命名为low_cloudshttps://pvlib-python-forecasting.readthedocs.io/en/latest/_modules/pvlib/forecast.html)。

这是我用来产生错误的代码:

import datetime
from pvlib.forecast import GFS
import pytz

loc_latitude, loc_longitude, tzone = 45.815399, 15.966568, 'Europe/Zagreb'

today_date = datetime.date.today()
naive_time = datetime.time(0, 0, 0)
naive_datetime = datetime.datetime.combine(today_date, naive_time)
timezone = pytz.timezone('Europe/Zagreb')

#timezone aware datetime
aware_datetime = timezone.localize(naive_datetime)
GFS_start = aware_datetime
GFS_end = aware_datetime + datetime.timedelta(days = 2)

GFS_forecast_model = GFS()
GFS_raw_data = GFS_forecast_model.get_data(latitude = loc_latitude, longitude = loc_longitude, start = GFS_start, end = GFS_end)

我还尝试使用 NAM 模型而不是 GFS 并且一切正常,但我不能使用它,因为只有 GFS 全球预测(我需要欧洲的预测)。我在 Python 3.6.6 中使用 anaconda。并且 pvlib-python 0.8.1 是使用 conda 安装的。我可以提供所需的任何其他信息。我将不胜感激任何帮助。

4

1 回答 1

0

在做了一些进一步的研究后,我发现这个问题已经被报告并解决了——github。GFS 更改了一些云量变量。这将在新版本的pvlib中实现。

于 2021-04-25T19:17:32.817 回答