Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.07 KB | None | 0 0
  1. img=gdal.Open("D:datasub_66")
  2. inputArray=img.ReadAsArray()
  3.  
  4. from osgeo import gdal
  5. import sys
  6. import numpy as np
  7.  
  8. img = gdal.Open( "D:datasub_66.tif" ) # This is an example, please use the real extension of the image file instead of '.tif'
  9.  
  10. for band in range( img.RasterCount ):
  11. band += 1
  12. print "[ GETTING BAND ]: ", band
  13. srcband = img.GetRasterBand(band)
  14. inputArray = np.array(img.GetRasterBand(1).ReadAsArray())
  15. print "[ ARRAY ]: ", inputArray
  16.  
  17. [ GETTING BAND ]: 1
  18. [ ARRAY ]: [[1900 1900 1898 1895 1892 1887 1879 1871 1863 1852 1845 1837 1824 1802
  19. 1743 1725 1713 1705 1699 1693 1687 1683]
  20. [1897 1896 1894 1892 1890 1884 1877 1869 1862 1854 1847 1838 1820 1800
  21. 1745 1729 1719 1712 1706 1701 1696 1695]
  22. [1892 1891 1890 1888 1885 1881 1875 1868 1861 1855 1849 1837 1817 1794
  23. 1747 1732 1725 1720 1714 1710 1707 1706]
  24. [1887 1885 1884 1882 1880 1878 1873 1867 1860 1855 1849 1833 1815 1789
  25. 1749 1738 1732 1728 1723 1720 1718 1715]
  26. [1882 1880 1878 1876 1875 1873 1871 1866 1861 1855 1849 1832 1817 1795
  27. 1756 1744 1740 1737 1733 1730 1728 1725]
  28. [1880 1877 1874 1873 1870 1868 1867 1865 1860 1855 1850 1841 1834 1817
  29. 1795 1769 1749 1746 1743 1740 1736 1731]
  30. [1880 1876 1873 1870 1869 1866 1863 1862 1859 1856 1852 1847 1843 1841
  31. 1824 1812 1802 1775 1758 1747 1740 1733]
  32. [1879 1876 1873 1870 1869 1866 1863 1860 1858 1855 1852 1850 1847 1843
  33. 1831 1819 1803 1782 1763 1747 1738 1730]
  34. [1879 1877 1874 1872 1869 1866 1864 1861 1858 1855 1852 1850 1850 1848
  35. 1836 1816 1794 1775 1754 1744 1736 1728]
  36. [1880 1877 1875 1872 1869 1867 1864 1862 1858 1854 1850 1848 1850 1850
  37. 1840 1806 1786 1767 1749 1742 1734 1726]
  38. [1881 1879 1876 1873 1870 1866 1864 1861 1857 1851 1843 1840 1841 1850
  39. 1827 1797 1782 1769 1752 1742 1733 1723]
  40. [1882 1879 1876 1873 1870 1867 1864 1861 1855 1848 1839 1835 1833 1836
  41. 1810 1794 1783 1771 1758 1747 1737 1729]
  42. [1882 1880 1876 1873 1869 1866 1862 1858 1854 1849 1838 1833 1826 1814
  43. 1800 1792 1782 1773 1762 1752 1742 1733]
  44. [1881 1878 1874 1870 1867 1863 1860 1856 1853 1849 1840 1835 1821 1813
  45. 1798 1790 1783 1774 1766 1757 1748 1738]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement