Skip to main content

No project description provided

Project description

Gitpod Ready-to-Code

License: GPL v3 CPP17 CI Coverage

CDFpp (CDF++)

A NASA's CDF modern C++ library. This is not a C++ wrapper but a full C++ implementation. Why? CDF files are still used for space physics missions but few implementations are available. The main one is NASA's C implementation available here but it lacks multi-threads support, has an old C interface and has a license which isn't compatible with most Linux distributions policy. There are also Java and Python implementations which are not usable in C++.

List of features and roadmap:

  • read uncompressed file headers
  • read uncompressed attributes
  • read uncompressed variables
  • read variable attributes
  • loads cdf files from memory (std::vector or char*)
  • handles both row and column major files
  • read variables with nested VXRs
  • read compressed file (GZip, RLE)
  • read compressed variables (GZip, RLE)
  • write uncompressed headers
  • write uncompressed attributes
  • write uncompressed variables
  • write compressed attributes
  • write compressed file variables
  • handle leap seconds
  • Python wrappers
  • Documentation
  • Examples
  • Benchmarks

If you want to understand how it works, how to use the code or what works, you may have to read tests.

Installing

From PyPi

pip3 install --user pycdfpp

From sources

meson build
cd build
ninja
sudo ninja install

Basic usage

Python

Basic example from a local file:

import pycdfpp
cdf = pycdfpp.load("some_cdf.cdf")
cdf_var_data = cdf["var_name"].values #builds a numpy view or a list of strings
attribute_name_first_value = cdf.attributes['attribute_name'][0]

Note that you can also load in memory files:

import pycdfpp
import requests
import matplotlib.pyplot as plt
tha_l2_fgm = pycdfpp.load(requests.get("https://spdf.gsfc.nasa.gov/pub/data/themis/tha/l2/fgm/2016/tha_l2_fgm_20160101_v01.cdf").content)
plt.plot(tha_l2_fgm["tha_fgl_gsm"])
plt.show()

C++

#include "cdf-io/cdf-io.hpp"
#include <iostream>

std::ostream& operator<<(std::ostream& os, const cdf::Variable::shape_t& shape)
{
    os << "(";
    for (auto i = 0; i < static_cast<int>(std::size(shape)) - 1; i++)
        os << shape[i] << ',';
    if (std::size(shape) >= 1)
        os << shape[std::size(shape) - 1];
    os << ")";
    return os;
}

