code: def ds_IsEmpty(ds):
      
      out = False
      b = ds.GetRasterBand(1)
      #Looks like this throws:
      #ERROR 1: Failed to compute min/max, no valid pixels found in sampling.
      #Should just catch this rater than bothering with logic below
      try: 
          mm = b.ComputeRasterMinMax()
          if (mm[0] == mm[1]): 
              ndv = b.GetNoDataValue()
              if ndv is None:
                  out = True
              else:
                  if (mm[0] == ndv):
                      out = True
      except Exception:
          out = True 
      #Check for std of nan
      #import math
      #stats = b.ComputeStatistics(1)
      #for x in stats:
      #    if math.isnan(x):
      #       out = True
      #       break
      return out
docs: Check to see if dataset is empty after warp