@nirs4all/formats-wasm 0.2.11 → 0.2.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/THIRD_PARTY_NOTICES.md +49 -0
  2. package/nirs4all_formats_wasm_bg.wasm +0 -0
  3. package/package.json +4 -2
  4. package/reader-backports/hdf5-reader/Cargo.toml +119 -0
  5. package/reader-backports/hdf5-reader/LICENSE-APACHE +164 -0
  6. package/reader-backports/hdf5-reader/LICENSE-MIT +21 -0
  7. package/reader-backports/hdf5-reader/PROVENANCE.json +80 -0
  8. package/reader-backports/hdf5-reader/README.md +308 -0
  9. package/reader-backports/hdf5-reader/UPSTREAM-Cargo.toml +44 -0
  10. package/reader-backports/hdf5-reader/UPSTREAM-VCS.json +6 -0
  11. package/reader-backports/hdf5-reader/src/attribute_api.rs +847 -0
  12. package/reader-backports/hdf5-reader/src/btree_v1.rs +726 -0
  13. package/reader-backports/hdf5-reader/src/btree_v2.rs +2068 -0
  14. package/reader-backports/hdf5-reader/src/cache.rs +354 -0
  15. package/reader-backports/hdf5-reader/src/checksum.rs +56 -0
  16. package/reader-backports/hdf5-reader/src/chunk_index.rs +423 -0
  17. package/reader-backports/hdf5-reader/src/dataset.rs +4733 -0
  18. package/reader-backports/hdf5-reader/src/datatype_api.rs +497 -0
  19. package/reader-backports/hdf5-reader/src/error.rs +167 -0
  20. package/reader-backports/hdf5-reader/src/extensible_array.rs +1886 -0
  21. package/reader-backports/hdf5-reader/src/filters/deflate.rs +93 -0
  22. package/reader-backports/hdf5-reader/src/filters/fletcher32.rs +52 -0
  23. package/reader-backports/hdf5-reader/src/filters/lz4.rs +178 -0
  24. package/reader-backports/hdf5-reader/src/filters/mod.rs +326 -0
  25. package/reader-backports/hdf5-reader/src/filters/nbit.rs +586 -0
  26. package/reader-backports/hdf5-reader/src/filters/scaleoffset.rs +827 -0
  27. package/reader-backports/hdf5-reader/src/filters/shuffle.rs +99 -0
  28. package/reader-backports/hdf5-reader/src/fixed_array.rs +763 -0
  29. package/reader-backports/hdf5-reader/src/fractal_heap.rs +2029 -0
  30. package/reader-backports/hdf5-reader/src/global_heap.rs +284 -0
  31. package/reader-backports/hdf5-reader/src/group.rs +795 -0
  32. package/reader-backports/hdf5-reader/src/io.rs +413 -0
  33. package/reader-backports/hdf5-reader/src/lib.rs +916 -0
  34. package/reader-backports/hdf5-reader/src/local_heap.rs +261 -0
  35. package/reader-backports/hdf5-reader/src/messages/attribute.rs +304 -0
  36. package/reader-backports/hdf5-reader/src/messages/attribute_info.rs +96 -0
  37. package/reader-backports/hdf5-reader/src/messages/btree_k.rs +36 -0
  38. package/reader-backports/hdf5-reader/src/messages/continuation.rs +46 -0
  39. package/reader-backports/hdf5-reader/src/messages/dataspace.rs +259 -0
  40. package/reader-backports/hdf5-reader/src/messages/datatype.rs +938 -0
  41. package/reader-backports/hdf5-reader/src/messages/external_files.rs +50 -0
  42. package/reader-backports/hdf5-reader/src/messages/fill_value.rs +233 -0
  43. package/reader-backports/hdf5-reader/src/messages/filter_pipeline.rs +147 -0
  44. package/reader-backports/hdf5-reader/src/messages/group_info.rs +103 -0
  45. package/reader-backports/hdf5-reader/src/messages/layout.rs +476 -0
  46. package/reader-backports/hdf5-reader/src/messages/link.rs +170 -0
  47. package/reader-backports/hdf5-reader/src/messages/link_info.rs +127 -0
  48. package/reader-backports/hdf5-reader/src/messages/mod.rs +374 -0
  49. package/reader-backports/hdf5-reader/src/messages/modification_time.rs +83 -0
  50. package/reader-backports/hdf5-reader/src/messages/shared.rs +164 -0
  51. package/reader-backports/hdf5-reader/src/messages/shared_table.rs +67 -0
  52. package/reader-backports/hdf5-reader/src/messages/symbol_table_msg.rs +51 -0
  53. package/reader-backports/hdf5-reader/src/object_header.rs +1749 -0
  54. package/reader-backports/hdf5-reader/src/reference.rs +90 -0
  55. package/reader-backports/hdf5-reader/src/shared_message_table.rs +425 -0
  56. package/reader-backports/hdf5-reader/src/storage.rs +538 -0
  57. package/reader-backports/hdf5-reader/src/superblock.rs +285 -0
  58. package/reader-backports/hdf5-reader/src/symbol_table.rs +277 -0
  59. package/reader-backports/netcdf-reader/Cargo.toml +141 -0
  60. package/reader-backports/netcdf-reader/LICENSE-APACHE +164 -0
  61. package/reader-backports/netcdf-reader/LICENSE-MIT +21 -0
  62. package/reader-backports/netcdf-reader/PROVENANCE.json +55 -0
  63. package/reader-backports/netcdf-reader/README.md +308 -0
  64. package/reader-backports/netcdf-reader/UPSTREAM-Cargo.toml +48 -0
  65. package/reader-backports/netcdf-reader/UPSTREAM-VCS.json +6 -0
  66. package/reader-backports/netcdf-reader/src/cf/axes.rs +419 -0
  67. package/reader-backports/netcdf-reader/src/cf/bounds.rs +108 -0
  68. package/reader-backports/netcdf-reader/src/cf/crs.rs +269 -0
  69. package/reader-backports/netcdf-reader/src/cf/mod.rs +30 -0
  70. package/reader-backports/netcdf-reader/src/cf/time.rs +1122 -0
  71. package/reader-backports/netcdf-reader/src/classic/data.rs +1465 -0
  72. package/reader-backports/netcdf-reader/src/classic/header.rs +1097 -0
  73. package/reader-backports/netcdf-reader/src/classic/mod.rs +240 -0
  74. package/reader-backports/netcdf-reader/src/classic/storage.rs +211 -0
  75. package/reader-backports/netcdf-reader/src/classic/types.rs +93 -0
  76. package/reader-backports/netcdf-reader/src/classic/variable.rs +1162 -0
  77. package/reader-backports/netcdf-reader/src/error.rs +59 -0
  78. package/reader-backports/netcdf-reader/src/lib.rs +1531 -0
  79. package/reader-backports/netcdf-reader/src/masked.rs +173 -0
  80. package/reader-backports/netcdf-reader/src/nc4/attributes.rs +203 -0
  81. package/reader-backports/netcdf-reader/src/nc4/dimensions.rs +139 -0
  82. package/reader-backports/netcdf-reader/src/nc4/groups.rs +308 -0
  83. package/reader-backports/netcdf-reader/src/nc4/mod.rs +572 -0
  84. package/reader-backports/netcdf-reader/src/nc4/types.rs +309 -0
  85. package/reader-backports/netcdf-reader/src/nc4/variables.rs +420 -0
  86. package/reader-backports/netcdf-reader/src/types.rs +18 -0
  87. package/reader-backports/netcdf-reader/src/unpack.rs +113 -0
  88. package/reader-backports/netcdf-reader/src/user_defined.rs +569 -0
