code: def _prep_time_data(ds):
      
      ds = times.ensure_time_as_index(ds)
      if TIME_BOUNDS_STR in ds:
          ds = times.ensure_time_avg_has_cf_metadata(ds)
          ds[TIME_STR] = times.average_time_bounds(ds)
      else:
          logging.warning("dt array not found.  Assuming equally spaced "
                          "values in time, even though this may not be "
                          "the case")
          ds = times.add_uniform_time_weights(ds)
      # Suppress enable_cftimeindex is a no-op warning; we'll keep setting it for
      # now to maintain backwards compatibility for older xarray versions.
      with warnings.catch_warnings():
          warnings.filterwarnings('ignore')
          with xr.set_options(enable_cftimeindex=True):
              ds = xr.decode_cf(ds, decode_times=True, decode_coords=False,
                                mask_and_scale=True)
      return ds
docs: Prepare time coordinate information in Dataset for use in aospy.
  
      1. If the Dataset contains a time bounds coordinate, add attributes
         representing the true beginning and end dates of the time interval used
         to construct the Dataset
      2. If the Dataset contains a time bounds coordinate, overwrite the time
         coordinate values with the averages of the time bounds at each timestep
      3. Decode the times into np.datetime64 objects for time indexing
  
      Parameters
      ----------
      ds : Dataset
          Pre-processed Dataset with time coordinate renamed to
          internal_names.TIME_STR
  
      Returns
      -------
      Dataset
          The processed Dataset