Git Product home page Git Product logo

woudc-formats's Introduction

Build Status Build status Downloads this month on PyPI Latest release License

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 Instructions

Requirements

woudc-formats requires Python 2.7, pywoudc, pyshadoz, and woudc-extcsv

Dependencies

See requirements.txt

Setup

git clone https://github.com/woudc/woudc-formats.git && cd woudc-formats
python setup.py 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"}

Importance:
    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

usage: 
import woudc_formats
ecsv = woudc_formats.load(In_Format, InPut_File_Path, station, agency)
if ecsv is not None:
    woudc_formats.dump(ecsv, Output_file_path)

OR

import woudc_formats
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)

Optional Method:
woudc_formats.load(In_Format, InPut_File_Path, station, agency, metadata) : Take input file path and return ext-csv object, agency is required for AMES file and metadata is required for Vaisala, see optional arguments for Command Line Interface for more detail.
woudc_formats.loads(In_Format,String_of_InPut_file, station, agency, metadata) : Take string represenataion of input file and return ext-csv object. Station and agency are required for AMES file and metadata is required for Vaisala, see optional arguments for Command Line Interface for more detail.
woudc_formats.dump(ecsv, Output_file_path) : Take ext-csv object and produce output file.
woudc_formats.dumps(ecsv) : Take ext-csv object and prints to screen.

Example

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

woudc-formats's People

Contributors

chenyu58 avatar acapparelli avatar tomkralidis avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.