世界海拔数据CSV -地球科学堆栈交换江南电子竞技平台江南体育网页版 最近30从www.hoelymoley.com 2023 - 07 - 07 - t22:11:55z //www.hoelymoley.com/feeds/question/23947 https://creativecommons.org/licenses/by-sa/4.0/rdf //www.hoelymoley.com/q/23947 4 世界海拔数据为CSV 维斯 //www.hoelymoley.com/users/26841 2022 - 06 - 22 - t07:54:39z 2022 - 06 - 22 - t12:00:20z < p >嗨我需要为每个纬度和经度值的Alt值!然而,我从Geotiff提取这些值有问题,不知道这个数据是公开在Excel或CSV文件格式?不幸的是我还没有找到任何我自己!< / p > < p >我的数据:< a href = " https://wetransfer.com/downloads/8e5ba7aa4cd8c406068a60543b353b0420220622084939/d3c744 " rel = " nofollow noreferrer " > https://wetransfer.com/downloads/8e5ba7aa4cd8c406068a60543b353b0420220622084939/d3c744 < / >的人知道Python: < / p > < pre > <代码>进口numpy np 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)

Source: ETOPO1 region selection (in python)

This is the code I have written so far, maybe someone will find a bug there

//www.hoelymoley.com/questions/23947/-/23949 # 23949 4 答案为世界海拔数据smichel CSV smichel //www.hoelymoley.com/users/26870 2022 - 06 - 22 - t12:00:20z 2022 - 06 - 22 - t12:00:20z < p >我希望我终于明白你的问题是,这给你的高度信息特定的纬度经度值从csv数据。< / p > < pre > <代码>进口numpy netCDF4导入数据集进口matplotlib np。pyplot as plt csv_data = np.loadtxt('1994_12_O18grid.csv',skiprows=1,delimiter=',') num_el = csv_data[:,0] lat = csv_data[:,1] lon = csv_data[:,2] value = csv_data[:,3] data = Dataset("ETOPO1_Bed_g_gdal.grd",'r') 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] etopo_lon = np.linspace(lon_range[0],lon_range[1],dimension[0]) etopo_lat = np.linspace(lat_range[0],lat_range[1],dimension[1]) topo = np.reshape(z, (lat_num, lon_num)) height = np.empty_like(num_el) for i in range(len(num_el)): #in this loop we search for the height values for the specific lat and lon values from your csv desired_lat_idx = np.abs(etopo_lat - lat[i]).argmin() desired_lon_idx = np.abs(etopo_lon - lon[i]).argmin() height[i] = topo[desired_lat_idx,desired_lon_idx] plt.figure() height[height<0]=0 # if you want to disregard values below 0 plt.imshow(np.reshape(height,(180,360))) # if the resolution of your csv data changes from 1 degree to something different you need to chance the values in the reshape. For simplicity I hardcoded the numbers.

The searching for the height levels is not that efficient but I didnt have the time to do a proper numpy style solution.

Baidu
map