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 for PyRADS can be found at https://pyrads.readthedocs.io/en/latest/ or in PDF and Epub formats.
Only POSIX complaint systems are officially supported. PyRADS should work on Microsoft Windows but it has not been tested.
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:
# apt-get install libudunits2-dev
# yum install udunits2-devel
$ brew install udunits
No binary is provided for Windows so UDUNITS2 must be built from source.
PyRADS also optionally requires libxml2 which it uses for better error messages and slightly faster RADS XML file loading.
# apt-get install libxml2
# yum install libxml2
$ brew install libxml2
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]
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.
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):
<dataroot>/conf/rads.xml
/etc/pyrads/settings.xml
~/.rads/rads.xml
~/.config/pyrads/settings.xml
rads.xml
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.
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.
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.