How to find lat/lon in MODIS data

63 Views Asked by At

I plotted the MODIS land use land cover data.But the coordinates are showing as grid index.I converted this to lat/lon value.But the plot is upside down.What is the solution for this?

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import rioxarray
import rasterio as rio
from osgeo import gdal
f='MCD12C1.A2022001.061.2023244164746.HDF'
ds = gdal.Open(f)
datasets_meta = ds.GetMetadata("SUBDATASETS")
major_lnd_cvr_1 = gdal.Open(datasets_meta['SUBDATASET_1_NAME'])
major_lnd_cvr_1_array = major_lnd_cvr_1.ReadAsArray()
plt.imshow(major_lnd_cvr_1_array)
major_lnd_cvr_1_meta = major_lnd_cvr_1.GetMetadata()
img=plt.contourf(np.arange(-180,180,0.05), np.arange(-90,90,0.05),major_lnd_cvr_1_array)

enter image description here

0

There are 0 best solutions below