  >>> from liblas import vlr
  >>> v = vlr.VLR()
  >>> v.reserved
  43707
  >>> v.recordid
  0
  >>> v.recordid = 2
  >>> v.recordid
  2
  >>> str(v.userid.decode())
  ''
  >>> v.userid = b'liblas.org'
  >>> str(v.userid.decode())
  'liblas.org'

  >>> str(v.description.decode())
  ''
  >>> v.description = b'libLAS'
  >>> str(v.description.decode())
  'libLAS'

  >>> v.recordlength = 256
  >>> v.recordlength
  256

  >>> import ctypes
  >>> data = (ctypes.c_ubyte * 256)()
  >>> data[10]
  0

  >>> for i in range(256):
  ...     data[i] = 2+i

  >>> data[10]
  12
  >>> v.data = data

# Ensure we can round trip the data
  >>> [data[i] for i in range(10)]
  [2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
  >>> [v.data[i] for i in range(10)]
  [2, 3, 4, 5, 6, 7, 8, 9, 10, 11]

# Ensure poking one array doesn't affect the other
  >>> data[1] = 32
  >>> v.data = data
  >>> data[1] = 3
  >>> v.data[1]
  32
  >>> data[1]
  3

  >>> [v.data[i] for i in range(10)]
  [2, 32, 4, 5, 6, 7, 8, 9, 10, 11]

  >>> import liblas

#  >>> liblas.HAVE_GDAL
#  >>> liblas.HAVE_LIBGEOTIFF

  >>> from liblas import file
  >>> f = file.File('../test/data/srs.las')
  >>> h = f.header
  >>> int(h.records_count)
  3

  >>> def test_srs():
  ...     s = h.srs
  ...     if not liblas.HAVE_LIBGEOTIFF:
  ...         return True
  ...     if not liblas.HAVE_GDAL:
  ...         return s.proj4 == '+proj=utm +zone=17 +ellps=WGS84 +units=m '
  ...     if liblas.HAVE_GDAL:
  ...         return s.proj4 == '+proj=utm +zone=17 +datum=WGS84 +units=m +no_defs '
  ...     return False

  >>> test_srs()
  True


  >>> v = h.GetVLR(0)
  >>> v.recordid
  34735
  >>> str(v.userid.decode())
  'LASF_Projection'

  >>> data = v.data
  >>> len(data)
  72
  >>> data[6]
  8

  # Deleting a VLR shouldn't change the offset
  >>> int(h.data_offset)
  759
  >>> h.DeleteVLR(0)
  >>> int(h.data_offset)
  759

  >>> del f

  >>> f = file.File('../test/data/srs.las')
  >>> h = f.header
  >>> int(f.header.data_offset)
  759
  >>> f2 = file.File('junk_srs.las',mode='w',header=h)
  >>> for p in f:
  ...     f2.write(p)

  >>> f2.close()
  >>> del f2

  >>> f3 = file.File('junk_srs.las')
  >>> int(f3.header.records_count)
  3
  >>> int(f3.header.data_offset)
  759
  >>> import os
  >>> os.remove('junk_srs.las')
