Accessing Coordinates Practice#
Accessing Raster Coordinates#
Below is the filepath for a new AVIRIS image. What is the crs of the raster? What are the bounds and the unit of the bounds?
filepath = './data/subset_f131205t01p00r10rdn_e_sc01_ort_img'
What are the coordinates in UTM of the upper left corner of the aviris raster?
What is the area covered by the raster in units of km^2?
What are the coordinates in epsg:4326 of the upper left corner of the aviris raster?
Create a polygon shapely object of the bounding box of the raster.
Convert the polygon bbox to epsg:4326 coordinates
Affine Transformation#
Pick a row and a column out of the middle of the dataset. Use an affine tranformation to get the easting and northing of that data point.
Using the epsg:4326 bounding box in problem 5 pick a coordinate location inside that bounding box. Find the pixel location of that coordinate.
Find the pixel number for the utm coordinates 575666, 4170999. What is the sign of the pixels? What does that tell you about the coordinates?
Subsetting Data#
Read in your whole raster of data. Use the numpy array to get just a ~100 pixel cube of data out of your raster.
Now get a different subset of the raster, but this time specify which part of the raster you want using a
Window()
object.
You are looking at an AVIRIS image that is 12 GB large and you are using a computer with 16GB of RAM. Which method of subsetting – numpy indexing or Window reading – are you going to use? Why?
The metadata from a raster file looks something like this:
{'driver': 'ENVI', 'dtype': 'int16', 'nodata': None, 'width': 150, 'height': 300, 'count': 224, 'crs': CRS.from_epsg(32611), 'transform': Affine(1.0348265452795135e-15, 16.9, 238135.11,
16.9, -1.0348265452795135e-15, 3766293.0)}
When you do a windowed read to get a subset of data, which 4 pieces of metadata will likely change?