Skip to content
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

修复一个小bug,绘制直接通过网络获取era5单个文件的图形时,会提示‘time’ key error~ #13

Open
xzcr2000 opened this issue Jul 23, 2024 · 0 comments

Comments

@xzcr2000
Copy link

xzcr2000 commented Jul 23, 2024

主要是因为单个文件没有'time'这个维度,所以无法split,修复思路是增加‘time’维度,具体操作如下:
修改era5_manual_download.py
1._era5_psl_download函数中_split_psl函数增加dt_start参数
2.那么def _split_psl函数时,也要增加dt_start参数
3.在def _split_psl函数‘for dt_utc in data['time'].values:’前增加如下代码
if 'time' not in data.dims: # 单个时次
time_index = pd.to_datetime([data['valid_time'].values]) #'valid_time'已是世界时,无需再调整
data = data.expand_dims(dim='time', axis=0)
data.coords['time'] = ('time', time_index)
附上修改后的文件:
era5_manual_download.txt
4.但只修改了等压面的,地面的应该也有同样问题,修复思路是一样的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant