底图找不到底图数据

时间:2019-06-27 07:36:20

标签: python conda matplotlib-basemap

我需要在python中以高分辨率绘制地图。底图和basemap-data-hires均已安装,但是底图找不到basemap-data-hires

这两个conda列表中都已安装:

    packages in environment at /home/paloma/anaconda3/envs/PAG2019:

    Name                    Version                   Build  Channel
    basemap                   1.2.0            py36h705c2d8_0    anaconda
    basemap-data-hires        1.2.0                         0    conda-forge
    gst-plugins-base          1.14.0               hbbd80ab_1    anaconda

怀疑安装有冲突/错误,我尝试从anaconda和conda-forge重新安装basemap-data-hires,但无济于事。

这是我使用的导入:     from mpl_toolkits.basemap import Basemap

这是我收到的错误消息:

Traceback (most recent call last):
  File "./MakeGraphs.py", line 89, in <module>
    lat_ts=0.5*(lats[0,0]+lats[-1,-1]),lat_0=0.5*(lats[0,0]+lats[-1,-1]),lon_0=0.5*(lons[0,0]+lons[-1,-1]))
  File "/home/paloma/anaconda3/lib/python3.7/site-packages/mpl_toolkits/basemap/__init__.py", line 1122, in __init__
    self._readboundarydata('gshhs',as_polygons=True)
  File "/home/paloma/anaconda3/lib/python3.7/site-packages/mpl_toolkits/basemap/__init__.py", line 1236, in _readboundarydata
    raise IOError(msg)
OSError: Unable to open boundary dataset file. Only the 'crude' and  'low',
resolution datasets are installed by default.
If you are requesting an, 'intermediate', 'high' or 'full'
resolution dataset, you may need to download and install those
files separately with
`conda install basemap-data-hires`.

有人知道吗?


仔细观察,环境的CONDA_PREFIX之间可能存在冲突:

$CONDA_PREFIX=/home/paloma/anaconda3/envs/PAG2019

和底图的basemap_datadir:

basemap_datadir=/home/paloma/anaconda3/

有人知道如何解决吗?

2 个答案:

答案 0 :(得分:0)

要安装“中级”,“高”或“完整”,请使用以下命令:

conda install -c conda-forge basemap-data-hires

否则,您将仅默认安装“粗略”和“低级”。

答案 1 :(得分:0)

当底图在基本环境的目录中查找文件时,在 base 中安装basemap-data-hires对我来说很有效。

快速而肮脏,但有效。