[英]Earth Engine / Python / EEException: User memory limit exceeded
我正在尝试从 GFS0P25 数据集中加载并绘制指定位置的每日风速。 我收到以下错误“EEException:超出用户内存限制”。 在“wind.select('u_component_of_wind_10m_above_ground').filterDate(i_date,f_date)”这一行。
我知道地球引擎的内存限制。 如何改进查询以便加载日平均风速并克服内存限制?
问题是每次每个位置都有很多行数据——我已经在后面的代码中进行了每日平均计算,但它没有解决内存问题。
谢谢你的帮助!
注意:我已经隐藏了服务帐户和凭据 - 请使用您自己的登录名,谢谢!
import ee
import pandas as pd
#service_account = 'xxx'
#credentials = ee.ServiceAccountCredentials(service_account, 'C:/Data/ee-xxxx.json')
#ee.Initialize(credentials)
# # Trigger the authentication flow.
ee.Authenticate()
# # Initialize the library.
ee.Initialize()
wind = ee.ImageCollection('NOAA/GFS0P25')
i_date = '2022-01-01'
f_date = '2022-07-01'
wind=wind.select('u_component_of_wind_10m_above_ground').filterDate(i_date,f_date) ####TRACEBACK HERE
u_lon = 21.450520
u_lat = 63.941972
u_poi = ee.Geometry.Point(u_lon, u_lat)
scale = 1000 # scale in meters
wind_u = wind.getRegion(u_poi, scale).getInfo()
wind_u[:5]
df = pd.DataFrame(wind_u)
headers = df.iloc[0]
df = pd.DataFrame(df.values[1:], columns=headers)
df['u_component_of_wind_10m_above_ground'] = pd.to_numeric(df['u_component_of_wind_10m_above_ground'], errors='coerce')
df['id'] = df['id'].str.slice(0,8)
df['id'] = pd.to_datetime(df['id'], format='%Y%m%d')
# Keep the columns of interest.
df = df[['id','u_component_of_wind_10m_above_ground']]
df=df.groupby('id').mean().reset_index()
import plotly.express as px
import webbrowser
fig = px.scatter(df, x="id", y="u_component_of_wind_10m_above_ground")
fig.show()
fig.write_html("c:/data/windchart.html")
webbrowser.open("c:/data/windchart.html")
根据NOAA/GFS0P25 数据集描述,每 6 小时给出 384 个预测。
考虑到您的脚本,这意味着您要对一系列包含大约 6(months)*30(days)*6(hours)*384(entry) = 414 720 个值的系列询问getInfo()
,这超出了限制。
在您的情况下,您似乎想要风速的每日平均值。 因此,我会这样做:
然后你就可以在你感兴趣的时期做你的wind.getRegion(u_poi, scale).getInfo()
。
我希望它会有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.