如何使用CDO气候命令?

发布于 2025-01-31 03:49:54 字数 420 浏览 3 评论 0 原文

我想将NETCDF文件子集以用CDO提取子页面。

我在Spyder中运行以下代码,

 from cdo import *
cdo = Cdo()

cdo.select('startdate=2003-01-01,end_date=2016-12-31', input='PATH/temperature.nc', output='output.nc')

我使用Spyder 3.10并传达消息:

TypeError:预期的str,字节或OS.Pathike对象,而不是非型

当我运行 cdo = cdo()时,

  1. 不是非电视,也许我不应该在spyder中运行cdo?
  2. 命令正确吗?

I want to subset a NetCDF file to extract a sub-period with cdo.

I run the following code in spyder

 from cdo import *
cdo = Cdo()

cdo.select('startdate=2003-01-01,end_date=2016-12-31', input='PATH/temperature.nc', output='output.nc')

I use spyder 3.10 and have the message :

TypeError: expected str, bytes or os.PathLike object, not NoneType

when I run cdo = Cdo()

  1. Maybe I should not run cdo in spyder?
  2. Does the command is correct?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

神经大条 2025-02-07 03:49:54

我在Mac上进行自制升级后与 cdo()命令有一个问题

最近, 在 cdo = cdo()命令中?我注意到您在“ end_date”中有一个下划线,这是您的问题中的错字还是代码中的错字?

如果仅选择日期,使用 seldate 怎么办?

from cdo import *
cdo = Cdo()
cdo.seldate('2003-01-01,2016-12-31', input='PATH/temperature.nc', output='output.nc')

I recently had an issue with the Cdo() command after a homebrew upgrade on a mac, and uninstalling the cdo package and then reinstalling it solved it for me...

However, are you sure the error is in the cdo=Cdo() command? I notice you have an underscore in "end_date", is that a typo in your question or also in your code?

What about using seldate if you are only selecting dates?

from cdo import *
cdo = Cdo()
cdo.seldate('2003-01-01,2016-12-31', input='PATH/temperature.nc', output='output.nc')
怂人 2025-02-07 03:49:54

我遇到了一个非常相似的问题,就我的情况而言,问题是关于窗口的,因为无法使用CDO。目前,Windows系统中不支持CDO,并且Windows Conda存储库中的二进制文件不可用。
克服这一障碍的可能方法是WSL,它模仿了Windows系统中的UNIX。然后,应下载CDO的UNIX。更详细的说明是在CDO用户指南中 - > 1.1安装。
还有网站的链接:

I have experienced a very similar problem, in my case problem is about the Windows as it is not possible to use CDO. Right now CDO is not supported in Windows system and the binary is not available in the windows conda repository.
Possible ways to overcome this obstacle is WSL, which emulates Unix in your Windows system. Then CDO should be downloaded for Unix. More detailed explanation is in CDO user guide -> 1.1 Installation.
Also the link of website: https://code.mpimet.mpg.de/projects/cdo/embedded/index.html#x1-30001.1

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文