数据检索器
retriever的Python项目详细描述
找到数据是一回事。另一个方法是做好分析准备。获取, 清理、标准化和导入公共可用数据非常耗时 因为许多数据集缺乏机器可读的元数据,并且不符合 建立数据结构和格式。数据检索器自动执行第一个 下载、清理和标准化数据分析管道中的步骤 数据集,并将其导入关系数据库、平面文件或 编程语言。这个过程的自动化减少了 用户可以让大多数大型数据集按小时运行,在某些情况下按天运行。
安装当前版本
如果安装了python,则可以使用pip
:
pip install retriever
或者在加入conda-forge
通道(conda config --add channels conda-forge
)后conda
:
conda install retriever
根据您的系统配置,这可能需要sudo
才能pip
:
sudo pip install retriever
预编译的二进制安装程序也可用于Windows、OS X和 上的ubuntu/debian 这是releases page。这些是真的 不需要安装python。下载用于操作的安装程序 系统并按照上的说明操作 这个download page。
从源安装
要从源代码安装数据检索器,您需要安装以下软件包的Python2.7+或3.3+:
- xlrd
以下包是与关联的 数据库管理系统:
- pymysql(用于mysql)
- sqlite3(用于sqlite)
- psycopg2二进制文件(用于postgresql),以前是psycopg2。
- PyODBC(用于MS Access-此选项仅在Windows上可用)
- Microsoft Access驱动程序(ODBC for Windows)
从源安装
使用pip直接从github安装:
pip install git+https://git@github.com/weecology/retriever.git
或:
- 克隆存储库
- 在包含setup.py的目录中,运行以下命令:
pip install .
。您可能需要在 命令取决于您的系统(即sudo pip install .
)。
对于那些对开发感兴趣的人,可以找到更广泛的文档here
使用命令行
安装后,运行retriever update
下载所有可用的数据集脚本。
要查看命令行选项和数据集的完整列表,请运行retriever --help
。
输出如下:
usage: retriever [-h][-v][-q]{download,install,defaults,update,new,new_json,edit_json,delete_json,ls,citation,reset,help} ... positional arguments: {download,install,defaults,update,new,new_json,edit_json,delete_json,ls,citation,reset,help} sub-command help download download raw data files for a dataset install download and install dataset defaults displays default options update download updated versions of scripts new create a new sample retriever script new_json CLI to create retriever datapackage.json script edit_json CLI to edit retriever datapackage.json script delete_json CLI to remove retriever datapackage.json script ls display a list all available dataset scripts citation view citation reset reset retriever: removes configuration settings, scripts, and cached data help optional arguments: -h, --help show this help message and exit -v, --version show program's version number and exit -q, --quiet suppress command-line output
要安装数据集,请使用retriever install
:
usage: retriever install [-h][--compile][--debug]{mysql,postgres,sqlite,msaccess,csv,json,xml} ... positional arguments: {mysql,postgres,sqlite,msaccess,csv,json,xml} engine-specific help mysql MySQL postgres PostgreSQL sqlite SQLite msaccess Microsoft Access csv CSV json JSON xml XML optional arguments: -h, --help show this help message and exit --compile force re-compile of script before downloading --debug run in debug mode
示例
这些示例使用Iris flower dataset。 更多的例子可以在数据检索器文档中找到。
使用安装
retriever install -h (gives install options)
使用特定的数据库引擎,检索器安装{engine}
retriever install mysql -h (gives install mysql options) retriever install mysql --user myuser --password ******** --host localhost --port 8888 --database_name testdbase iris
将数据安装到名为iris.db的sqlite数据库中,您将使用:
retriever install sqlite iris -f iris.db
使用下载
retriever download -h (gives you help options) retriever download iris retriever download iris --path C:\Users\Documents
使用引文
retriever citation (citation of the retriever engine) retriever citation iris (citation for the iris data)
空间数据集安装
设置空间支持
请使用postgis为postgres设置空间支持 请参阅spatial set-up docs。
retriever install postgres harvard-forest # Vector data retriever install postgres bioclim # Raster data# Install only the data of USGS elevation in the given extent retriever install postgres usgs-elevation -b -94.98704597353938 39.027001800158615 -94.3599408119917 40.69577051867074
网站
有关详细信息,请参见 Data Retriever website。
致谢
这个软件的开发是由the Gordon and Betty Moore Foundation's Data-Driven Discovery Initiative通过 Grant GBMF4563致伊桑·怀特和 作为CAREER award to Ethan White的一部分的National Science Foundation。