{"id":19713872,"url":"https://github.com/sciqlop/cdfpp","last_synced_at":"2026-04-02T22:03:37.410Z","repository":{"id":41345553,"uuid":"228190134","full_name":"SciQLop/CDFpp","owner":"SciQLop","description":"A modern C++ header only cdf library with Python bindings","archived":false,"fork":false,"pushed_at":"2026-04-01T20:50:29.000Z","size":4312,"stargazers_count":13,"open_issues_count":4,"forks_count":3,"subscribers_count":5,"default_branch":"main","last_synced_at":"2026-04-02T01:44:26.036Z","etag":null,"topics":["cdf","cpp-library","cpp17","nasa","plasma-physics","python","sciqlop","space"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SciQLop.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/contributing.rst","funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-12-15T13:37:46.000Z","updated_at":"2026-04-01T20:50:30.000Z","dependencies_parsed_at":"2023-10-18T18:15:13.600Z","dependency_job_id":"b5e30980-880b-417b-9807-460666713b3d","html_url":"https://github.com/SciQLop/CDFpp","commit_stats":{"total_commits":200,"total_committers":1,"mean_commits":200.0,"dds":0.0,"last_synced_commit":"0626a6070b939d495fa099634a7d356d84ffd7e0"},"previous_names":[],"tags_count":52,"template":false,"template_full_name":null,"purl":"pkg:github/SciQLop/CDFpp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SciQLop%2FCDFpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SciQLop%2FCDFpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SciQLop%2FCDFpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SciQLop%2FCDFpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SciQLop","download_url":"https://codeload.github.com/SciQLop/CDFpp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SciQLop%2FCDFpp/sbom","scorecard":{"id":126690,"data":{"date":"2025-08-11","repo":{"name":"github.com/SciQLop/CDFpp","commit":"a46a3437ca543a06e372c6b2156e773a4508165d"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.4,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/27 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":10,"reason":"13 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/CI.yml:1","Warn: no topLevel permission defined: .github/workflows/tests-with-coverage.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: COPYING:0","Info: FSF or OSI recognized license: MIT License: COPYING:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/CI.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/SciQLop/CDFpp/CI.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/CI.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/SciQLop/CDFpp/CI.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/CI.yml:57: update your workflow using https://app.stepsecurity.io/secureworkflow/SciQLop/CDFpp/CI.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/CI.yml:59: update your workflow using https://app.stepsecurity.io/secureworkflow/SciQLop/CDFpp/CI.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/CI.yml:60: update your workflow using https://app.stepsecurity.io/secureworkflow/SciQLop/CDFpp/CI.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/CI.yml:74: update your workflow using https://app.stepsecurity.io/secureworkflow/SciQLop/CDFpp/CI.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/CI.yml:79: update your workflow using https://app.stepsecurity.io/secureworkflow/SciQLop/CDFpp/CI.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/CI.yml:94: update your workflow using https://app.stepsecurity.io/secureworkflow/SciQLop/CDFpp/CI.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/CI.yml:115: update your workflow using https://app.stepsecurity.io/secureworkflow/SciQLop/CDFpp/CI.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/CI.yml:125: update your workflow using https://app.stepsecurity.io/secureworkflow/SciQLop/CDFpp/CI.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/CI.yml:139: update your workflow using https://app.stepsecurity.io/secureworkflow/SciQLop/CDFpp/CI.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/CI.yml:144: update your workflow using https://app.stepsecurity.io/secureworkflow/SciQLop/CDFpp/CI.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/CI.yml:156: update your workflow using https://app.stepsecurity.io/secureworkflow/SciQLop/CDFpp/CI.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/CI.yml:161: update your workflow using https://app.stepsecurity.io/secureworkflow/SciQLop/CDFpp/CI.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tests-with-coverage.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/SciQLop/CDFpp/tests-with-coverage.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/tests-with-coverage.yml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/SciQLop/CDFpp/tests-with-coverage.yml/main?enable=pin","Warn: containerImage not pinned by hash: .gitpod.Dockerfile:1: pin your Docker image by updating gitpod/workspace-full to gitpod/workspace-full@sha256:b1195dfae7ee9a12a89d195247c3e1357cc6a18360a41473dbec67525ef434e2","Warn: pipCommand not pinned by hash: .github/workflows/CI.yml:87","Warn: pipCommand not pinned by hash: .github/workflows/CI.yml:88","Warn: pipCommand not pinned by hash: .github/workflows/CI.yml:97","Warn: pipCommand not pinned by hash: .github/workflows/CI.yml:123","Warn: pipCommand not pinned by hash: .github/workflows/CI.yml:124","Warn: pipCommand not pinned by hash: .github/workflows/CI.yml:129","Warn: pipCommand not pinned by hash: .github/workflows/tests-with-coverage.yml:17","Info:   0 out of  12 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   4 third-party GitHubAction dependencies pinned","Info:   0 out of   1 containerImage dependencies pinned","Info:   0 out of   7 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Packaging","score":10,"reason":"packaging workflow detected","details":["Info: Project packages its releases by way of GitHub Actions.: .github/workflows/CI.yml:133"],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Vulnerabilities","score":0,"reason":"20 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2018-34 / GHSA-2fc2-6r4j-p65h","Warn: Project is vulnerable to: PYSEC-2021-856 / GHSA-5545-2q6w-2gh6","Warn: Project is vulnerable to: PYSEC-2019-108 / GHSA-9fq2-x9r6-wfmf","Warn: Project is vulnerable to: PYSEC-2018-33 / GHSA-cw6w-4rcx-xphc","Warn: Project is vulnerable to: PYSEC-2021-857 / GHSA-f7c7-j99h-c22f","Warn: Project is vulnerable to: GHSA-fpfv-jqm9-f5jm","Warn: Project is vulnerable to: PYSEC-2017-1 / GHSA-frgw-fgh6-9g52","Warn: Project is vulnerable to: PYSEC-2021-142 / GHSA-8q59-q68h-6hv4","Warn: Project is vulnerable to: PYSEC-2018-49 / GHSA-rprw-h62v-c2w7","Warn: Project is vulnerable to: PYSEC-2014-14 / GHSA-652x-xj99-gmcc","Warn: Project is vulnerable to: GHSA-9hjg-9r4m-mvj7","Warn: Project is vulnerable to: GHSA-9wx4-h78v-vm56","Warn: Project is vulnerable to: PYSEC-2014-13 / GHSA-cfj3-7x9c-4p3h","Warn: Project is vulnerable to: PYSEC-2018-28 / GHSA-x84v-xcm2-53pg","Warn: Project is vulnerable to: GHSA-34jh-p97f-mpxf","Warn: Project is vulnerable to: PYSEC-2021-59 / GHSA-5phf-pp7p-vc2r","Warn: Project is vulnerable to: PYSEC-2023-212 / GHSA-g4mx-q9vg-27p4","Warn: Project is vulnerable to: GHSA-pq67-6m6q-mj2v","Warn: Project is vulnerable to: PYSEC-2021-108 / GHSA-q2q7-5pp4-w6pg","Warn: Project is vulnerable to: PYSEC-2023-192 / GHSA-v845-jxx5-vc9f"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":10,"reason":"SAST tool is run on all commits","details":["Info: all commits (6) are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-16T04:05:41.552Z","repository_id":41345553,"created_at":"2025-08-16T04:05:41.553Z","updated_at":"2025-08-16T04:05:41.553Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31317831,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T21:35:00.834Z","status":"ssl_error","status_checked_at":"2026-04-02T21:34:59.806Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cdf","cpp-library","cpp17","nasa","plasma-physics","python","sciqlop","space"],"created_at":"2024-11-11T22:25:40.781Z","updated_at":"2026-04-02T22:03:37.405Z","avatar_url":"https://github.com/SciQLop.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![GitHub License](https://img.shields.io/github/license/SciQLop/CDFpp)](https://mit-license.org/)\n[![Documentation Status](https://readthedocs.org/projects/pycdfpp/badge/?version=latest)](https://pycdfpp.readthedocs.io/en/latest/?badge=latest)\n[![CPP20](https://img.shields.io/badge/Language-C++20-blue.svg)]()\n[![PyPi](https://img.shields.io/pypi/v/pycdfpp.svg)](https://pypi.python.org/pypi/pycdfpp)\n[![Coverage](https://codecov.io/gh/SciQLop/CDFpp/coverage.svg?branch=main)](https://codecov.io/gh/SciQLop/CDFpp/branch/main)\n[![Discover on MyBinder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/SciQLop/CDFpp/main?labpath=examples/notebooks)\n\n# Python packages\n\n| Linux x86_64 | Windows x86_64  | MacOs x86_64  | MacOs ARM64  |\n| --- | --- | --- | --- |\n| [![linux_x86_64][1]][2] | [![windows_x86_64][3]][4] | [![macos_x86_64][5]][6] | [![macos_arm64][7]][8] |\n\n[1]: https://github.com/SciQLop/CDFpp/actions/workflows/CI.yml/badge.svg?event=release\n[2]: https://github.com/SciQLop/CDFpp/actions/workflows/CI.yml\n[3]: https://github.com/SciQLop/CDFpp/actions/workflows/CI.yml/badge.svg?event=release\n[4]: https://github.com/SciQLop/CDFpp/actions/workflows/CI.yml\n[5]: https://github.com/SciQLop/CDFpp/actions/workflows/CI.yml/badge.svg?event=release\n[6]: https://github.com/SciQLop/CDFpp/actions/workflows/CI.yml\n[7]: https://github.com/SciQLop/CDFpp/actions/workflows/CI.yml/badge.svg?event=release\n[8]: https://github.com/SciQLop/CDFpp/actions/workflows/CI.yml\n\n\n# Unit Tests\n\n| Linux x86_64  | Windows x86_64 | MacOs x86_64  |\n| --- | --- | --- |\n| [![linux_x86_64][9]][10] | [![windows_x86_64][11]][12] | [![macos_x86_64][13]][14] |\n\n[9]: https://github.com/SciQLop/CDFpp/actions/workflows/CI.yml/badge.svg?event=push\n[10]: https://github.com/SciQLop/CDFpp/actions/workflows/CI.yml\n[11]: https://github.com/SciQLop/CDFpp/actions/workflows/CI.yml/badge.svg?event=push\n[12]: https://github.com/SciQLop/CDFpp/actions/workflows/CI.yml\n[13]: https://github.com/SciQLop/CDFpp/actions/workflows/CI.yml/badge.svg?event=push\n[14]: https://github.com/SciQLop/CDFpp/actions/workflows/CI.yml\n\n\n# CDFpp (CDF++)\nA NASA's [CDF](https://cdf.gsfc.nasa.gov/) modern C++ library. \nThis is not a C++ wrapper but a full C++ implementation.\nWhy? CDF files are still used for space physics missions but few implementations are available.\nThe main one is NASA's C implementation available [here](https://cdf.gsfc.nasa.gov/) but it lacks multi-threads support (global shared state), has an old C interface and has a license which isn't compatible with most Linux distributions policy.\nThere are also Java and Python implementations which are not usable in C++.\n\nList of features and roadmap:\n\n- CDF reading \n    - [x] read files from cdf version 2.2 to 3.x\n    - [x] read uncompressed file headers\n    - [x] read uncompressed attributes\n    - [x] read uncompressed variables\n    - [x] read variable attributes\n    - [x] loads cdf files from memory (std::vector\u003cchar\u003e or char*)\n    - [x] handles both row and column major files\n    - [x] read variables with nested VXRs\n    - [x] read compressed files (GZip, RLE)\n    - [x] read compressed variables (GZip, RLE)\n    - [x] read UTF-8 encoded files\n    - [x] read ISO 8859-1(Latin-1) encoded files (converts to UTF-8 on the fly)\n    - [x] variables values lazy loading\n    - [ ] decode DEC's floating point encoding (Itanium, ALPHA and VAX)\n    - [ ] pad values \n- CDF writing\n    - [x] write uncompressed headers\n    - [x] write uncompressed attributes\n    - [x] write uncompressed variables\n    - [x] write compressed variables\n    - [x] write compressed files\n    - [ ] pad values\n- General features\n    - [x] uses [libdeflate](https://github.com/ebiggers/libdeflate) for faster GZip decompression\n    - [x] highly optimized CDF reads (up to ~4GB/s read speed from disk)\n    - [x] handle leap seconds\n    - [x] Python wrappers\n    - [x] Documentation\n    - [x] Examples (see below)\n    - [x] [Benchmarks](https://github.com/SciQLop/CDFpp/tree/main/notebooks/benchmarks.ipynb)\n\nIf you want to understand how it works, how to use the code or what works, you may have to read tests.\n\n# Installing\n\n## From PyPi\n\n```bash\npython3 -m pip install --user pycdfpp\n```\n\n## From sources\n\n```bash\nmeson build\ncd build\nninja\nsudo ninja install\n```\n\nOr if you want to build a Python wheel:\n\n```bash\npython -m build . \n# resulting wheel will be located into dist folder\n```\n\n# Basic usage\n\n## Python\n\n### Reading CDF files\nBasic example from a local file:\n\n```python\nimport pycdfpp\ncdf = pycdfpp.load(\"some_cdf.cdf\")\ncdf_var_data = cdf[\"var_name\"].values #builds a numpy view or a list of strings\nattribute_name_first_value = cdf.attributes['attribute_name'][0]\n```\n\nNote that you can also load in memory files:\n\n```python\nimport pycdfpp\nimport requests\nimport matplotlib.pyplot as plt\ntha_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)\nplt.plot(tha_l2_fgm[\"tha_fgl_gsm\"])\nplt.show()\n```\n\nBuffer protocol support:\n\n```python\nimport pycdfpp\nimport requests\nimport xarray as xr\nimport matplotlib.pyplot as plt\n\ntha_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)\nxr.DataArray(tha_l2_fgm['tha_fgl_gsm'], dims=['time', 'components'], coords={'time':tha_l2_fgm['tha_fgl_time'].values, 'components':['x', 'y', 'z']}).plot.line(x='time')\nplt.show()\n\n# Works with matplotlib directly too\n\nplt.plot(tha_l2_fgm['tha_fgl_time'], tha_l2_fgm['tha_fgl_gsm'])\nplt.show()\n\n```\n\nDatetimes handling:\n\n```python\nimport pycdfpp\nimport os\n# Due to an issue with pybind11 you have to force your timezone to UTC for \n# datetime conversion (not necessary for numpy datetime64)\nos.environ['TZ']='UTC'\n\nmms2_fgm_srvy = pycdfpp.load(\"mms2_fgm_srvy_l2_20200201_v5.230.0.cdf\")\n\n# to convert any CDF variable holding any time type to python datetime:\nepoch_dt = pycdfpp.to_datetime(mms2_fgm_srvy[\"Epoch\"])\n\n# same with numpy datetime64:\nepoch_dt64 = pycdfpp.to_datetime64(mms2_fgm_srvy[\"Epoch\"])\n\n# note that using datetime64 is ~100x faster than datetime (~2ns/element on an average laptop)\n\n```\n\n### Writing CDF files\n\nCreating a basic CDF file:\n\n```python\nimport pycdfpp\nimport numpy as np\nfrom datetime import datetime\n\ncdf = pycdfpp.CDF()\ncdf.add_attribute(\"some attribute\", [[1,2,3], [datetime(2018,1,1), datetime(2018,1,2)], \"hello\\nworld\"])\ncdf.add_variable(f\"some variable\", values=np.ones((10),dtype=np.float64))\npycdfpp.save(cdf, \"some_cdf.cdf\")\n\n```\n\n\n## C++\n```cpp\n#include \"cdfpp/cdf-io/cdf-io.hpp\"\n#include \u003ciostream\u003e\n\nstd::ostream\u0026 operator\u003c\u003c(std::ostream\u0026 os, const cdf::Variable::shape_t\u0026 shape)\n{\n    os \u003c\u003c \"(\";\n    for (auto i = 0; i \u003c static_cast\u003cint\u003e(std::size(shape)) - 1; i++)\n        os \u003c\u003c shape[i] \u003c\u003c ',';\n    if (std::size(shape) \u003e= 1)\n        os \u003c\u003c shape[std::size(shape) - 1];\n    os \u003c\u003c \")\";\n    return os;\n}\n\nint main(int argc, char** argv)\n{\n    auto path = std::string(DATA_PATH) + \"/a_cdf.cdf\";\n    // cdf::io::load returns a optional\u003cCDF\u003e\n    if (const auto my_cdf = cdf::io::load(path); my_cdf)\n    {\n        std::cout \u003c\u003c \"Attribute list:\" \u003c\u003c std::endl;\n        for (const auto\u0026 [name, attribute] : my_cdf-\u003eattributes)\n        {\n            std::cout \u003c\u003c \"\\t\" \u003c\u003c name \u003c\u003c std::endl;\n        }\n        std::cout \u003c\u003c \"Variable list:\" \u003c\u003c std::endl;\n        for (const auto\u0026 [name, variable] : my_cdf-\u003evariables)\n        {\n            std::cout \u003c\u003c \"\\t\" \u003c\u003c name \u003c\u003c \" shape:\" \u003c\u003c variable.shape() \u003c\u003c std::endl;\n        }\n        return 0;\n    }\n    return -1;\n}\n```\n\n## Caveats\n- **NRV variables shape**: in order to expose a consistent shape, PyCDFpp exposes the record count as first dimension and thus its value will be either 0 or 1 (0 means empty variable).\n- **Reference invalidation**: PyCDFpp returns references into C++ data structures. Adding or removing variables/attributes may invalidate previously obtained references. Always re-fetch after mutation (see [documentation](https://pycdfpp.readthedocs.io/en/latest/) for details).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsciqlop%2Fcdfpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsciqlop%2Fcdfpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsciqlop%2Fcdfpp/lists"}