Python netCDF:我不小心在 netcdf 文件中写入了不需要的变量。现在是一个简单的ds。 var 不再起作用了。我应该怎么办?

发布于 2025-01-11 11:37:38 字数 232 浏览 2 评论 0原文

我通过 xarray 打开 netCDF 文件。 ds = xr.open_dataset(文件名) 但是已经存在一个额外的变量「u」,我想我不小心写到了文件中。我不记得我是怎么做到的。 当我运行 newname = ds. var 在文件中,它不起作用。但是当我在窗口中运行相同的代码时,变量窗口中确实出现了 newname 。我应该怎么做才能让它在文件中工作,以便我可以一次处理数千个文件?

I open the netCDF file by xarray.
ds = xr.open_dataset(filename)
But there's an extra variable 「u」exsited already which I think I accidentally wrote in the file.I can't remember how I did it.
When I run newname = ds. var in the file, it doesn't work. But when I run the same code in the window, newname does occur in the variable window. What should I do to make it work in the file so that I can process thousands of files at one time?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文