'Perform a sync-to-disk flush if the `netcdf_file` object is in write mode.
See Also
sync : Identical function'

def flush(self):

    if (hasattr(self, 'mode') and (self.mode in 'wa')):
        self._write()
