class_docstr: A pickler to persist of big data efficiently.
  
  The main features of this object are:
  
   * persistence of numpy arrays in separate .npy files, for which
     I/O is fast.
  
   * optional compression using Zlib, with a special care on avoid
     temporaries.
class_docstr_tok: ["A","pickler","to","persist","of","big","data","efficiently",".","The","main","features","of","this","object","are",":","*","persistence","of","numpy","arrays","in","separate",".npy","files",",","for","which","I\/O","is","fast",".","*","optional","compression","using","Zlib",",","with","a","special","care","on","avoid","temporaries","."]
docstr: Subclass the save method, to save ndarray subclasses in npy
  files, rather than pickling them. Of course, this is a
  total abuse of the Pickler class.
docstr_tok: ["Subclass","the","save","method",",","to","save","ndarray","subclasses","in","npy","files",",","rather","than","pickling","them",".","Of","course",",","this","is","a","total","abuse","of","the","Pickler","class","."]
code: def save(self, obj):
      """Subclass the save method, to save ndarray subclasses in npy
      files, rather than pickling them. Of course, this is a
      total abuse of the Pickler class.
      """
      if self.np is not None and type(obj) in (
          self.np.ndarray,
          self.np.matrix,
          self.np.memmap,
      ):
          size = obj.size * obj.itemsize
          if self.compress and size < self.cache_size * _MEGA:
              # When compressing, as we are not writing directly to the
              # disk, it is more efficient to use standard pickling
              if type(obj) is self.np.memmap:
                  # Pickling doesn't work with memmaped arrays
                  obj = self.np.asarray(
                      obj
                  )  # FIXME: really? test this...
              return Pickler.save(self, obj)
          self._npy_counter += 1
          try:
              filename = "%s_%02i.npy" % (
                  self._filename,
                  self._npy_counter,
              )
              # This converts the array in a container
              obj, filename = self._write_array(obj, filename)
              self._filenames.append(filename)
          except:
              self._npy_counter -= 1
              # XXX: We should have a logging mechanism
              print(
                  "Failed to save %s to .npy file:\n%s"
                  % (type(obj), traceback.format_exc())
              )
      return Pickler.save(self, obj)
  
imports: import traceback
  import os
  import zlib
  import warnings
  import dill
  import pickle
  from io import BytesIO
label_desc: Use image node_id 3 for calling the NumpyPickler obj's underlying member method code with example usage: obj.save(obj) and returns: Pickler, Pickler