如何使用地理/坐标而不是像素坐标沿曲线提取一维轮廓?

问题描述 投票:0回答:0

如何从给定地理坐标而不是像素坐标的数组中获取一维轮廓。 我有地理坐标中的辐射数据(NASA GOLD Mission)。 每个半球的数据存储在一个单独的文件中。我想沿着地理坐标中的曲线(10 degNorth dip latitude)获取拼接半球的一维轮廓,

我尝试使用 map_coordinates 调整答案 here 但我意识到它是像素坐标,这就是为什么我认为配置文件与地图不对应; 为了获得 1D 配置文件,我根据输入曲线 (X) 值绘制了 mapcoords 的输出,以便获得经度的变化。 黄色的另一个剖面也与地图中的数据不对应; 当我使用 imshow 绘制数据时,它看起来与地图上的不一样;

数据和Python代码在这里数据+代码;

GOLD map and 1D profile along 10 deg North dip

from netCDF4 import Dataset  
import glob, matplotlib,os;matplotlib.pyplot as plt
import cartopy.crs as ccrs
import numpy.ma as ma

Mag = pd.read_csv(r"\mag_cords.csv")
X_dip10s,Y_dip10s = Mag.LON10S.to_numpy(),Mag.LAT10S.to_numpy()
g = Dataset('GOLD_L1C_CH*23*.nc','r'); 
wavelength = g.variables['WAVELENGTH'][:]
radiance = g.variables['RADIANCE'][:]
lat = g.variables['REFERENCE_POINT_LAT'][:] 
lon = g.variables['REFERENCE_POINT_LON'][:] 
g.close()
O5s_ids = np.argwhere((134.3 <= wavelength[50,25,:]) & (wavelength[50,25,:] <= 137.7))
O5s = np.array(np.nansum(radiance[:,:,O5s_ids],axis = 2))*.04 # integrate under the peak!
O5s = np.transpose(O5s[:,:,0])
x=lon[9:-8,9:-8];y=lat[9:-8,9:-8];z=O5s[9:-8,9:-8].T;z=abs(z)#To remove Nans
z2=np.ma.masked_array(z, (z > 30)) 

Zs=scipy.ndimage.map_coordinates(np.transpose(z),
np.vstack((X_dip10s,Y_dip10s)),
mode="nearest")
Xs=scipy.ndimage.map_coordinates(np.transpose(x),
np.vstack((X_dip10s,Y_dip10s)),mode="nearest") 
                                                                                                                         
fig=plt.figure(figsize=(10,10))
axarr = fig.add_subplot(211,projection=ccrs.PlateCarree())
ax2 = fig.add_subplot(212)
grid_lines =axarr.gridlines(draw_labels=True'); axarr.coastlines()
cs1 = axarr.contourf(x,y, z2, transform=ccrs.PlateCarree(),cmap='jet',levels=50)
ax2.plot(X_dip10s,Zs, 'k-', Xs ,Zs, 'k-')


  [1]: https://i.stack.imgur.com/66C4P.png
indexing maps slice scikit-image cartopy
© www.soinside.com 2019 - 2024. All rights reserved.