pyshadoz
Overview
pyshadoz is a pure Python package to read and write NASA Southern Hemisphere ADditional OZonesondes (SHADOZ) data.
Versions 5 and 6 are supported.
Installation
The easiest way to install pyshadoz is via the Python pip utility:
pip3 install pyshadoz
Requirements
- Python 3
- virtualenv
Dependencies
Dependencies are listed in pyproject.toml. 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-cop/pyshadoz.git
cd pyshadoz
pip3 install .
Running
# help
pyshadoz --help
# get version
pyshadoz --version
# parse a single shadoz file
pyshadoz -f </path/to/shadoz_file>
# add verbose mode
pyshadoz -v -f </path/to/shadoz_file>
# parse a directory of shadoz files
pyshadoz -d </path/to/directory>
# parse a directory of shadoz files recursively
pyshadoz -r -d </path/to/directory>
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 index of a data field
index = s.get_data_index('W Dir')
# get index of a data field and data field unit
index = s.get_data_index('W Dir', 'deg')
# get all data
data = s.get_data()
# get data by index
data = s.get_data(by_index=index)
# 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)
Development
Running Tests
python3 pyshadoz/tests/run_tests.py
Releasing
# create release (x.y.z is the release version)
vi pyproject.toml # update [project]/version
git commit -am 'update release version x.y.z'
git push origin main
git tag -a x.y.z -m 'tagging release version x.y.z'
git push --tags
# upload to PyPI
rm -fr build dist *.egg-info
python3 -m build
twine upload dist/*
# publish release on GitHub (https://github.com/wmo-cop/pyshadoz/releases/new)
# bump version back to dev
vi pyproject.toml # update [project]/version
git commit -am 'back to dev'
git push origin main
Code Conventions
Bugs and Issues
All bugs, enhancements and issues are managed on GitHub.
Contact
Metadata
Release files for pyshadoz 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyshadoz-0.2.0.tar.gz | 9.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyshadoz-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.7 kB
Release files / pyshadoz-0.2.0.tar.gz
| Download URL | pyshadoz-0.2.0.tar.gz |
|---|---|
| Size | 9.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
03c7f850c3f65c10b720c3a6a3f17740aacfb6df9fa4d084942cc28a8ba52490
|
|
BLAKE2b-256 checksum How to use checksums |
6a23fa38b67af717806a2e432f74ad5f399f38f4f2e44a6fed853bdc6aa88e78
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / pyshadoz-0.2.0-py3-none-any.whl
| Download URL | pyshadoz-0.2.0-py3-none-any.whl |
|---|---|
| Size | 10.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
74b493217e22e26d7ba4cd1f5129756e993ae1dbc7bfa18c42e924795e911743
|
|
BLAKE2b-256 checksum How to use checksums |
9ba86e4fac70b70d2047063545829abe8578addc20f8a915ef165bc84a34f65a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|