int main(int argc, char** argv)
{
    auto path = std::string(DATA_PATH) + "/a_cdf.cdf";
    // cdf::io::load returns a optional<CDF>
    if (const auto my_cdf = cdf::io::load(path); my_cdf)
    {
        std::cout << "Attribute list:" << std::endl;
        for (const auto& [name, attribute] : my_cdf->attributes)
        {
            std::cout << "\t" << name << std::endl;
        }
        std::cout << "Variable list:" << std::endl;
        for (const auto& [name, variable] : my_cdf->variables)
        {
            std::cout << "\t" << name << " shape:" << variable.shape() << std::endl;
        }
        return 0;
    }
    return -1;
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

pycdfpp-0.2.1-cp310-cp310-win_amd64.whl (904.5 kB view details)

Uploaded CPython 3.10 Windows x86-64

pycdfpp-0.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (421.7 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

pycdfpp-0.2.1-cp310-cp310-macosx_10_15_x86_64.whl (360.2 kB view details)

Uploaded CPython 3.10 macOS 10.15+ x86-64

pycdfpp-0.2.1-cp39-cp39-win_amd64.whl (905.0 kB view details)

Uploaded CPython 3.9 Windows x86-64

pycdfpp-0.2.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (421.8 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

pycdfpp-0.2.1-cp39-cp39-macosx_10_15_x86_64.whl (360.2 kB view details)

Uploaded CPython 3.9 macOS 10.15+ x86-64

pycdfpp-0.2.1-cp38-cp38-win_amd64.whl (903.5 kB view details)

Uploaded CPython 3.8 Windows x86-64

pycdfpp-0.2.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (420.3 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

pycdfpp-0.2.1-cp38-cp38-macosx_10_14_x86_64.whl (358.5 kB view details)

Uploaded CPython 3.8 macOS 10.14+ x86-64

pycdfpp-0.2.1-cp37-cp37m-win_amd64.whl (903.7 kB view details)

Uploaded CPython 3.7m Windows x86-64

pycdfpp-0.2.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (425.8 kB view details)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

pycdfpp-0.2.1-cp37-cp37m-macosx_10_14_x86_64.whl (362.1 kB view details)

Uploaded CPython 3.7m macOS 10.14+ x86-64

File details

Details for the file pycdfpp-0.2.1-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: pycdfpp-0.2.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 904.5 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for pycdfpp-0.2.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 3afc10d8baa6941b85e4b63f68be37b967c5a11286d237a8836dbbca15bce71e
MD5 6a3387451c8cbf701d0ed5579db62c3f
BLAKE2b-256 3cfc2e800d6d6815605dfb76f36fd3cf8cf57579b55e8a75ad986caaede66044

See more details on using hashes here.

File details

Details for the file pycdfpp-0.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

  • Download URL: pycdfpp-0.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 421.7 kB
  • Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for pycdfpp-0.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5e6ddfd82e20e465f79130cbc07a043896835c56aca9d7a40eb7c3b033cf6b11
MD5 1f8a20cb496940dd78bae4bb06b81c54
BLAKE2b-256 f622291a137a9fc1257f3313db0ae7469db7eaa7ea03c5187734ca383fbdb32b

See more details on using hashes here.

File details

Details for the file pycdfpp-0.2.1-cp310-cp310-macosx_10_15_x86_64.whl.

File metadata

  • Download URL: pycdfpp-0.2.1-cp310-cp310-macosx_10_15_x86_64.whl
  • Upload date:
  • Size: 360.2 kB
  • Tags: CPython 3.10, macOS 10.15+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.3

File hashes

Hashes for pycdfpp-0.2.1-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 40737b180e469beddde92b2f5f2736088fd718b0a2e61682ea3e57a94b9f78e8
MD5 691afd0699c3680d2c46c3d9ce1b6f1b
BLAKE2b-256 63cd5bf392cbeba709841d7786d25bf9269cb9baf1309d08ca5f21a65edadf04

See more details on using hashes here.

File details

Details for the file pycdfpp-0.2.1-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: pycdfpp-0.2.1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 905.0 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for pycdfpp-0.2.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 a35440c3afed167556a0bfcfde913da2f3e2a7436bb4fc5d49c3617f78369ed6
MD5 b3240ff4c6804d89dee87551c2592a79
BLAKE2b-256 9ac18141e977d1afacf98a7ed326480d0189505c2015082d6bde755eea133d15

See more details on using hashes here.

File details

Details for the file pycdfpp-0.2.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

  • Download URL: pycdfpp-0.2.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 421.8 kB
  • Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for pycdfpp-0.2.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d9fce56b05cba0640b50d633e97a32bee2ba7aadb2804ab49738e25f07286428
MD5 0b92fe9b96040537770c755ad36f866f
BLAKE2b-256 94f0e70871d89a2da2ad945397bf217e48c225d6762f1657bd6c0f429444e77d

See more details on using hashes here.

File details

Details for the file pycdfpp-0.2.1-cp39-cp39-macosx_10_15_x86_64.whl.

File metadata

  • Download URL: pycdfpp-0.2.1-cp39-cp39-macosx_10_15_x86_64.whl
  • Upload date:
  • Size: 360.2 kB
  • Tags: CPython 3.9, macOS 10.15+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11

File hashes

Hashes for pycdfpp-0.2.1-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 deda1c2234fb5f5175cd3dd475c5aaa337f809068b9eaaf0bc8f921c09cb7564
MD5 59771ae72bf8133685cfbad96ecd7d64
BLAKE2b-256 a1979ca705873eafa4d0dbbc9b6433091c74e0cffe13f139f38cbb10b7b975d7

See more details on using hashes here.

File details

Details for the file pycdfpp-0.2.1-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: pycdfpp-0.2.1-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 903.5 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.10

File hashes

Hashes for pycdfpp-0.2.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 127cbc3529c875bfde5a982f7805346b456c7355314f0d40ba59eb070772d381
MD5 6d84eeebda5088fe4c870029b46a5d30
BLAKE2b-256 6f27344564c35be4cfa760055e17c098ba7a2afde1347ba03f56f6dd3cd7ba69

See more details on using hashes here.

File details

Details for the file pycdfpp-0.2.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

  • Download URL: pycdfpp-0.2.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 420.3 kB
  • Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for pycdfpp-0.2.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8991d57815e517cad19081c50b77542120c8e20811592363b6691c6b658ea006
MD5 566d624e0065302a5dabd8f74bb9ba07
BLAKE2b-256 d3cef197048ea7e107be65b0c335d06837ef0902e1b9028b679a806a5e7adf3d

See more details on using hashes here.

File details

Details for the file pycdfpp-0.2.1-cp38-cp38-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: pycdfpp-0.2.1-cp38-cp38-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 358.5 kB
  • Tags: CPython 3.8, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12

File hashes

Hashes for pycdfpp-0.2.1-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 12a9c2cd1fe6c28832ace250a7a6e003b3b97f2e34d30b13d4793594cb0b1ff9
MD5 09a6f144a3b4f8aefc780e9577415b5a
BLAKE2b-256 0c0d91a27924d87c811c1084b0fd3d253e4f4eeefcecc5c76c4a2281442c6aca

See more details on using hashes here.

File details

Details for the file pycdfpp-0.2.1-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: pycdfpp-0.2.1-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 903.7 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.7.9

File hashes

Hashes for pycdfpp-0.2.1-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 80a870dce003b4f68a9746c8346ac2c2a1a1faf9e41e34b189f55d7b08099b7f
MD5 c2c348f4e60c32931cb2bd64e306a17a
BLAKE2b-256 4673cad19348927be6a2052e43eb196c194c42e575c8f2a3a44e19b7413b4f55

See more details on using hashes here.

File details

Details for the file pycdfpp-0.2.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

  • Download URL: pycdfpp-0.2.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
  • Upload date:
  • Size: 425.8 kB
  • Tags: CPython 3.7m, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for pycdfpp-0.2.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4269f5d479f6ddc7b15dc6179a4b0c4ebc57a80845380a0571fcde9f6d149f13
MD5 17be5eeab331e81bf7188a8906df57bd
BLAKE2b-256 83405a050711b68a93ce57012e8d1166e40552b064747a973918455c63628c85

See more details on using hashes here.

File details

Details for the file pycdfpp-0.2.1-cp37-cp37m-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: pycdfpp-0.2.1-cp37-cp37m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 362.1 kB
  • Tags: CPython 3.7m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.7.12

File hashes

Hashes for pycdfpp-0.2.1-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 76d0d471df1901620115fe858b08de90ac4c0f1acbe699b77a9b4b586136ad03
MD5 30c548a08fcb94e3e0949234d79d055e
BLAKE2b-256 d5f33961368e92d6b0ba24d598f78db64ae70cb4622da41235af71cb5e6587ab

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page