1

How do you import other raster formats into geoviews/holoviews other than the netCDF files shown in the tutorials? For example I want to import an ESRI .bil file and wrap it into a geoviews image but it is not importing correctly. Is there a way to do this, am I missing a step?

Ultimately I want to be able to project point data onto the raster image at the correct lat, long positions to extract data, but I can't seem to get the points projected in the correct positions.

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

This provides this error: TypeError: shape() got an unexpected keyword argument 'gridded'

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

This errors as: ValueError: No format specification could be found for the given buffer.

I have only succeeded in importing the data using gdal and then plotting it as a Holoviews Raster or 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

This is the result:

Results

BenjiDa
  • 11
  • 3

0 Answers0