HiLatLong值和alt值取Geotiff值时有问题, 并想知道这些数据是否以Excel或CSV文件格式公开提供?可惜我自己什么都没发现
my data:https://wetransfer.com/downloads/8e5ba7aa4cd8c406068a60543b353b0420220622084939/d3c744面向知道Python的人
import numpy as np import matplotlib.pyplot as plt from netCDF4 import Dataset import pandas as pd data = Dataset("C:/Users/Oliver Weisser/Desktop/Bachelor/Programm/Daten/Daten/ETOPO1_Bed_g_gdal.grd",'r') print(data.variables.keys()) lon_range = data.variables['x_range'][:] lat_range = data.variables['y_range'][:] topo_range = data.variables['z_range'][:] spacing = data.variables['spacing'][:] dimension = data.variables['dimension'][:] z = data.variables['z'][:] lon_num = dimension[0] lat_num = dimension[1] lon = np.linspace(lon_range[0],lon_range[1],dimension[0]) lat = np.linspace(lat_range[0],lat_range[1],dimension[1]) topo = np.reshape(z, (lat_num, lon_num)) dfl = pd.DataFrame({ 'Latitude': lat.reshape(-1), 'Longitude': lon.reshape(-1), 'Altitude': topo.reshape(-1) }) print(dfl)
源码 :ETOPO1区域选择
这是我至今所编解码 也许有人会发现那里有窃听器