如何使用 ncatted 在多个 netcdf 文件中附加一个变量?

How to append a variable in multiple netcdf files using ncatted?

我正在尝试将相同的属性 ("standard_name") 附加到 多个 netcdf 文件中的变量纬度。

ncatted -h -a standard_name,latitude,o,c,latitude agu028.nc

我想在 bash 中创建一个循环来过滤这些文件并进行必要的更改。我正在使用 NCO 的 ncatted,但我是 bash 脚本的新手。

for fl in `ls *.nc` ; do
  ncatted -h -a standard_name,latitude,o,c,latitude ${fl}
done