【问题标题】:Extracting CRU precipitation data from netcdf into separate GeoTIFF files从 netcdf 中提取 CRU 降水数据到单独的 GeoTIFF 文件中
【发布时间】:2020-09-03 02:03:00
【问题描述】:

我想将 netcdf 格式的 CRU 降水数据提取到单独的 GeoTIFF 文件中。通常如果 netcdf 文件只有变量:lonlattimepre 我可以设法使用下面的脚本来提取它:

for t in `cdo showdate input.nc`; do
  cdo seldate,$t input.nc dummy.nc
  gdal_translate -of GTiff -a_ullr <top_left_lon> <top_left_lat> <bottom_right_lon> <bottom_right_lat> -a_srs EPSG:4326 dummy.nc $t.tif
done

CRU降水数据有变量:lonlattimeprestn

我不能使用上面的脚本,因为它包含 2 个子数据集,从 CDO 收到消息:Input file contains subdatasets. Please, select one of them for reading.

如何在CDO中选择pre变量并应用到上面的脚本中?

【问题讨论】:

    标签: cdo-climate


    【解决方案1】:

    如果您的意思是文件有多个变量,那么您可以使用命令 selvar 选择变量“pre”,然后您可以将其通过管道传递给 seldate:

    cdo seldate,$t -selvar,pre input.nc dummy.nc
    

    【讨论】:

    • 谢谢!它奏效了。我将使用您的建议进行下一次分析。之前在找到你的方式之前,我使用了cdo delname,stn input.nc output.nc,删除变量stn,然后使用我上面的脚本执行,工作但效率不高:)
    猜你喜欢
    • 2021-03-29
    • 2021-08-02
    • 1970-01-01
    • 2022-07-16
    • 1970-01-01
    • 1970-01-01
    • 2023-03-07
    • 1970-01-01
    • 2021-11-18
    相关资源
    最近更新 更多