跳转到主要内容

pynumeric是一个用于读取MSC雷达数值数据的Python包

项目描述

Build Status Coverage Status

概述

pynumeric是一个用于读取MSC雷达数值数据的Python包。

安装

安装pynumeric的最简单方法是使用Python pip工具

pip install pynumeric

要求

依赖关系

依赖关系列在requirements.txt中。依赖关系将在安装pynumeric时自动安装。

安装pynumeric

# setup virtualenv
virtualenv --system-site-packages -p python3 pynumeric
cd pynumeric
source bin/activate

# clone codebase and install
git clone https://github.com/ECCC-MSC/pynumeric.git
cd pynumeric
python setup.py build
python setup.py install

运行

# help
pynumeric --help

# get pynumeric version
pynumeric --version

# get pynumeric GDAL version
pynumeric --gdal-version

# report on a single numeric file
pynumeric report -f </path/to/numeric_file>

# add verbose mode (ERROR, WARNING, INFO, DEBUG)
pynumeric report -f </path/to/numeric_file> --verbosity=DEBUG

# export a numeric file to GeoTIFF
pynumeric export -f </path/to/numeric_file> -o foo.tif -of GTiff

# export a numeric file to NetCDF
pynumeric export -f </path/to/numeric_file> -o foo.tif -of NetCDF

使用API

from pynumeric import Numeric

# read Numeric data
with open('/path/to/file') as ff:
    n = Numeric(ff)

    for key, value in n.metadata:
        print(key, value)

    print(n.metadata)

    print(n.data)

    print(len(n.data))

    # get the spatial extent
    print(n.get_spatial_extent())

    # get the data extent
    print(n.get_data_extent())


# read Numeric data using convenience functions
# parse file
s = load('/path/to/numeric_file.dat')  # returns Numeric object

# parse data string
with open('/path/to/numeric_file.dat') as ff:
    numeric_string = ff.read()
s = loads(numeric_string)  # returns Numeric object

# export to GeoTIFF
# Supported are any of the supported GDAL
# Raster Format Codes (http://www.gdal.org/formats_list.html)
s.to_grid('myfile.tif', 'GTiff')  # creates myfile.tif on disk

开发

pip install requirements-dev.txt

运行测试

# install dev requirements
pip install -r requirements-dev.txt

# run tests like this:
python pynumeric/tests/run_tests.py

# or this:
python setup.py test

# measure code coverage like this
coverage run --source=pynumeric -m unittest pynumeric.tests.run_tests
coverage report -m

# or this:
python setup.py coverage

发布

python setup.py sdist bdist_wheel --universal
twine upload dist/*

代码约定

检查代码是否符合PEP8

find . -type f -name "*.py" | xargs flake8

错误和问题

所有错误、增强和问题都由GitHub管理。

联系方式

项目详情


下载文件

下载适用于您平台的应用程序。如果您不确定选择哪个,请了解更多关于安装包的信息。

源分发

pynumeric-0.1.2.tar.gz (20.9 kB 查看哈希值)

上传时间: 源代码

构建版本

pynumeric-0.1.2-py2.py3-none-any.whl (8.8 kB 查看哈希值)

上传时间: Python 2 Python 3

pynumeric-0.1.2-py2.7.egg (10.7 kB 查看哈希值)

上传时间: 源代码

支持