I am doing research to find chlorophyll values from satellite images using neural network regression. For that purpose, first, as data acquisition and preprocessing, I would like to write about how to specify the latitude and longitude from satellite image data and acquire the pixel value at that point. Before that, what is a satellite image? ↓ Basics of satellite data
Use the Landsat 8 image. It is published as open data on AWS. AWS Landsat Data Landsat image data published on AWS can be searched by location by specifying path and row. By the way, since we will use the data of Lake Biwa this time, we searched for the data of path 110 row 35 and obtained it. The above page has a complete list of available scenes, so I sorted them by path and row to get them.
Click here for how to check path and row ↓ path/row coverter
Use ** rasterio ** and ** pyproj **. ** rasterio ** is a library for handling raster data. rasterio ** pyproj ** is a library that transforms the coordinate system. pyproj The Landsat data is in Geotif file format, and the coordinate data is embedded as a tag, but since it uses UTM coordinates, it needs to be converted from latitude / longitude to the UTM coordinate system.
import rasterio as rio import pyproj
↑ Please install it with pip etc. in advance.
B5 = rio.open ('file path')
utm = pyproj.Proj(B5.crs) lonlat = pyproj.Proj(init='epsg:4326') lat,lon = (35.445,136.0638888889) east,north = pyproj.transform(lonlat,utm,lon,lat)
Verify that the latitude and longitude have been converted to the UTM coordinate system.
east,north (596554.9414823324, 3922913.584464462)
The data is of type array, and you can get the row and column corresponding to the coordinates with the index method.
row, col = B5.index(east,north)
print(f'row,col=({row},{col})') row,col=(6086,5625)
Also, the following code is required to access the pixel values of the array data.
B5read = B5.read(1)
This 1 is the index of the band of the satellite image, but this time there is only one band 5, so specify 1.
B5read[row,col]
21530
That's all, now you can easily find the pixel value of the specified point from latitude and longitude. However, this pixel value is called the DN value, which is influenced by the intensity and angle of the sun's light, and is a reflection called TOA to be used for inputting a neural network that uses the chlorophyll value as an output. I'm thinking of converting it to a rate. I'd really like to find pure SR (Surface Reflectance) for atmospheric correction, but it's difficult, so I'll give up this time and introduce how to find TOA next time. ** Click here for satellite image processing level ↓ ** Illustration! What is satellite data preprocessing
Thank you for reading to the end!