pyshadoz is a Python package to read and write NASA Southern Hemisphere ADditional OZonesondes (SHADOZ) data.
Project description
Overview
pyshadoz is a Python package to read and write NASA Southern Hemisphere ADditional OZonesondes (SHADOZ) data.
Installation
Requirements
Python 3. Works with Python 2.7
Dependencies
Dependencies are listed in requirements.txt. Dependencies are automatically installed during pyshadoz installation.
Installing pyshadoz
# setup virtualenv
virtualenv --system-site-packages -p python3 pyshadoz
cd pyshadoz
source bin/activate
# clone codebase and install
git clone https://github.com/WMO-ET-WDC/pyshadoz.git
cd pyshadoz
python setup.py build
python setup.py install
Running
# parse a single shadoz file
pyshadoz -f </path/to/shadoz_file>
# parse a directory shadoz files
pyshadoz -d </path/to/directory>
# parse a directory shadoz files recursively
pyshadoz -d </path/to/directory> -r
Using the API
from pyshadoz import SHADOZ
# read SHADOZ data
with open('/path/to/directory') as ff:
s = SHADOZ(ff)
for key, value in s.metadata:
print(key, value)
print(s.data_fields)
print(s.data_fields_units)
print(len(s.data))
# get all data
data = s.get_data()
# get all data by field
data = s.get_data('W Spd')
# get all data by field and unit
data = s.get_data('O3', 'ppmv')
# read SHADOZ data using convenience functions
# parse file
s = load('/path/to/shadoz_file.dat') # returns SHADOZ object
# parse string
with open('/path/to/shadoz_file.dat') as ff:
shadoz_string = ff.read()
s = loads(shadoz_string) # returns SHADOZ object
# write SHADOZ data
s = SHADOZ()
# build metadata dict
s.metadata['NASA/GSFC/SHADOZ Archive'] = 'http://croc.gsfc.nasa.gov/shadoz'
....
# build data fields
s.data_fields = ['Time', 'Press', 'Alt', 'Temp', 'RH', 'O3', 'O3', 'O3',
'W Dir', 'W Spd', 'T Pump', 'I O3', 'GPSLon', 'GPSLat',
'GPSAlt']
# build data field units
s.data_fields_units = ['sec','hPa','km', 'C', '%', 'mPa', 'ppmv', 'du', 'deg',
'm/s', 'C', 'uA', 'deg', 'deg', 'km']
# build data
s.data = [
[0, 1013.85, 0.01, 24.22, 71.0, 32.91, 32.91, 0.0, 32.91, 5.29, 32.91, 9000.0, -155.049, 19.717, 0.041],
[0, 1013.66, 0.012, 23.89, 70.0, 32.79, 32.79, 0.049, 32.79, 5.01, 32.79, 9000.0, -155.049, 19.717, 0.045]
]
# serialize data to file
shadoz_data = s.write()
with open('new_shadoz_file.dat', 'w') as ff:
ff.write(shadoz_data)
Running Tests
# install dev requirements
pip install -r requirements-dev.txt
# run tests like this:
python pyshadoz/tests/run_tests.py
# or this:
python setup.py test
# measure code coverage
coverage run --source=pyshadoz -m unittest pyshadoz.tests.run_tests
coverage report -m
Code Conventions
Bugs and Issues
All bugs, enhancements and issues are managed on GitHub.
Contact
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyshadoz-0.1.1.tar.gz
(7.7 kB
view details)
Built Distributions
pyshadoz-0.1.1-py2.7.egg
(12.5 kB
view details)
File details
Details for the file pyshadoz-0.1.1.tar.gz
.
File metadata
- Download URL: pyshadoz-0.1.1.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a02906a3891ab34e8caf5477fd5ed883c16d8311bdb761b669b26d293e4e78b3 |
|
MD5 | 7e31eeeedea2aca8531f5232fc6c2d98 |
|
BLAKE2b-256 | f034a19c6e8ac0f2ae07dbe6bdb78e505d6e296f3ac4ee156d34d505db07d32a |
File details
Details for the file pyshadoz-0.1.1-py2.py3-none-any.whl
.
File metadata
- Download URL: pyshadoz-0.1.1-py2.py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 761d916aa99f398a7b9526d237354b6610a1295647bc8f6b2ba1e6f3eb955242 |
|
MD5 | 7d6f22d94623b637098b823943561fb5 |
|
BLAKE2b-256 | b23c8791b02e2d7b6a05313588fed4f4db2a968570cb2e90876d218152484f23 |
File details
Details for the file pyshadoz-0.1.1-py2.7.egg
.
File metadata
- Download URL: pyshadoz-0.1.1-py2.7.egg
- Upload date:
- Size: 12.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cbf55d3a359d7f6b920d11adbe0e1613a267a87d0a6edeafc5dcd46035687b78 |
|
MD5 | 788e4406276cabf0e160a4046ba22a26 |
|
BLAKE2b-256 | 7874ad86d105f9d30ffc185e2cffbeb67c15f25a2c832c0589d7a46ca3125418 |