简体   繁体   English

如何使用 cdo 气候命令?

[英]How to use cdo climate command?

I want to subset a NetCDF file to extract a sub-period with cdo.我想对 NetCDF 文件进行子集化以使用 cdo 提取子时段。

I run the following code in spyder我在 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 :我使用 spyder 3.10 并收到消息:

TypeError: expected str, bytes or os.PathLike object, not NoneType TypeError:预期的 str、字节或 os.PathLike 对象,而不是 NoneType

when I run cdo = Cdo()当我运行cdo = Cdo()

  1. Maybe I should not run cdo in spyder?也许我不应该在 spyder 中运行 cdo ?
  2. Does the command is correct?命令是否正确?

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...我最近在 mac 上进行自制升级后Cdo()命令出现问题,卸载 cdo 包然后重新安装它为我解决了它...

However, are you sure the error is in the cdo=Cdo() command?但是,您确定错误在cdo=Cdo()命令中吗? I notice you have an underscore in "end_date", is that a typo in your question or also in your code?我注意到您在“end_date”中有一个下划线,这是您的问题还是您的代码中的错字?

What about using seldate if you are only selecting dates?如果您只选择日期,那么使用seldate怎么样?

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM