Skip to main content

Python front end for the Radar Altimeter Database System.

Project description

PyRADS

Python access to the Radar Altimeter Database System

Build status Documentation status Test coverage Code style is black PyPI Package latest release Supported versions Status MIT

Python library for access to the Radar Altimeter Database System (RADS).

Current Features

  • Loading of the RADS XML files.

Planned Features

  • Loading of RADS data.

Documentation

Documentation for PyRADS can be found at https://pyrads.readthedocs.io/en/latest/ or in PDF and Epub formats.

Installation

Only POSIX complaint systems are officially supported. PyRADS should work on Microsoft Windows but it has not been tested.

UDUINITS2

In addition to CPython 3.6+ PyRADS requires the UDUNITS2 library and header files to be installed. Below are instructions for accomplishing this on some common systems:

Ubuntu and Debian
# apt-get install libudunits2-dev
Red Hat and Fedora
# yum install udunits2-devel
Mac OS X (using _homebrew)
$ brew install udunits
Microsoft Windows

No binary is provided for Windows so UDUNITS2 must be built from source.

libxml2

PyRADS also optionally requires libxml2 which it uses for better error messages and slightly faster RADS XML file loading.

Ubuntu and Debian
# apt-get install libxml2
Red Hat and Fedora
# yum install libxml2
Mac OS X (using _homebrew)
$ brew install libxml2

PyRADS

Now that the system dependencies have been installed PyRADS can be installed from PyPI:

$ pip install rads

or if libxml2 is installed

$ pip install rads[lxml]

Usage

PyRADS is currently in development, and will remain so until its first v1.0.0 release. Until then the public API may change from one minor release to another. However, patch releases will not change the public API.

Loading RADS configuration files

Currently, PyRADS is only capable of loading the RADS XML files. Loading data is planned for a future release.

The easiest way to load the RADS v4 XML files is to ensure that the RADSDATAROOT environment variable is set with the path to the RADS data root as documented in the official RADS User Manual. Once this is done, PyRADS can load all the same XML files that the official RADS implementation does by default (it will also load PyRADS specific XML files as well).

>>> import rads
>>> rads_config = rads.load_config()

The files that will be loaded are (on Unix):

  1. <dataroot>/conf/rads.xml

  2. /etc/pyrads/settings.xml

  3. ~/.rads/rads.xml

  4. ~/.config/pyrads/settings.xml

  5. rads.xml

  6. pyrads.xml

where each file can override or append to the settings of the previous files.

If not using Unix, use the rads.config_files() function to retrieve your platform specific list.

To add XML files to this:

>>> import rads
>>> xml_files = rads.config_files() + ['path/to/custom/file.xml']
>>> rads_config = rads.load_config(xml_files=xml_files)

The RADS data root can also be overridden:

>>> import rads
>>> rads_config = rads.load_config(dataroot='/path/to/custom/dataroot')

The entire RADS config can be displayed in human readable form with:

>>> import rads
>>> print(rads.load_config().full_string())

For more information on loading of RADS v4 XML configuration files consult the documentation.

Development

invoke

PyRADS uses invoke to make common development tasks easier. For example the simplest way to get started working on PyRADS is to fork and clone the repository and then from within the main project directory:

pip install invoke && invoke develop

This will install all development requirements with pip and thus it is recommended to do this from a virtualenv.

If you are working on a system where libxml2 is installed you may wish to also install lxml to provide faster XML parsing, but more importantly better error messages. With lxml, configuration parsing errors will be identified by line number.

To get the full list tasks that can be run by invoke:

invoke -l

For example, to run the formatters (isort and black), static checkers, and all tests (with coverage report):

invoke format check test --coverage

NOTE: This should be ran before making any commits.

The classic python setup.py test is supported as well but only runs the unit tests.

If on a non UNIX environment some of the tasks may fail. If this happens you can use the --dry flag to print out the commands that would be ran and then adjust accordingly.

tox

While the above invoke tasks are relatively quick and are good for development they are insufficient to ensure PyRADS is working properly across all options (lxml or not) and all supported Python versions. For this a tox configuration is provided. To run the full test suite simply run:

tox

Or if you have a recent version of tox you can speed up the process with:

tox --parallel auto

The doc-pdf environment will fail if XeTeX, xindy, and latexmk. This is usually fine.

If all tests run by tox succeed (except for doc-pdf) the TravisCI build should succeed as well.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rads-0.1.0.post0.tar.gz (183.7 kB view hashes)

Uploaded Source

Built Distribution

rads-0.1.0.post0-py3-none-any.whl (88.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page