pynumeric是一个python包,用于读取msc雷达数字数据
pynumeric的Python项目详细描述
概述
pynumeric是一个要读取MSC Radar Numeric data的python包。
安装
安装pynumeric的最简单方法是通过python pip实用程序:
pip install pynumeric
要求
- Python3。与Python2.7一起使用
- virtualenv
依赖性
依赖项列在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
frompynumericimportNumeric# read Numeric datawithopen('/path/to/file')asff:n=Numeric(ff)forkey,valueinn.metadata:print(key,value)print(n.metadata)print(n.data)print(len(n.data))# get the spatial extentprint(n.get_spatial_extent())# get the data extentprint(n.get_data_extent())# read Numeric data using convenience functions# parse files=load('/path/to/numeric_file.dat')# returns Numeric object# parse data stringwithopen('/path/to/numeric_file.dat')asff: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/*
错误和问题
所有错误、增强和问题都在 GitHub。