code: def _convert_data_to_hourly(self, gssha_data_var):
          time_step_hours = np.diff(self.data.time)[0]/np.timedelta64(1, 'h')
          calc_function = self._get_calc_function(gssha_data_var)
          resampled_data = None
          if time_step_hours < 1:
              resampled_data = self.data.resample('1H', dim='time',
                                                  how=calc_function,
                                                  keep_attrs=True)
          elif time_step_hours > 1:
              resampled_data = self.data.resample('1H', dim='time',
                                                  keep_attrs=True)
              for time_idx in range(self.data.dims['time']):
                  if time_idx+1 < self.data.dims['time']:
                      start_time = self.data.time[time_idx].values
                      end_time = self.data.time[time_idx+1].values
                      slope_timeslice = slice(str(start_time), str(end_time))
                      slice_size = resampled_data.sel(time=slope_timeslice).dims['time'] - 1
                      first_timestep = resampled_data.sel(time=str(start_time))[gssha_data_var]
                      slope = (resampled_data.sel(time=str(end_time))[gssha_data_var]
                               - first_timestep)/float(slice_size)
                      data_timeslice = slice(str(start_time+np.timedelta64(1, 'm')),
                                              str(end_time-np.timedelta64(1, 'm')))
                      data_subset = resampled_data.sel(time=data_timeslice)
                      for xidx in range(data_subset.dims['time']):
                          data_subset[gssha_data_var][xidx] = first_timestep + slope * (xidx+1)
                  else:
                      start_time = self.data.time[time_idx].values
                      end_time = resampled_data.time[-1].values
                      if end_time > start_time:
                          first_timestep = resampled_data.sel(time=str(start_time))[gssha_data_var]
                          data_timeslice = slice(str(start_time), str(end_time))
                          data_subset = resampled_data.sel(time=data_timeslice)
                          slice_size = 1
                          if calc_function == "mean":
                              slice_size = data_subset.dims['time']
                          for xidx in range(data_subset.dims['time']):
                              data_subset[gssha_data_var][xidx] = first_timestep/float(slice_size)
          if resampled_data is not None:
              if self.data.lsm.x_var not in resampled_data.coords:
                  resampled_data.coords[self.data.lsm.x_var] = self.data.coords[self.data.lsm.x_var]
              if self.data.lsm.y_var not in resampled_data.coords:
                  resampled_data.coords[self.data.lsm.y_var] = self.data.coords[self.data.lsm.y_var]
              self.data = resampled_data