code: def _read_variogram(f):
      
  
      line = ''
      vartype = None
      bearing = 0.0
      a = None
      anisotropy = 1.0
      while "end variogram" not in line:
          line = f.readline()
          if line == '':
              raise Exception("EOF while read variogram")
          line = line.strip().lower().split()
          if line[0].startswith('#'):
              continue
          if line[0] == "vartype":
              vartype = int(line[1])
          elif line[0] == "bearing":
              bearing = float(line[1])
          elif line[0] == "a":
              a = float(line[1])
          elif line[0] == "anisotropy":
              anisotropy = float(line[1])
          elif line[0] == "end":
              break
          else:
              raise Exception("unrecognized arg in variogram:{0}".format(line[0]))
      return vartype,bearing,a,anisotropy
docs: Function to instantiate a Vario2d from a PEST-style structure file
  
      Parameters
      ----------
      f : (file handle)
          file handle opened for reading
  
      Returns
      -------
      Vario2d : Vario2d
          Vario2d derived type