离线数据在Cartopy中的存储位置

10

离线数据在cartopy中存储在哪里?它存储在site-packages下的data文件夹中吗?是否有任何方法触发下载所有可用数据?我想将其复制到未连接到互联网的Linux机器上。我目前正在连接到互联网的Windows机器上工作,因此希望从那里下载数据。谢谢。

1个回答

19

请查看http://scitools.org.uk/cartopy/docs/latest/cartopy.html中的配置文档。基本上,数据被下载到该配置中的data_dir项。对我来说,看起来像:

>>> import cartopy.config        
>>> cartopy.config['data_dir']
'/home/pelson/.local/share/cartopy'
当然,可以将其配置到任何您喜欢的位置。 因为我也将cartopy部署到了我的组织中,我们还配置了cartopy以拥有集中存储的数据。 这是通过pre_existing_data_dir配置项确定的位置。 最后,要批量下载所有数据(总共几GB),在cartopy源代码中有一个脚本位于tools/feature_download.py。运行它来下载所有数据只需要:
$> python tools/feature_download.py

完整的帮助文档已经提供:

$> python tools/feature_download.py --help
usage: feature_download.py [-h] [--output OUTPUT] [--dry-run] [--ignore-repo-data] GROUP_NAME [GROUP_NAME ...]

Download feature datasets.

positional arguments:
  GROUP_NAME            Feature group name: cultural-extra, cultural, gshhs, physical

optional arguments:
  -h, --help            show this help message and exit
  --output OUTPUT, -o OUTPUT
                        save datasets in the specified directory (default: user cache directory)
  --dry-run             just print the URLs to download
  --ignore-repo-data    ignore existing repo data when downloading

1
在 Cartopy 0.20.0 中, feature_download.py 文件已更名为 cartopy_feature_download.py,应将其添加到路径中,因此现在您可以从命令行直接调用它:cartopy_feature_download.py - Dan

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接