[Workaround]: write data to netcdf file twice; several big fix.