add regrid function