Skip to main content

[Build Status](https: //github.com/woudc/woudc-formats/actions)

WOUDC Format Converter

woudc-formats is a Python package used to perform various transformations from/to WOUDC supported formats.

Currently supported features include:

  • Readers: SHADOZ, BAS, NASA AMES files, Vaisala
  • Writers: WOUDC totalozone daily summary (master file)

Installation

pip

Install latest stable version from PyPI.

pip3 install woudc-formats

From source

Install latest development version.

python3 -m venv woudc-formats
cd woudc-formats
. bin/activate
git clone https://github.com/woudc/woudc-formats.git
cd woudc-formats
pip3 install .

Usage

Command Line Interface

usage: woudc-formats.py --format {SHADOZ, BAS, AMES-2160, Vaisala, totalozone-masterfile} --inpath PATH/FILENAME --logfile PATH/LOGFILE --loglevel {DEBUG, CRITICAL, ERROR, WARNING, INFO, DEBUG, NOTSET}

Required Arguments:
    --format: indicate input file format
    --inpath: import filename and path, for SHADOZ, BAS, Vaisala, and AMES-2160
    --logfile: path to log file, including file name
    --loglevel: define log level for logging

Optional Arguments:
    --outpath: indicate the output file path, by default is 'INPATH.csv'
    --station: station name in WOUDC
    --agency: agency name in WOUDC
    --metadata: a dictionary formatted string containing some specified station metadation information
            ex: {"inst type": "ECC", "inst number": "XXXXX", "SA": "XX" , "ID" : "XXX", "country": "XXX", "GAW_ID": "XXX"}

Note:

  • For AMES-2160 format, --agency argument is required in order to process the file.
  • For Vaisala format, --station and --agency in arguments and 'ID', 'GAW_ID', 'country', and 'SA' arguments in --metadata are required in order to process the file.

### API
```bash
import woudc_formats

# load from file
ecsv = woudc_formats.load(In_Format, InPut_File_Path, station, agency)

if ecsv is not None:
    woudc_formats.dump(ecsv, Output_file_path)

# load from string
with open(input_file_path) as ff
    ff.read()
ecsv = woudc_formats.loads(In_Format, s)
if ecsv is not None:
    woudc_formats.dump(ecsv, Output_file_path)

Running

woudc-formats.py --format SHADOZ --inpath ./bin/SAMPLE.dat --outpath ./bin/SAMPLE.csv --logfile ./bin/LOG.log --loglevel DEBUG
woudc-formats.py --format totalozone-masterfile --inpath <full local or web path to totalozone snapshot> --outpath <output path> --loglevel <log level> --logfile <log file>
woudc-formats.py --format AMES-2160 --inpath <full local path to AMES file> --outpath <output path> --loglevel <log level> --logfile <log file> --agency XXX --metadata '{"SA": "XXX", "inst type": "ECC", "inst number": "6A3412"}'

For Agency 'AWI-NM':
woudc-formats.py --format AMES-2160 --inpath INPATH --logfile log.log --loglevel DEBUG --agency AWI-NM

Development

python3 -m venv woudc-formats
cd woudc-formats
source bin/activate
git clone https://github.com/woudc/woudc-formats.git
cd woudc-formats
pip3 install .
pip3 install ".[dev]"

Running Tests

python3 tests/test.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 master
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/woudc/woudc-formats/releases/new)

# bump version back to dev
vi pyproject.toml  # update [project]/version
git commit -am 'back to dev'
git push origin master

Code Conventions

woudc-formats code conventions are as per PEP8.

# code should always pass the following
find -type f -name "*.py" | xargs flake8

Issues

All bugs, enhancements and issues are managed on GitHub.

Contact

Metadata

Release files for woudc-formats 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for woudc-formats 0.3.0
File Size Uploaded
woudc_formats-0.3.0.tar.gz 37.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for woudc-formats 0.3.0
File Interpreter ABI Platform
woudc_formats-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 72.2 kB

Release files / woudc_formats-0.3.0.tar.gz

Download URL woudc_formats-0.3.0.tar.gz
Size 37.0 kB
Tags Source
SHA-256 checksum
How to use checksums
109b75274133a5f0cdda72fa98a99c8ce17429234fcb487c84c3dd3d9002213a
BLAKE2b-256 checksum
How to use checksums
0e3b58d9d54010b97802ee9e2e275ad78236c93e4094706add4354a3fd698bff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / woudc_formats-0.3.0-py3-none-any.whl

Download URL woudc_formats-0.3.0-py3-none-any.whl
Size 35.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3f2521f9281e9f65d18e0ca4ead21ab7f706b7a0875da65ca7c92f1d87ca71bc
BLAKE2b-256 checksum
How to use checksums
c85cec1da053396b81e8a625627aa5943c8d18251dba834c474705af5e76139a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release history Release notifications | RSS feed

0.3.1

2 release files

This release

0.3.0 This release

2 release files

0.2.0

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page