Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
PratyushTripathy committed Jul 8, 2019
1 parent bbfcebb commit 858683d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,25 @@ Make sure your current working directory is the same where the raster files are

Please skip the above two lines of code if the directory is already set to the files location.<br/>

To read all bands of a stacked satellite image:<br>
To read bands of a stacked satellite image,<br>
(1) For all bands:<br/>
`dataSource, yourArray = raster.read(file, bands='all')`<br/>
Which returns the data source containing projection information, and a NumPy array.<br/>

To read a list of bands from stacked images:<br/>
(2) For list of bands:<br/>
`dataSource, yourArray = raster.read(file, bands=[2, 3, 4])`<br/>
Which returns bands 2, 3 & 4 as three-dimensional NumPy array.<br/>

To read a specific band from stacked image:<br/>
(3) For a specific band:<br/>
`dataSource, yourArray = raster.read(file, bands=2)`<br/>
Which returns band number 2 as two-dimensional NumPy array.<br/>

To export the bands from the above read data,<br/>
(1) For all bands:<br/>
`raster.export(yourArray, dataSource, "sample_extracted.tif", dtype='int', bands='all')`<br/>
By default, `dtype = 'int'`, to export float type array (eg. NDVI), use `dtype = 'float'`<br\>
By default, `dtype = 'int'`, to export float type array (eg. NDVI), use `dtype = 'float'`<br/>

(2) For list of bands:<br/>
`raster.export(yourArray, dataSource, "sample_extracted.tif", bands=[2, 3, 4])`<br/>
Expand Down

0 comments on commit 858683d

Please sign in to comment.