卫星云图数据与shp文件不能正常叠加,应该属于投影设置问题吧?修改很多次无果,代码如下,求大佬帮忙看看
import cartopy
import cartopy.crs as ccrs
import cartopy.feature as cfeat
import matplotlib.pyplot as plt
import h5py
import numpy as np
import math
from cartopy.io.shapereader import Reade
f = h5py.File('D:\FYDATA\FY4A-_AGRI--_N_DISK_1047E_L1-_FDI-_MULT_NOM_20190619144500_20190619145959_4000M_V0001.HDF','r')
f.keys()
print(f.keys())
b = f["CALChannel12"][:]
print(max(b))
print(min(b))
a = f["NOMChannel12"][:]
print(a.shape)
d = np.array(a,dtype='float32')
for i in range(len(b)):
d[d==i]=b[i]
print(d.max())
print(d.min())
print(d.shape)
proj = ccrs.LambertConformal(central_latitude=90, central_longitude=105)
fig,ax = plt.subplots(figsize=(10,10),subplot_kw = dict(projection = proj))
ax.set_extent([50,180,0,90],ccrs.PlateCarree())
ax.gridlines(linestyle = "--")
reader = Reader("D:\YM\行政区界\CHINA.SHP")
ax.add_geometries(reader.geometries(),ccrs.PlateCarree(),edgecolor='yellow', facecolor="none",linewidth=1)
im = ax.imshow(d,origin='upper',vmax=339.9,vmin=100,cmap="RdYlBu",transform=ccrs.PlateCarree())
相似问题