Reading remote sensing image information

Author : xuzhiping   2023-02-06 14:42:55 Browse: 1282
Category : Space Technology

Abstract: All the methods in this paper can read the remote sensing image information, but they are only limited to obtaining the metadata ...

All the methods in this paper can read the remote sensing image information, but they are only limited to obtaining the metadata information in general, and cannot be specific to the pixel processing.

Open the existing GeoTiff

GDAL cannot open the image through with and will report an error

GDAL opens the image in a simple way. You can open the image directly by gdal. open (...).

It is not necessary to declare the driver used in the previous chapter.

L1b1 = gdal.Open ('N11_RPRO_AVH_L1B_1P_19920417T060234_19920417T060633_018353...\\ image.l1b')
Tif1 = gdal.Open ('I:\\ MasterLife\\ Resources and Environment remote Sensing\\ Experimental assignment 1\ caijian2.tif')

Pass through dir(l1b1) You can view all the methods under the dataset that opens the image.

View image description information

l1b1.GetDescription() Method can view the description information of the current image, usually returning the calling path of the image.

L1b1.GetDescription ()
# D:\ Anaconda\ envs\ GDAL_Learning\ python.exe I:\ PythonLearning\ Learning\ GDAL_Learning\ demo3_ Open GeoTiff.py
# I:\ MasterLife\ remote Sensing Mechanism\ closing assignment\ N11_RPRO_AVH_L1B_1P_19920417T060234_19920417T060633_018353_v0100\ N11_RPRO_AVH_L1B_1P_19920417T060234_19920417T060633_018353\ N11_RPRO_AVH_L1B_1P_19920417T060234_19920417T060633_018353\ image.l1b

View image metadata

l1b1.GetMetadata() The metadata of the image can be obtained, and the metadata results of different images are different.

L1b1.GetMetadata ()
# {'DATASET_NAME':' BRN.HRPT.NH.D92108.S0607.E0603.B1835353.MN', 'DATA_TYPE':' AVHRR HRPT', 'LOCATION':' Ascending', 'PROCESSING_CENTER':' Unknown processing center', 'REVOLUTION':' 18353, 'SATELLITE':' NOAA-11 (H)', 'SOURCE':' Unknown receiving station', 'START':' year: 1992, day: 108, millisecond: 21754153, 'STOP':' year: 1992 Day: 108, millisecond: 21993986'}

View the image band information and the number of pixels

Attributes:

RasterCount Get the number of bands in the image set

RasterXSize Get the number of pixels in the X direction of the image set

RasterYSize Get the number of pixels in the Y direction of the image set

Print (l1b1.RasterCount) # 5
Print (l1b1.RasterXSize) # 2048
Print (l1b1.RasterYSize) # 1440

Get spatial reference information

Get the affine transformation parameters of the geographic coordinates of the image.

Print (tif1.GetGeoTransform ())
# (435435.0, 30.0,0.0,0.0,0.0,0.0,-435435.0)

Get image projection information

Print (tif1.GetProjection ())
# PROJCS ["WGS 84 / UTM zone 50N", GEOGCS ["WGS 84", DATUM ["WGS_1984", 6378137298.257223563 ["EPSG", "7030"]], AUTHORITY ["EPSG", "6326"]], PRIMEM ["Greenwich", 0r AUTHORITY ["EPSG", "8901"]], UNIT ["degree", 0.01745329251993AUTHORITY ["EPSG", "9122"], AUTHORITY ["EPSG", "4326"], PROJECTION [Transverse_Mercator "] PARAMETER ["latitude_of_origin", 0], PARAMETER ["central_meridian", 0.9996], PARAMETER ["scale_factor", 0.9996], PARAMETER ["false_easting", 500000], PARAMETER ["false_northing", 0], UNIT ["metre", 1Ji Aushi ["EPSG", "9001"]], AXIS ["Easting", EAST], AXIS ["Northing", NORTH], AUTHORITY ["EPSG", "32650"]]

Get the band of the grid set

# Get the band of the grid set
Band1 = l1b1.GetRasterBand (1)
Print (band1)
# < osgeo.gdal.Band; proxy of < Swig Object of type 'GDALRasterBandShadow *' at 0x00000253EF7174E0 >

Get the size of the band

Print (band1.XSize, band1.YSize) # 2048 1440
Print (band1.DataType) # 2

Get the attributes of band data

Maximum and Minimum represent the maximum and minimum values in band respectively, but direct print (band1. GetMaximum()) has no result.

According to the explanation: because there is no inherent maximum and minimum value for the file format.

So through: ComputeRasterMinMax() to calculate the maximum and minimum value.

Band1.GetNoDataValue ()
Print (band1.GetMaximum ()) # None
Print (band1.ComputeRasterMinMax ()) # (66.0, 695.0)
Print (band1.GetMaximum ()) # None

There is a question: There are questions: What is the use of GetNoDataValue() and GetMaximum() functions? Where is it used?

Read ENVI file

The file in ENVI format contains a HDR header file and a dat file, so in gdal, after determining that the target file is in ENVI format, read it directly without suffix.

Envi_file = gdal.Open ("I:\\ MasterLife\\ remote sensing of resources and environment\\ Finial\\ B19")
Print (envi_file.RasterCount) # 1

Read HDF data file

As the organization of modis satellite data is different from the geotif data we often encounter, special attention must be paid to reading it. Geotif data, usually a file, contains data of multiple bands On the other hand, modis, a file contains multiple SUBDATASETSGDAL, and each SUBDATASETS contains multiple band data.

In addition, the default compiled GDAL does not contain support for MODIS data, so you need to download the source code for HDF4,HDF5 separately, then modify the make.opt file, and then compile GDAL to support the read and write of modis data.

Label :
    Sign in for comments!
Comment list (0)

Powered by TorCMS (https://github.com/bukun/TorCMS).