在pysheds中获取“from_raster”属性时出错

2024-05-29 03:55:40 发布

您现在位置:Python中文网/ 问答频道 /正文

这是我第一次问问题。我正在尝试使用“pysheds”来分析一些水文DEM文件。开发人员将其视为一些非常彻底的“如何”视频,但当我尝试以他们显示的方式加载DEM文件时,我出现以下错误:

模块“pysheds.grid”没有属性“from\u”

这是我的密码

    import numpy as np
    import matplotlib.pyplot as plt
    import matplotlib.colors as colors
    import geopandas as gpd
    import pysheds
    import pysheds.grid as Grid
    import mplleaflet
    
    grid = Grid.from_raster('path.tif', data_name = 'dem')`

我在控制台中检查了print(dir(Grid)),没有看到列出这个属性

我错过什么了吗? 谢谢


Tags: 文件fromimport视频属性matplotlib开发人员as
1条回答
网友
1楼 · 发布于 2024-05-29 03:55:40

根据documentation,您应该像这样从pysheds.grid导入Grid

from pysheds.grid import Grid

grid = Grid.from_raster('n30w100_con', data_name='dem')
grid.read_raster('n30w100_dir', data_name='dir')
grid.view('dem')

而不是

import pysheds.grid as Grid

相关问题 更多 >

    热门问题