netcdf - 修改netcdf文件的变量属性

标签 netcdf nco cdo-climate

我正在尝试修改 netcdf 文件中时间变量的日历类型,以将 GREGORIAN 更改为 gregorian,因为我认为这会在我尝试时引起问题在以后的分析中访问时间变量。

        double Time(Time) ;
                Time:long_name = "Time" ;
                Time:units = "days since 1979-01-01 00:00:00" ;
                Time:cartesian_axis = "T" ;
                Time:calendar_type = "GREGORIAN" ;
                Time:calendar = "GREGORIAN" ;
                Time:bounds = "Time_bounds" ;
                Time:_ChunkSizes = 1 ;

        double Time(Time) ;
                Time:long_name = "Time" ;
                Time:units = "days since 1979-01-01 00:00:00" ;
                Time:cartesian_axis = "T" ;
                Time:calendar_type = "gregorian" ;
                Time:calendar = "gregorian" ;
                Time:bounds = "Time_bounds" ;
                Time:_ChunkSizes = 1 ;

我曾尝试使用 nco 函数 nccat,但我似乎无法获得正确的语法。我试过:

ncatted -a 'calendar,time,o,c,"gregorian"' Ocean_v_1994_01.nc out.nc

最佳答案

您在 ncatted 参数周围放置的单引号导致双引号变成文字,这不是您想要的。您的论点中没有文字、空格或特殊字符,因此只需删除所有引号:

ncatted -a calendar,time,o,c,gregorian Ocean_v_1994_01.nc out.nc

关于netcdf - 修改netcdf文件的变量属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61994624/

相关文章:

RGDAL安装错误: libnetcdf. so.6:无法打开共享对象文件:没有这样的文件或目录

python - 如何在 Python 中使用 xarray 连接来自多个 netCDF 文件的数据?

bash - 将 netcdf 文件中的 float 转换为 byte

python - 计算网格 netCDF 文件中选定区域中的变量平均值

compilation - 编译并行netCDF时出错

python - 在 matplotlib 图形中绘制平滑曲线

netcdf - 在附加两个基于选择时间段的 netcdf 文件时需要帮助

Netcdf 平均多个 .nc 文件时的时间变量

python - 屏蔽格陵兰岛以外的岛屿和轮廓颜色(Python)

netcdf - 使用 NCO 从 1D 变量创建 3D 变量