1

除了教程中显示的 netCDF 文件之外,如何将其他栅格格式导入 geoviews/holoviews?例如,我想导入一个 ESRI .bil 文件并将其包装到一个 geoviews 图像中,但它没有正确导入。有没有办法做到这一点,我错过了一步吗?

最终,我希望能够将点数据投影到正确的经纬度位置的光栅图像上以提取数据,但我似乎无法将点投影到正确的位置。

from cartopy import crs
import holoviews as hv
import xarray as xr
import geoviews as gv
import pandas as pd
from osgeo import gdal



kdims = ['easting', 'northing']
vdims = ['elevation']
xr_raster = gv.Dataset(DEM, kdims=kdims, vdims=vdims, crs=crs.PlateCarree())

image = gv.Image(xr_raster, crs=crs.PlateCarree()) (style={'cmap':'inferno'})

image

这提供了这个错误:TypeError: shape() got an unexpected keyword argument 'gridded'

import iris
iris_raster = iris.load_cube('/path/to/raster.bil')

此错误为:ValueError:找不到给定缓冲区的格式规范。

我只成功地使用 gdal 导入数据,然后将其绘制为 Holoviews Raster 或 Geoviews Image:

Test = gdal.Open(Data_path + "DEM.bil")
DEM = Test.ReadAsArray()

hv.notebook_extension()
%opts Raster [xrotation=20] Points (color='r')[xrotation=20]

#Import point data
df = pd.read_csv(path+name)
stream_dataset = gv.Dataset(df, kdims=['x', 'y'], vdims=['elevation', 'chi', 'flow_distance'])
stream = hv.Points(stream_dataset)

#Import raster
raster = hv.Raster(DEM)(style={'cmap':'inferno'}) 
image = gv.Image(DEM, crs=crs.PlateCarree()) (style={'cmap':'inferno'})

raster + stream + image

这是结果:

结果

4

0 回答 0