Overview
pynumeric is a Python package to read MSC Radar Numeric data.
Installation
The easiest way to install pynumeric is via the Python pip utility:
pip install pynumeric
Requirements
Python 3. Works with Python 2.7
Dependencies
Dependencies are listed in requirements.txt. Dependencies are automatically installed during pynumeric installation.
Installing 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
Running
# 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
Using the 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
Development
pip install requirements-dev.txt
Running Tests
# 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
Releasing
python setup.py sdist bdist_wheel --universal
twine upload dist/*
Code Conventions
Checking Code for PEP8
find . -type f -name "*.py" | xargs flake8
Bugs and Issues
All bugs, enhancements and issues are managed on GitHub.
Contact
Metadata
Release files for pynumeric 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pynumeric-0.1.2.tar.gz | 20.9 kB | Details |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pynumeric-0.1.2-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
| pynumeric-0.1.2-py2.7.egg | Legacy Egg format | - | - | Details |
Total release size: 40.4 kB
Release files / pynumeric-0.1.2.tar.gz
| Download URL | pynumeric-0.1.2.tar.gz |
|---|---|
| Size | 20.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5103816c68e2deac586c788402017b3d94821105e4d81f5c2bf2cfd75188adf5
|
|
BLAKE2b-256 checksum How to use checksums |
82ef0c541c848dd5995eb3c5ec0e728f154fbbb1323dd5d0f6aa9346d52ec30a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / pynumeric-0.1.2-py2.py3-none-any.whl
| Download URL | pynumeric-0.1.2-py2.py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
36642b6326908ff8418c69834ce070486528d709ec55033185ae5a2e54209369
|
|
BLAKE2b-256 checksum How to use checksums |
2952e8a53072d3d945677e4ca7bc59ad27678bb2f80452418561227654332091
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / pynumeric-0.1.2-py2.7.egg
| Download URL | pynumeric-0.1.2-py2.7.egg |
|---|---|
| Size | 10.7 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
841186d2d27e6dafe129c92405e0feeb1e23985477d53e278b9b72647d99451d
|
|
BLAKE2b-256 checksum How to use checksums |
df0ac6f4c516994e3b1e25d7ce80ebd6898d7be0ab39b3ccf9ccf86a4e51fbe0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |