I have a netCDF in a rotated lat lon grid (file-a). I also have another file which contains the right lats and lons as two different variables (file-b). What I need to do is import the lats and lons from file-b to my variable in file-a as attributes. How could I do that?

1 Answer 1


This doesn't do it as NetCDF attributes, (I'm not sure what that would mean) but since they are different variables, you could use the NetCDF Operator tool ncks to extract the new variables from file_b and paste them onto the file_a:

ncks -A -v latnew,lonnew file_b.nc file_a.nc

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.