write metadata to ncfile