1

I am trying to append the same attribute ("standard_name") to the variable latitude in multiple netcdf files.

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

I want to make a loop in bash to filter through these files and make the necessary changes. I am using ncatted from NCO, but am new to bash scripts.

1 Answer 1

2
for fl in `ls *.nc` ; do
  ncatted -h -a standard_name,latitude,o,c,latitude ${fl}
done
Sign up to request clarification or add additional context in comments.

2 Comments

To make your answer useful, you should post an explanation of what it does and not only some code.
Thanks @Charlie Zender. Just what I was looking for!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.