Home

Awesome

Build Status

Release History:

VersionDOI
2.0.0b1<a href="https://doi.org/10.5281/zenodo.10659314"><img src="https://zenodo.org/badge/DOI/10.5281/zenodo.10659314.svg" alt="DOI"></a>
2.0.0b0<a href="https://doi.org/10.5281/zenodo.7052287"><img src="https://zenodo.org/badge/DOI/10.5281/zenodo.7052287.svg" alt="DOI"></a>
1.6.2<a href="https://doi.org/10.5281/zenodo.3605168"><img src="https://zenodo.org/badge/DOI/10.5281/zenodo.3605168.svg" alt="DOI"></a>
1.6.1<a href="https://doi.org/10.5281/zenodo.3251132"><img src="https://zenodo.org/badge/DOI/10.5281/zenodo.3251132.svg" alt="DOI"></a>
1.6.0<a href="https://doi.org/10.5281/zenodo.1302513"><img src="https://zenodo.org/badge/DOI/10.5281/zenodo.1302513.svg" alt="DOI"></a>
1.5.0<a href="https://doi.org/10.5281/zenodo.839253"><img src="https://zenodo.org/badge/DOI/10.5281/zenodo.839253.svg" alt="DOI"></a>
1.4.1<a href="https://doi.org/10.5281/zenodo.581493"><img src="https://zenodo.org/badge/DOI/10.5281/zenodo.581493.svg" alt="DOI"></a>
1.4.0<a href="http://dx.doi.org/10.5281/zenodo.225597"><img src="https://zenodo.org/badge/doi/10.5281/zenodo.225597.svg" alt="10.5281/zenodo.225597"></a>
1.3.0<a href="http://dx.doi.org/10.5281/zenodo.47960"><img src="https://zenodo.org/badge/doi/10.5281/zenodo.47960.svg" alt="10.5281/zenodo.47960"></a>
1.2.0<a href="http://dx.doi.org/10.5281/zenodo.46785"><img src="https://zenodo.org/badge/doi/10.5281/zenodo.46785.svg" alt="10.5281/zenodo.46785"></a>
1.1.0<a href="http://dx.doi.org/10.5281/zenodo.32632"><img src="https://zenodo.org/badge/doi/10.5281/zenodo.32632.svg" alt="10.5281/zenodo.32632"></a>
1.0<a href="http://dx.doi.org/10.5281/zenodo.31213"><img src="https://zenodo.org/badge/doi/10.5281/zenodo.31213.svg" alt="10.5281/zenodo.31213"></a>

Data Unpacking

World Ocean Database data is encoded by the specification described here. This WodProfile class reads this format, and returns an object with functions to help extract useful information from it.

Additionally, wodpy offers classes to consume IQuOD netCDF files and present them as profile objects with a similar API to the ASCII classes.

How to help

Trying things out

Please try unpacking your own WOD data using wodpy, and let us know how it goes in the issues. Any problems (not just bugs, but anything confusing or unintuitive), just let us know. Also, if there are more features you'd like to see (like more parts of the profile unpacked), ask away - community requests are high priority for new features.

Contributing

Contributions to wodpy are very welcome! Please follow these simple guidelines:

Usage

Install

from pip: sudo pip install wodpy

ASCII WOD data

To use the WodProfile class for reading ASCII WOD data, open a text file that conforms to the specification defined in the link above, and pass in the resulting file object:

from wodpy import wod

fid = open("example.dat")
profile = wod.WodProfile(fid)

profile now contains an object with many helper functions for extracting useful information from the first profile in file:

profile.latitude()  # Return the latitude of the profile.
profile.z()         # Return the depths of the observations.
profile.df()        # Return a pandas DataFrame containing all the information for this profile
...

Further profiles in the file can be read as follows:

profile2 = wod.WodProfile(fid) # Read the next profile.
profile2.is_last_profile_in_file(fid) # Is this the last profile?

Complete method lists and definitions are below.

IQuOD netCDF data

To create a similar object out of IQuOD-standard netCDF files, first make a Ragged class object in analogy to the open file pointer above, and provide that to the ncProfile class; for example; to get a profile object p representing the 55th profile in the netCDF file ocldb1570984477.6279_OSD.nc

from wodpy import wodnc

r = wodnc.Ragged('ocldb1570984477.6279_OSD.nc')
p = wodnc.ncProfile(r, 55)

WodProfile / ncProfile methods

These methods are intended for end-user use, for decoding useful information from a profile.

Data Retrieval

These functions decode data from the current profile.

numpy

Per-profile data:

Per-level data:

Constructing the per-level ndarrays should not be done more than once per profile; for convenience, we provide the following wrapper to pull all this information out at once:

pandas

profile.df() returns a pandas DataFrame, with per-level information as columns and per-profile information as keys in a .attrs attribute:

Columns:

Attributes:

The following are keys in a .attrs dictionary on the dataframe:

Note that DataFrame attributes generally do not propagate to new DataFrames returned by operating on original DataFrames.

Headers Only

CoTeDe

The class Wod4CoTeDe provides a WOD profile in the format required by CoTeDe, which is a package to quality control hydrographic data. One could use it like:

from wodpy.extra import Wod4CoTeDe from wodpy import wod, wodnc

fid = open('example.dat') p = WodProfile(fid) profile = Wod4CoTeDe(p)

or

fid = open('example.data') profile = Wod4CoTeDe(fid)

or

ragged = wodnc.Ragged("tests/testData/ocldb1570984477.6279_OSD.nc") profile = Wod4CoTeDe(ragged, 55)

To quality control that profile with the EuroGOOS standard:

from cotede.qc import ProfileQC pqc = ProfileQC(profile, 'eurogoos')

All the information about the profile can be obtained at: pqc.attributes, pqc.data and pqc.flags. For more information, check CoTeDe's manual.