@@ -0,0 +1,164 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but not
32
+ limited to compiled object code, generated documentation, and
33
+ conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work.
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object
40
+ form, that is based on (or derived from) the Work and for which the
41
+ editorial revisions, annotations, elaborations, or other modifications
42
+ represent, as a whole, an original work of authorship.
43
+
44
+ "Contribution" shall mean any work of authorship, including the original
45
+ version of the Work and any modifications or additions to that Work or
46
+ Derivative Works thereof, that is intentionally submitted to the Licensor
47
+ for inclusion in the Work by the copyright owner or by an individual or
48
+ Legal Entity authorized to submit on behalf of the copyright owner.
49
+
50
+ "Contributor" shall mean Licensor and any individual or Legal Entity
51
+ on behalf of whom a Contribution has been received by the Licensor and
52
+ subsequently incorporated within the Work.
53
+
54
+ 2. Grant of Copyright License. Subject to the terms and conditions of
55
+ this License, each Contributor hereby grants to You a perpetual,
56
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
57
+ copyright license to reproduce, prepare Derivative Works of,
58
+ publicly display, publicly perform, sublicense, and distribute the
59
+ Work and such Derivative Works in Source or Object form.
60
+
61
+ 3. Grant of Patent License. Subject to the terms and conditions of
62
+ this License, each Contributor hereby grants to You a perpetual,
63
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
64
+ (except as stated in this section) patent license to make, have made,
65
+ use, offer to sell, sell, import, and otherwise transfer the Work,
66
+ where such license applies only to those patent claims licensable
67
+ by such Contributor that are necessarily infringed by their
68
+ Contribution(s) alone or by combination of their Contribution(s)
69
+ with the Work to which such Contribution(s) was submitted.
70
+
71
+ 4. Redistribution. You may reproduce and distribute copies of the
72
+ Work or Derivative Works thereof in any medium, with or without
73
+ modifications, and in Source or Object form, provided that You
74
+ meet the following conditions:
75
+
76
+ (a) You must give any other recipients of the Work or
77
+ Derivative Works a copy of this License; and
78
+
79
+ (b) You must cause any modified files to carry prominent notices
80
+ stating that You changed the files; and
81
+
82
+ (c) You must retain, in the Source form of any Derivative Works
83
+ that You distribute, all copyright, patent, trademark, and
84
+ attribution notices from the Source form of the Work,
85
+ excluding those notices that do not pertain to any part of
86
+ the Derivative Works; and
87
+
88
+ (d) If the Work includes a "NOTICE" text file as part of its
89
+ distribution, then any Derivative Works that You distribute must
90
+ include a readable copy of the attribution notices contained
91
+ within such NOTICE file, excluding any notices that do not
92
+ pertain to any part of the Derivative Works, in at least one
93
+ of the following places: within a NOTICE text file distributed
94
+ as part of the Derivative Works; within the Source form or
95
+ documentation, if provided along with the Derivative Works; or,
96
+ within a display generated by the Derivative Works, if and
97
+ wherever such third-party notices normally appear. The contents
98
+ of the NOTICE file are for informational purposes only and
99
+ do not modify the License. You may add Your own attribution
100
+ notices within Derivative Works that You distribute, alongside
101
+ or as an addendum to the NOTICE text from the Work, provided
102
+ that such additional attribution notices cannot be construed
103
+ as modifying the License.
104
+
105
+ You may add Your own copyright statement to Your modifications and
106
+ may provide additional or different license terms and conditions
107
+ for use, reproduction, or distribution of Your modifications, or
108
+ for any such Derivative Works as a whole, provided Your use,
109
+ reproduction, and distribution of the Work otherwise complies with
110
+ the conditions stated in this License.
111
+
112
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
113
+ any Contribution intentionally submitted for inclusion in the Work
114
+ by You to the Licensor shall be under the terms and conditions of
115
+ this License, without any additional terms or conditions.
116
+
117
+ 6. Trademarks. This License does not grant permission to use the trade
118
+ names, trademarks, service marks, or product names of the Licensor,
119
+ except as required for reasonable and customary use in describing the
120
+ origin of the Work.
121
+
122
+ 7. Disclaimer of Warranty. Unless required by applicable law or
123
+ agreed to in writing, Licensor provides the Work (and each
124
+ Contributor provides its Contributions) on an "AS IS" BASIS,
125
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
126
+ implied, including, without limitation, any warranties or conditions
127
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
128
+ PARTICULAR PURPOSE. You are solely responsible for determining the
129
+ appropriateness of using or redistributing the Work and assume any
130
+ risks associated with Your exercise of permissions under this License.
131
+
132
+ 8. Limitation of Liability. In no event and under no legal theory,
133
+ whether in tort (including negligence), contract, or otherwise,
134
+ unless required by applicable law (such as deliberate and grossly
135
+ negligent acts) or agreed to in writing, shall any Contributor be
136
+ liable to You for damages, including any direct, indirect, special,
137
+ incidental, or consequential damages of any character arising as a
138
+ result of this License or out of the use or inability to use the
139
+ Work (including but not limited to damages for loss of goodwill,
140
+ work stoppage, computer failure or malfunction, or any and all
141
+ other commercial damages or losses), even if such Contributor
142
+ has been advised of the possibility of such damages.
143
+
144
+ 9. Accepting Warranty or Additional Liability. While redistributing
145
+ the Work or Derivative Works thereof, You may choose to offer,
146
+ and charge a fee for, acceptance of support, warranty, indemnity,
147
+ or other liability obligations and/or rights consistent with this
148
+ License.
149
+
150
+ END OF TERMS AND CONDITIONS
151
+
152
+ Copyright 2026 Ian Norden
153
+
154
+ Licensed under the Apache License, Version 2.0 (the "License");
155
+ you may not use this file except in compliance with the License.
156
+ You may obtain a copy of the License at
157
+
158
+ http://www.apache.org/licenses/LICENSE-2.0
159
+
160
+ Unless required by applicable law or agreed to in writing, software
161
+ distributed under the License is distributed on an "AS IS" BASIS,
162
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
163
+ See the License for the specific language governing permissions and
164
+ limitations under the License.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ian Norden
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,55 @@
1
+ {
2
+ "schema_version": 1,
3
+ "downstream_package": "nirs4all-netcdf-reader",
4
+ "downstream_version": "0.9.3-nirs4all.1",
5
+ "upstream_package": "netcdf-reader",
6
+ "upstream_version": "0.9.3",
7
+ "upstream_registry": "https://crates.io",
8
+ "upstream_crate_sha256": "773d8adb7844401741abb4786fef0e96cff721542bf1cca2b6e5a85e26a79518",
9
+ "upstream_vcs": {
10
+ "git": {
11
+ "sha1": "3d708fd40c6809f5d215bd2d9f15e9a05de84bd0"
12
+ },
13
+ "path_in_vcs": "netcdf-reader"
14
+ },
15
+ "license": "MIT OR Apache-2.0",
16
+ "changes": [
17
+ "Distinct downstream package identity and Rust 1.85 floor",
18
+ "HDF5 dependency redirected to the separately identified nirs4all security backport"
19
+ ],
20
+ "upstream_source_sha256": {
21
+ "src/cf/axes.rs": "13be78f68255b727b21941495b1683d11a6f0ce731a17965935adbed59b42031",
22
+ "src/cf/bounds.rs": "17ffc45db0989c808d80f3919984ba42f9590c9122408befc06a47e1e477698f",
23
+ "src/cf/crs.rs": "2f87cc8f517446768b3ba84e1acb236bcf6746eb1bab8148e81bfd7c8a05230a",
24
+ "src/cf/mod.rs": "29d0eed5f2c4d110a7182900ffb8e61e35a4da2f9523ee9b48d4c25dd5f2007f",
25
+ "src/cf/time.rs": "b92b330af8d76d64573e63136e0801542f33510854df6853dea4bc213ae4e6b7",
26
+ "src/classic/data.rs": "1a32f780ad522b7624ceee94d5ea76f7c294e7dd088dd82921aee6347a006e8e",
27
+ "src/classic/header.rs": "a428b834edbbace63c725f1ebc08ef3683ea5eac07ee056818a4e1ec2d09d18d",
28
+ "src/classic/mod.rs": "129aaa7626e40116bc715f71cd5c53201c8f31b114524a11a8de643f7fdc2bc1",
29
+ "src/classic/storage.rs": "79bade957e26c5cfb2a28e8da0eca569c2dc3c52d8ced7a3146354160b72b27b",
30
+ "src/classic/types.rs": "9fe2dd3a7aceb863cd3bef4870aac29c02064d2f830611a04d1989924c3ac8c3",
31
+ "src/classic/variable.rs": "c5c8d3e8cdbd621b01660ec1561bdbe01984a1ed58f84085f61d5992c3aad4ac",
32
+ "src/error.rs": "eb2f0ad3ffd310804e1bba665713799a01677c87e6868a52522609cf65a8b4b1",
33
+ "src/lib.rs": "3bd98abd9d48643b976ada4f7160c408d9b3d7f3524e85f2216f81089a1ac855",
34
+ "src/masked.rs": "a1a4b5b691bfa859c4be977329d236af5114286571121f43661f8afa27716435",
35
+ "src/nc4/attributes.rs": "85e0f6fabf31d2e5fd6299e03b75dd634d708aa2b80bd132f0bcab999f3180ef",
36
+ "src/nc4/dimensions.rs": "39e387a9cfa7b659882f12fa813124a70ccab3d64a752f7ad212f29fcf33cb77",
37
+ "src/nc4/groups.rs": "7ee002d6fc6f9dfc95cd8979f311bdfcaefb0df410adb5f9b852630274d523b9",
38
+ "src/nc4/mod.rs": "d063257a5f6ff5163cb3335e7c6c1d6c9a278d21ea0e14b7c15be5f2baabea95",
39
+ "src/nc4/types.rs": "8935f3302299de580f1953eb2ff4f74433d648f8554e72bdda650f62eade9750",
40
+ "src/nc4/variables.rs": "c3dce236701c59be9c77da5ed3806b3884db149caf369c494493bed618daef67",
41
+ "src/types.rs": "63905e39f6928a08f535394e770d577b880bda9195fcf76759e63ae19032ef20",
42
+ "src/unpack.rs": "389a13a47a282ed95dcfcdb3df07ba039a3c66603d966b4eacd2f6ff8b634977",
43
+ "src/user_defined.rs": "45803f57ab037a2fcb24e6ad7b5a8f7fb1cf6e50d8f60ad34c8133e1782f7ba2"
44
+ },
45
+ "bundled_license_texts": {
46
+ "LICENSE-MIT": {
47
+ "source": "https://raw.githubusercontent.com/roteiro-gis/netcdf-rust/3d708fd40c6809f5d215bd2d9f15e9a05de84bd0/LICENSE-MIT",
48
+ "sha256": "24a4eeee33afc227bd3e796f772741250b2c93eae1cdba65e775ef8005dfb4b1"
49
+ },
50
+ "LICENSE-APACHE": {
51
+ "source": "https://raw.githubusercontent.com/roteiro-gis/netcdf-rust/3d708fd40c6809f5d215bd2d9f15e9a05de84bd0/LICENSE-APACHE",
52
+ "sha256": "7e1c4927d7c8765c73e234c2da19c423dfafc9c662e6d028277f9e77476445bb"
53
+ }
54
+ }
55
+ }
@@ -0,0 +1,308 @@
1
+ # netcdf-rust
2
+
3
+ [![hdf5-reader crates.io](https://img.shields.io/crates/v/hdf5-reader.svg)](https://crates.io/crates/hdf5-reader)
4
+ [![hdf5-reader docs.rs](https://docs.rs/hdf5-reader/badge.svg)](https://docs.rs/hdf5-reader)
5
+ [![hdf5-writer crates.io](https://img.shields.io/crates/v/hdf5-writer.svg)](https://crates.io/crates/hdf5-writer)
6
+ [![hdf5-writer docs.rs](https://docs.rs/hdf5-writer/badge.svg)](https://docs.rs/hdf5-writer)
7
+ [![netcdf-reader crates.io](https://img.shields.io/crates/v/netcdf-reader.svg)](https://crates.io/crates/netcdf-reader)
8
+ [![netcdf-reader docs.rs](https://docs.rs/netcdf-reader/badge.svg)](https://docs.rs/netcdf-reader)
9
+ [![netcdf-writer crates.io](https://img.shields.io/crates/v/netcdf-writer.svg)](https://crates.io/crates/netcdf-writer)
10
+ [![netcdf-writer docs.rs](https://docs.rs/netcdf-writer/badge.svg)](https://docs.rs/netcdf-writer)
11
+
12
+ Pure-Rust readers and writers for HDF5 and NetCDF. The published library dependency graph has no C libraries or build scripts; internal `unsafe` is limited to read-only memory mapping and performance-critical decoding/copy paths.
13
+
14
+ Reference tests, benchmarks, fixture generators, and fuzz targets may use native
15
+ tooling such as NetCDF-C/HDF5 through dev-only dependencies. Those paths are not
16
+ part of the library runtime dependency graph. Writer output is validated against
17
+ the reference C libraries (libhdf5 via h5py, netcdf-c via netCDF4-python) in
18
+ addition to round-tripping through the sibling reader crates.
19
+
20
+ ## Crates
21
+
22
+ | Crate | Description |
23
+ |---|---|
24
+ | `hdf5-core` | Shared HDF5 format model and checksums (Jenkins lookup3, Fletcher-32) |
25
+ | `hdf5-reader` | Low-level HDF5 decoder (superblock, object headers, B-trees, chunked I/O, filters) |
26
+ | `hdf5-writer` | HDF5 encoder (contiguous/compact/chunked layouts, groups, attributes, filters, datatypes) |
27
+ | `netcdf-core` | Shared NetCDF data model (types, attributes, dimensions, variables) |
28
+ | `netcdf-reader` | NetCDF reader supporting CDF-1/2/5 classic and NetCDF-4 (HDF5-backed) formats |
29
+ | `netcdf-writer` | NetCDF writer for CDF-1/2/5 classic and NetCDF-4 (HDF5-backed) formats |
30
+
31
+ ## Feature support
32
+
33
+ | Feature | Read | Write |
34
+ |---|---|---|
35
+ | Classic CDF-1 / CDF-2 / CDF-5 | ✓ | ✓ |
36
+ | NetCDF-4 (HDF5-backed) | ✓ | ✓ |
37
+ | Chunked layouts (incl. unlimited dims) | ✓ | ✓ |
38
+ | Filters: deflate, shuffle, fletcher32 | ✓ | ✓ |
39
+ | Filters: lz4, nbit, scaleoffset | ✓ | — |
40
+ | Compound / enum / opaque / array / vlen / string datatypes | ✓ | ✓ |
41
+ | Dimension scales (`DIMENSION_LIST` + `REFERENCE_LIST`) | ✓ | ✓ |
42
+ | CF conventions (unpack, mask, calendars) | ✓ | n/a |
43
+ | szip filter, virtual datasets | — | — |
44
+
45
+ The minimum supported Rust version is 1.81. Reads are hardened against malformed
46
+ input: bounds-checked cursors, cycle detection in B-tree/heap/object-header
47
+ traversals, recursion-depth limits, and file-size-bounded allocation. The reader
48
+ crates are exercised by a corpus/property/fuzz suite in addition to
49
+ reference-oracle tests against the C libraries.
50
+
51
+ Not yet supported (contributions welcome): writing the szip / lz4 / nbit /
52
+ scaleoffset filters; typed compound-value writing; appending to or updating an
53
+ existing file in place; HDF5 virtual datasets; and object-header messages larger
54
+ than 64 KiB.
55
+
56
+ ## Usage
57
+
58
+ ```rust
59
+ use netcdf_reader::{NcFile, NcSliceInfo, NcSliceInfoElem};
60
+
61
+ let file = NcFile::open("era5.nc")?;
62
+ println!("format: {:?}", file.format());
63
+
64
+ for var in file.variables()? {
65
+ println!(" var: {} {:?}", var.name(), var.shape());
66
+ }
67
+
68
+ // Read typed data (works for both classic and NetCDF-4)
69
+ let temp: ndarray::ArrayD<f32> = file.read_variable("temperature")?;
70
+
71
+ // Type-promoting read (any numeric type → f64)
72
+ let data = file.read_variable_as_f64("temperature")?;
73
+
74
+ // String variables (classic char arrays and NetCDF-4 NC_STRING)
75
+ let names = file.read_variable_as_strings("station_name")?;
76
+
77
+ // NetCDF-4 user-defined variables (enum, opaque, compound, array, vlen)
78
+ let quality = file.read_variable_user_defined("quality")?;
79
+
80
+ // CF conventions: unpack packed integer data (scale_factor + add_offset)
81
+ let unpacked = file.read_variable_unpacked("temperature")?;
82
+
83
+ // CF conventions: mask fill values + unpack in one call
84
+ let clean = file.read_variable_unpacked_masked("temperature")?;
85
+
86
+ // Hyperslab: read a single time step from a 4D variable
87
+ let sel = NcSliceInfo {
88
+ selections: vec![
89
+ NcSliceInfoElem::Index(0), // time=0
90
+ NcSliceInfoElem::Slice { start: 0, end: u64::MAX, step: 1 }, // all levels
91
+ NcSliceInfoElem::Slice { start: 0, end: u64::MAX, step: 1 }, // all lat
92
+ NcSliceInfoElem::Slice { start: 0, end: u64::MAX, step: 1 }, // all lon
93
+ ],
94
+ };
95
+ let step: ndarray::ArrayD<f32> = file.read_variable_slice("temperature", &sel)?;
96
+
97
+ // Lazy iteration over time steps
98
+ for slice in file.iter_slices::<f32>("temperature", 0)? {
99
+ let data = slice?;
100
+ println!(" step shape: {:?}", data.shape());
101
+ }
102
+
103
+ // In-memory open with custom NC4 cache/filter options
104
+ let bytes = std::fs::read("era5.nc")?;
105
+ let file = NcFile::from_bytes_with_options(&bytes, netcdf_reader::NcOpenOptions {
106
+ chunk_cache_bytes: 8 * 1024 * 1024,
107
+ chunk_cache_slots: 257,
108
+ metadata_mode: netcdf_reader::NcMetadataMode::Strict,
109
+ #[cfg(feature = "netcdf4")]
110
+ filter_registry: None,
111
+ })?;
112
+ ```
113
+
114
+ Using `hdf5-reader` directly:
115
+
116
+ ```rust
117
+ use hdf5_reader::Hdf5File;
118
+
119
+ let file = Hdf5File::open("data.h5")?;
120
+ let ds = file.dataset("/group1/temperature")?;
121
+ let data: ndarray::ArrayD<f64> = ds.read_array()?;
122
+
123
+ // Hyperslab selection
124
+ use hdf5_reader::{SliceInfo, SliceInfoElem};
125
+ let sel = SliceInfo {
126
+ selections: vec![
127
+ SliceInfoElem::Slice { start: 0, end: 10, step: 1 },
128
+ SliceInfoElem::Index(5),
129
+ ],
130
+ };
131
+ let slice: ndarray::ArrayD<f64> = ds.read_slice(&sel)?;
132
+
133
+ // String datasets
134
+ let labels = file.dataset("/labels")?.read_strings()?;
135
+ ```
136
+
137
+ ### Writing
138
+
139
+ `netcdf-writer` builds a file from dimensions, variables, and attributes and
140
+ serializes it to any classic or NetCDF-4 format:
141
+
142
+ ```rust
143
+ use netcdf_writer::{NcAttrValue, NcFileBuilder, NcWriteOptions};
144
+
145
+ let mut builder = NcFileBuilder::new();
146
+ let time = builder.add_unlimited_dimension("time")?;
147
+ let x = builder.add_dimension("x", 3)?;
148
+
149
+ builder.add_attribute("title", NcAttrValue::Chars("example".into()))?;
150
+
151
+ let temp = builder.add_variable::<f32>("temp", &[time, x])?;
152
+ builder.add_variable_attribute(temp, "units", NcAttrValue::Chars("K".into()))?;
153
+ builder.write_variable(temp, &[280.0_f32, 281.0, 282.0, 283.0, 284.0, 285.0])?;
154
+
155
+ // AutoClassic picks CDF-1/2/5 from the schema; other options force a format.
156
+ let (_format, bytes) = builder.to_vec(NcWriteOptions::default())?;
157
+ std::fs::write("out.nc", bytes)?;
158
+
159
+ // NetCDF-4 (HDF5-backed) output:
160
+ use netcdf_writer::NcWriteFormat;
161
+ let (_format, nc4_bytes) =
162
+ builder.to_vec(NcWriteOptions { format: NcWriteFormat::Nc4 })?;
163
+ ```
164
+
165
+ `hdf5-writer` offers the same for raw HDF5 via `Hdf5Builder` / `DatasetBuilder`
166
+ / `AttributeBuilder`.
167
+
168
+ ## Features
169
+
170
+ **HDF5**
171
+ - Superblock v0-v3 and object header v1/v2 with checksum verification
172
+ - Compact, contiguous, and chunked layouts
173
+ - All chunk index types: v1/v2 B-tree, single-chunk, implicit, Fixed Array, Extensible Array
174
+ - Deflate, shuffle, Fletcher-32, N-Bit, ScaleOffset, and optional LZ4 filters
175
+ - Custom filters via `FilterRegistry`
176
+ - Fixed-length strings, HDF5 variable-length strings, and byte-vlen string datasets
177
+ - Dense-link resolution, soft-link resolution, optional external-link resolution, committed datatypes, global heap strings, and object references
178
+ - SOHM shared-message lookup, fractal heap managed/tiny/huge objects, and external raw data files
179
+ - Parallel chunk decoding, chunk caching, and object-header caching
180
+ - Range-backed opens via `Storage` backends (`BytesStorage`, `FileStorage`, `MmapStorage`)
181
+
182
+ **NetCDF**
183
+ - CDF-1, CDF-2, CDF-5, and NetCDF-4
184
+ - Automatic format detection
185
+ - Unified typed reads across formats
186
+ - Unified string reads for classic char arrays and NetCDF-4 string variables
187
+ - NetCDF-4 user-defined reads for enum, opaque, compound, fixed-size array,
188
+ and non-string vlen variables, including custom borrowed decoders
189
+ - Type promotion to `f64`, unpacking, masking, and combined CF helpers
190
+ - Coordinate-variable lookup plus CF axis/time discovery when `cf` is enabled
191
+ - Exact CF time decoding for standard, proleptic Gregorian, noleap, all_leap,
192
+ 360_day, and Julian calendars when `cf` is enabled
193
+ - Slice reads, lazy slice iteration, and parallel NC4 slice reads
194
+ - Cache and filter configuration through `NcOpenOptions`, including in-memory and storage-backed opens
195
+
196
+ ## Parallel-I/O Compatibility
197
+
198
+ This project reads files. It does not provide distributed parallel I/O APIs.
199
+
200
+ - PnetCDF-produced CDF-1, CDF-2, and CDF-5 files are supported as ordinary
201
+ classic-format NetCDF files. PnetCDF's MPI-IO API surface is not implemented.
202
+ - NetCDF-C files created with `nc_create_par` or Parallel HDF5 are supported
203
+ when the final file is a normal NetCDF-4/HDF5 file that uses HDF5 features
204
+ supported by `hdf5-reader`. Parallel access mode is an open-time API concern,
205
+ not a persistent file property.
206
+ - The Rayon APIs in this crate parallelize local decoding and independent byte
207
+ range reads inside one process. They are not equivalent to MPI-IO collective
208
+ or independent access modes.
209
+ - PnetCDF subfiling is out of scope for now because it is not an ordinary
210
+ single-file CDF-1/2/5 dataset.
211
+
212
+ ## Feature flags
213
+
214
+ Minimum supported Rust version: 1.81.
215
+
216
+ ```toml
217
+ [dependencies]
218
+ netcdf-reader = "0.9.3" # CDF-1/2/5 + NetCDF-4 (default)
219
+ netcdf-reader = { version = "0.9.3", default-features = false } # CDF-1/2/5 only
220
+ netcdf-writer = "0.9.3" # Classic + NetCDF-4 writer (default)
221
+ hdf5-writer = "0.9.3" # Raw HDF5 writer
222
+ ```
223
+
224
+ | Flag | Default | Description |
225
+ |---|---|---|
226
+ | `netcdf4` | yes | NetCDF-4 support via `hdf5-reader` |
227
+ | `rayon` | yes | Parallel chunk reading |
228
+ | `lz4` | yes | LZ4 filter support (hdf5-reader) |
229
+ | `cf` | no | CF Conventions helpers (axis identification, time decoding, CRS extraction, bounds) |
230
+
231
+ ## External Raw Data Files
232
+
233
+ HDF5 external raw data files are not resolved by default. To allow them for
234
+ trusted files, opt in with a resolver rooted at the directory that should
235
+ contain the external data. The filesystem resolver rejects absolute paths and
236
+ `..` components. On Unix, it opens paths relative to the resolver root with
237
+ `openat` and `O_NOFOLLOW`, so symlinks are rejected rather than followed. The
238
+ same confinement is applied by `FilesystemExternalLinkResolver` when external
239
+ links are enabled. On non-Unix platforms, the filesystem resolvers fall back to
240
+ canonicalize-then-open and attacker-writable resolver roots are out of scope.
241
+
242
+ ```rust
243
+ use std::path::Path;
244
+ use std::sync::Arc;
245
+
246
+ use hdf5_reader::{FilesystemExternalFileResolver, Hdf5File, OpenOptions};
247
+
248
+ let path = Path::new("data.h5");
249
+ let base_dir = path.parent().unwrap_or_else(|| Path::new("."));
250
+ let file = Hdf5File::open_with_options(path, OpenOptions {
251
+ external_file_resolver: Some(Arc::new(FilesystemExternalFileResolver::new(base_dir))),
252
+ ..Default::default()
253
+ })?;
254
+ ```
255
+
256
+ ## Custom filters
257
+
258
+ Register filters before opening files:
259
+
260
+ ```rust
261
+ use hdf5_reader::{Hdf5File, OpenOptions};
262
+ use hdf5_reader::filters::FilterRegistry;
263
+
264
+ let mut registry = FilterRegistry::new();
265
+ registry.register(32001, Box::new(|_filter, data, _elem_size| {
266
+ // Custom decompression logic
267
+ Ok(data.to_vec())
268
+ }));
269
+
270
+ let file = Hdf5File::open_with_options("data.h5", OpenOptions {
271
+ filter_registry: Some(registry),
272
+ ..Default::default()
273
+ })?;
274
+ ```
275
+
276
+ ## Testing
277
+
278
+ ```sh
279
+ # Unit tests (no external dependencies)
280
+ cargo test --workspace
281
+
282
+ # Integration tests with generated fixtures
283
+ scripts/generate-fixtures.sh
284
+ cargo test --workspace
285
+ ```
286
+
287
+ Small compatibility fixtures under `testdata/pnetcdf` and `testdata/parallel`
288
+ exercise standard CDF-1/2/5 and NetCDF-4 files matching layouts produced by
289
+ PnetCDF and parallel netCDF-C/HDF5 workflows. Reference C generators that use
290
+ those external parallel libraries live under `testdata/external`; they are not
291
+ library dependencies.
292
+
293
+ For reference comparisons and current benchmark results against
294
+ `georust/netcdf`, see [docs/benchmark-report.md](docs/benchmark-report.md).
295
+
296
+ ## Releasing
297
+
298
+ See [RELEASING.md](RELEASING.md) for the release checklist and the required
299
+ publish order for all six crates.
300
+
301
+ ## Known limitations
302
+
303
+ - SZIP is not built in (register via `FilterRegistry` if needed)
304
+ - ScaleOffset floating-point E-scale mode is not supported by the HDF5 decoder path
305
+
306
+ ## License
307
+
308
+ MIT OR Apache-2.0
@@ -0,0 +1,48 @@
1
+ [package]
2
+ name = "netcdf-reader"
3
+ description = "Pure-Rust NetCDF-3 classic and NetCDF-4 (HDF5-backed) file reader"
4
+ version.workspace = true
5
+ edition.workspace = true
6
+ rust-version.workspace = true
7
+ license.workspace = true
8
+ repository.workspace = true
9
+ homepage.workspace = true
10
+ readme = "../README.md"
11
+ documentation = "https://docs.rs/netcdf-reader"
12
+ keywords = ["netcdf", "hdf5", "decoder", "scientific-data", "read-only"]
13
+ categories = ["science", "parser-implementations"]
14
+
15
+ [lints]
16
+ workspace = true
17
+
18
+ [dependencies]
19
+ netcdf-core = { version = "0.9.3", path = "../netcdf-core" }
20
+ ndarray = { workspace = true }
21
+ thiserror = { workspace = true }
22
+ memmap2 = { workspace = true }
23
+ hdf5-reader = { version = "0.9.3", path = "../hdf5-reader", optional = true }
24
+ rayon = { version = "1", optional = true }
25
+
26
+ [dev-dependencies]
27
+ tempfile = "3"
28
+ criterion = "0.5"
29
+ netcdf = { version = "0.12", features = ["static"] }
30
+ proptest = "1"
31
+ peak_alloc = "0.2"
32
+
33
+ [features]
34
+ default = ["netcdf4", "rayon"]
35
+ netcdf4 = ["dep:hdf5-reader"]
36
+ # Parallel reads for the classic backend do not require the HDF5 stack; when
37
+ # `netcdf4` is also enabled, forward `rayon` to `hdf5-reader` as well.
38
+ rayon = ["dep:rayon", "hdf5-reader?/rayon"]
39
+ cf = ["dep:chrono"]
40
+ bench-memory-profile = []
41
+
42
+ [dependencies.chrono]
43
+ version = "0.4"
44
+ optional = true
45
+
46
+ [[bench]]
47
+ name = "compare_georust"
48
+ harness = false
@@ -0,0 +1,6 @@
1
+ {
2
+ "git": {
3
+ "sha1": "3d708fd40c6809f5d215bd2d9f15e9a05de84bd0"
4
+ },
5
+ "path_in_vcs": "netcdf-reader"
6
+ }