@earthyscience/netcdf4-wasm 0.2.4 → 0.4.0
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.
- package/CONTRIBUTING.md +29 -22
- package/README.md +36 -5
- package/dist/constants.d.ts +165 -146
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +48 -60
- package/dist/constants.js.map +1 -1
- package/dist/dimension.js +1 -1
- package/dist/errors.d.ts +3 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +15 -0
- package/dist/errors.js.map +1 -0
- package/dist/group.d.ts +4 -5
- package/dist/group.d.ts.map +1 -1
- package/dist/group.js +11 -69
- package/dist/group.js.map +1 -1
- package/dist/index.d.ts +15 -16
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -16
- package/dist/index.js.map +1 -1
- package/dist/netcdf-getters.d.ts +5 -5
- package/dist/netcdf-getters.d.ts.map +1 -1
- package/dist/netcdf-getters.js +79 -52
- package/dist/netcdf-getters.js.map +1 -1
- package/dist/netcdf-worker.js +38 -109
- package/dist/netcdf-worker.js.map +1 -1
- package/dist/netcdf4-wasm.js +2 -2
- package/dist/netcdf4-wasm.wasm +0 -0
- package/dist/netcdf4.d.ts +25 -20
- package/dist/netcdf4.d.ts.map +1 -1
- package/dist/netcdf4.js +291 -476
- package/dist/netcdf4.js.map +1 -1
- package/dist/operations.d.ts +67 -0
- package/dist/operations.d.ts.map +1 -0
- package/dist/operations.js +57 -0
- package/dist/operations.js.map +1 -0
- package/dist/remote-read.d.ts +58 -0
- package/dist/remote-read.d.ts.map +1 -0
- package/dist/remote-read.js +244 -0
- package/dist/remote-read.js.map +1 -0
- package/dist/slice.d.ts.map +1 -1
- package/dist/slice.js.map +1 -1
- package/dist/types.d.ts +38 -415
- package/dist/types.d.ts.map +1 -1
- package/dist/variable.d.ts +1 -1
- package/dist/variable.d.ts.map +1 -1
- package/dist/variable.js +60 -78
- package/dist/variable.js.map +1 -1
- package/dist/wasm-module.d.ts +468 -2
- package/dist/wasm-module.d.ts.map +1 -1
- package/dist/wasm-module.js +331 -251
- package/dist/wasm-module.js.map +1 -1
- package/package.json +17 -14
- package/dist/test-setup.d.ts +0 -13
- package/dist/test-setup.d.ts.map +0 -1
- package/dist/test-setup.js +0 -78
- package/dist/test-setup.js.map +0 -1
package/CONTRIBUTING.md
CHANGED
|
@@ -6,20 +6,20 @@ If you have questions, ideas, or just want to chat, please reach out to us anyti
|
|
|
6
6
|
|
|
7
7
|
## How You Can Contribute
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
- **Report bugs or suggest features:** [Open a GitHub issue](https://github.com/EarthyScience/netcdf4-wasm/issues/new/) to let us know about problems or ideas.
|
|
10
|
+
- **Start or join a discussion:** [Create a GitHub discussion](https://github.com/EarthyScience/netcdf4-wasm/discussions/new/choose) to ask questions, share experiences, or brainstorm.
|
|
11
|
+
- **Improve documentation:** Help us make our docs clearer and more helpful for everyone.
|
|
12
|
+
- **Write code:** Fix bugs, add features, or improve performance.
|
|
13
|
+
- **Add examples:** Create usage examples or tutorials showing how to use `netcdf4-wasm` in different scenarios.
|
|
14
14
|
|
|
15
15
|
### Tips for Creating Issues
|
|
16
16
|
|
|
17
17
|
The most helpful bug reports:
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
- Include a clear code snippet (not just a link) that shows the problem in the latest version of `netcdf4-wasm`. A ["minimal working example"](https://en.wikipedia.org/wiki/Minimal_working_example) is ideal.
|
|
20
|
+
- Paste the full error message you received, even if it's long.
|
|
21
|
+
- Use triple backticks (` ``` `) for code, and [markdown formatting](https://docs.github.com/en/github/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax) to keep things readable.
|
|
22
|
+
- Share your `netcdf4-wasm` version, Node.js/browser version, and details about your environment (OS, browser, etc.).
|
|
23
23
|
|
|
24
24
|
Discussions are great for questions about usage, implementation, WebAssembly compilation, NetCDF formats, or anything else.
|
|
25
25
|
|
|
@@ -33,19 +33,23 @@ To start developing `netcdf4-wasm`:
|
|
|
33
33
|
```bash
|
|
34
34
|
npm install
|
|
35
35
|
```
|
|
36
|
+
|
|
36
37
|
4. Check that you have all build dependencies:
|
|
37
38
|
```bash
|
|
38
39
|
npm run check-deps
|
|
39
40
|
```
|
|
41
|
+
|
|
40
42
|
5. If you need Emscripten for building WASM:
|
|
41
43
|
```bash
|
|
42
44
|
npm run install-emscripten
|
|
43
45
|
```
|
|
46
|
+
|
|
44
47
|
6. Build the project:
|
|
45
48
|
```bash
|
|
46
49
|
npm run build
|
|
47
50
|
```
|
|
48
|
-
|
|
51
|
+
|
|
52
|
+
7. Run tests to ensure everything works (they need the WASM module from step 6, see [tests/README.md](tests/README.md)):
|
|
49
53
|
```bash
|
|
50
54
|
npm test
|
|
51
55
|
```
|
|
@@ -62,7 +66,6 @@ Understanding the project structure will help you navigate the codebase:
|
|
|
62
66
|
```
|
|
63
67
|
netcdf4-wasm/
|
|
64
68
|
├── src/ # TypeScript source code
|
|
65
|
-
│ ├── __tests__/ # Test files
|
|
66
69
|
│ ├── constants.ts # NetCDF constants
|
|
67
70
|
│ ├── dimension.ts # Dimension class
|
|
68
71
|
│ ├── group.ts # Group class
|
|
@@ -71,10 +74,14 @@ netcdf4-wasm/
|
|
|
71
74
|
│ ├── netcdf-worker.ts # Web Worker implementation
|
|
72
75
|
│ ├── netcdf4-wasm.d.ts # TypeScript declarations
|
|
73
76
|
│ ├── netcdf4.ts # Main NetCDF4 class
|
|
74
|
-
│ ├──
|
|
77
|
+
│ ├── operations.ts # Operations shared by the main thread and the worker
|
|
75
78
|
│ ├── types.ts # Type definitions
|
|
76
79
|
│ ├── variable.ts # Variable class
|
|
77
80
|
│ └── wasm-module.ts # WASM module loader
|
|
81
|
+
├── tests/ # Vitest tests, see tests/README.md
|
|
82
|
+
│ ├── fixtures/ # Small netCDF files and their generator
|
|
83
|
+
│ ├── unit/ # Tests without the WASM module
|
|
84
|
+
│ └── wasm/ # Tests against the real WASM module
|
|
78
85
|
├── scripts/ # Build scripts
|
|
79
86
|
│ ├── build-wasm.sh # Main WASM build script
|
|
80
87
|
│ ├── check-dependencies.sh
|
|
@@ -106,12 +113,12 @@ netcdf4-wasm/
|
|
|
106
113
|
|
|
107
114
|
## Good First Steps
|
|
108
115
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
116
|
+
- Try out `netcdf4-wasm` using the examples in our documentation. If you hit any problems or have questions, please open an issue!
|
|
117
|
+
- Write an example or tutorial showing how to use `netcdf4-wasm` for reading/writing NetCDF files in the browser or Node.js.
|
|
118
|
+
- Suggest improvements to documentation or code comments.
|
|
119
|
+
- Work on issues labeled `good first issue` or `help wanted`.
|
|
120
|
+
- Improve TypeScript type definitions for better developer experience.
|
|
121
|
+
- Add or improve test coverage.
|
|
115
122
|
|
|
116
123
|
If you want to work on something, let us know by commenting on an issue or opening a new one. This helps us coordinate and support you.
|
|
117
124
|
|
|
@@ -153,8 +160,8 @@ We are committed to providing a welcoming and inclusive environment. Please be r
|
|
|
153
160
|
|
|
154
161
|
## Getting Help
|
|
155
162
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
163
|
+
- **Questions about usage?** Open a [GitHub discussion](https://github.com/EarthyScience/netcdf4-wasm/discussions)
|
|
164
|
+
- **Found a bug?** Open an [issue](https://github.com/EarthyScience/netcdf4-wasm/issues)
|
|
165
|
+
- **Want to chat?** Reach out to the maintainers
|
|
159
166
|
|
|
160
|
-
We're excited to have you join our community. Thank you for helping make `netcdf4-wasm` better!
|
|
167
|
+
We're excited to have you join our community. Thank you for helping make `netcdf4-wasm` better!
|
package/README.md
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
# netcdf4-wasm [](https://earthyscience.github.io/netcdf4-wasm/viewer/)
|
|
2
2
|
|
|
3
|
-
|
|
4
3
|
[](https://www.npmjs.com/package/@earthyscience/netcdf4-wasm)
|
|
5
4
|
[](https://github.com/EarthyScience/netcdf4-wasm/blob/main/LICENSE)
|
|
6
5
|
[](https://www.unidata.ucar.edu/software/netcdf/)
|
|
7
6
|
[](https://www.typescriptlang.org/)
|
|
8
7
|
[](https://webassembly.org/)
|
|
9
|
-
[](https://kulshekhar.github.io/ts-jest/)
|
|
8
|
+
[](https://emscripten.org/)
|
|
9
|
+
[](https://vitest.dev/)
|
|
12
10
|
|
|
13
11
|
|
|
14
12
|
<img src="https://raw.githubusercontent.com/EarthyScience/netcdf4-wasm/6eecb7eea2da775c139ebddf3f544efc6593ee2f/assets/logo.svg" align="right" style="padding-left:10px;" width="180"/>
|
|
@@ -38,7 +36,7 @@ npm install @earthyscience/netcdf4-wasm
|
|
|
38
36
|
## Quick Start
|
|
39
37
|
|
|
40
38
|
```typescript
|
|
41
|
-
import { NetCDF4, DataTree } from
|
|
39
|
+
import { NetCDF4, DataTree } from "@earthyscience/netcdf4-wasm";
|
|
42
40
|
|
|
43
41
|
// Open existing file
|
|
44
42
|
const ds = await NetCDF4.fromBlobLazy(file);
|
|
@@ -46,6 +44,39 @@ const dt = new DataTree(ds);
|
|
|
46
44
|
await dt.buildTree();
|
|
47
45
|
```
|
|
48
46
|
|
|
47
|
+
### Remote files
|
|
48
|
+
|
|
49
|
+
`NetCDF4.fromUrl` opens a file over HTTP(S) without downloading it: a Web Worker
|
|
50
|
+
fetches only the byte ranges netCDF-C reads, and keeps them in a block cache.
|
|
51
|
+
`Dataset(url)` and `NetCDF4.Dataset(url)` do the same for `http(s)://` strings and `URL` objects.
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
const ds = await NetCDF4.fromUrl("https://example.org/data.nc", {
|
|
55
|
+
headers: { Authorization: "Bearer TOKEN" }, // sent with every request
|
|
56
|
+
withCredentials: false, // send cookies cross-origin
|
|
57
|
+
});
|
|
58
|
+
try {
|
|
59
|
+
const values = await ds.getSlicedVariableArray(
|
|
60
|
+
"temperature",
|
|
61
|
+
[0, 0],
|
|
62
|
+
[1, 10],
|
|
63
|
+
);
|
|
64
|
+
} finally {
|
|
65
|
+
await ds.close();
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Remote files are read-only. The server must allow CORS and should support `Range`
|
|
70
|
+
requests; if it ignores them, the whole file is downloaded once.
|
|
71
|
+
|
|
72
|
+
To prevent large full downloads, set `maxFullDownload` to a size limit in bytes. If the server
|
|
73
|
+
ignores `Range` and the file is larger than this limit (or its size is unknown), opening fails
|
|
74
|
+
with an error instead. Set it to `0` to always require `Range` support.
|
|
75
|
+
|
|
76
|
+
If a file is too large to open this way, download it and open it from disk with
|
|
77
|
+
`NetCDF4.fromBlobLazy` instead, which reads only the parts it needs from the local file.
|
|
78
|
+
|
|
79
|
+
|
|
49
80
|
## API Reference
|
|
50
81
|
|
|
51
82
|
The API closely follows [netcdf4-python](https://unidata.github.io/netcdf4-python) conventions, making it intuitive for scientists familiar with Python.
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,147 +1,169 @@
|
|
|
1
1
|
export declare const NC_CONSTANTS: {
|
|
2
|
-
NC_NOERR:
|
|
3
|
-
NC_EBADID:
|
|
4
|
-
NC_ENFILE:
|
|
5
|
-
NC_EEXIST:
|
|
6
|
-
NC_EINVAL:
|
|
7
|
-
NC_EPERM:
|
|
8
|
-
NC_ENOTINDEFINE:
|
|
9
|
-
NC_EINDEFINE:
|
|
10
|
-
NC_EINVALCOORDS:
|
|
11
|
-
NC_EMAXDIMS:
|
|
12
|
-
NC_ENAMEINUSE:
|
|
13
|
-
NC_ENOTATT:
|
|
14
|
-
NC_EMAXATTS:
|
|
15
|
-
NC_EBADTYPE:
|
|
16
|
-
NC_EBADDIM:
|
|
17
|
-
NC_EUNLIMPOS:
|
|
18
|
-
NC_EMAXVARS:
|
|
19
|
-
NC_ENOTVAR:
|
|
20
|
-
NC_EGLOBAL:
|
|
21
|
-
NC_ENOTNC:
|
|
22
|
-
NC_ESTS:
|
|
23
|
-
NC_EMAXNAME:
|
|
24
|
-
NC_EUNLIMIT:
|
|
25
|
-
NC_ENORECVARS:
|
|
26
|
-
NC_ECHAR:
|
|
27
|
-
NC_EEDGE:
|
|
28
|
-
NC_ESTRIDE:
|
|
29
|
-
NC_EBADNAME:
|
|
30
|
-
NC_ERANGE:
|
|
31
|
-
NC_ENOMEM:
|
|
32
|
-
NC_EVARSIZE:
|
|
33
|
-
NC_EDIMSIZE:
|
|
34
|
-
NC_ETRUNC:
|
|
35
|
-
NC_EAXISTYPE:
|
|
36
|
-
NC_EDAP:
|
|
37
|
-
NC_ECURL:
|
|
38
|
-
NC_EIO:
|
|
39
|
-
NC_ENODATA:
|
|
40
|
-
NC_EDAPSVC:
|
|
41
|
-
NC_EDAS:
|
|
42
|
-
NC_EDDS:
|
|
43
|
-
NC_EDATADDS:
|
|
44
|
-
NC_EDAPURL:
|
|
45
|
-
NC_EDAPCONSTRAINT:
|
|
46
|
-
NC_ETRANSLATION:
|
|
47
|
-
NC_EACCESS:
|
|
48
|
-
NC_EAUTH:
|
|
49
|
-
NC_ENOTFOUND:
|
|
50
|
-
NC_ECANTREMOVE:
|
|
51
|
-
NC_EINTERNAL:
|
|
52
|
-
NC_EPNETCDF:
|
|
53
|
-
NC_EHDFERR:
|
|
54
|
-
NC_ECANTREAD:
|
|
55
|
-
NC_ECANTWRITE:
|
|
56
|
-
NC_ECANTCREATE:
|
|
57
|
-
NC_EFILEMETA:
|
|
58
|
-
NC_EDIMMETA:
|
|
59
|
-
NC_EATTMETA:
|
|
60
|
-
NC_EVARMETA:
|
|
61
|
-
NC_ENOCOMPOUND:
|
|
62
|
-
NC_EATTEXISTS:
|
|
63
|
-
NC_ENOTNC4:
|
|
64
|
-
NC_ESTRICTNC3:
|
|
65
|
-
NC_ENOTNC3:
|
|
66
|
-
NC_ENOPAR:
|
|
67
|
-
NC_EPARINIT:
|
|
68
|
-
NC_EBADGRPID:
|
|
69
|
-
NC_EBADTYPID:
|
|
70
|
-
NC_ETYPDEFINED:
|
|
71
|
-
NC_EBADFIELD:
|
|
72
|
-
NC_EBADCLASS:
|
|
73
|
-
NC_EMAPTYPE:
|
|
74
|
-
NC_ELATEFILL:
|
|
75
|
-
NC_ELATEDEF:
|
|
76
|
-
NC_EDIMSCALE:
|
|
77
|
-
NC_ENOGRP:
|
|
78
|
-
NC_ESTORAGE:
|
|
79
|
-
NC_EBADCHUNK:
|
|
80
|
-
NC_ENOTBUILT:
|
|
81
|
-
NC_EDISKLESS:
|
|
82
|
-
NC_ECANTEXTEND:
|
|
83
|
-
NC_EMPI:
|
|
84
|
-
NC_NOWRITE:
|
|
85
|
-
NC_WRITE:
|
|
86
|
-
NC_CLOBBER:
|
|
87
|
-
NC_NOCLOBBER:
|
|
88
|
-
NC_DISKLESS:
|
|
89
|
-
NC_MMAP:
|
|
90
|
-
NC_64BIT_DATA:
|
|
91
|
-
NC_CDF5:
|
|
92
|
-
NC_CLASSIC_MODEL:
|
|
93
|
-
NC_64BIT_OFFSET:
|
|
94
|
-
NC_NETCDF4:
|
|
95
|
-
NC_SHARE:
|
|
96
|
-
NC_INMEMORY:
|
|
97
|
-
NC_FORMAT_CLASSIC:
|
|
98
|
-
NC_FORMAT_64BIT_OFFSET:
|
|
99
|
-
NC_FORMAT_64BIT:
|
|
100
|
-
NC_FORMAT_NETCDF4:
|
|
101
|
-
NC_FORMAT_NETCDF4_CLASSIC:
|
|
102
|
-
NC_FORMAT_64BIT_DATA:
|
|
103
|
-
NC_FORMAT_CDF5:
|
|
104
|
-
NC_NAT:
|
|
105
|
-
NC_BYTE:
|
|
106
|
-
NC_CHAR:
|
|
107
|
-
NC_SHORT:
|
|
108
|
-
NC_INT:
|
|
109
|
-
NC_LONG:
|
|
110
|
-
NC_FLOAT:
|
|
111
|
-
NC_DOUBLE:
|
|
112
|
-
NC_UBYTE:
|
|
113
|
-
NC_USHORT:
|
|
114
|
-
NC_UINT:
|
|
115
|
-
NC_INT64:
|
|
116
|
-
NC_UINT64:
|
|
117
|
-
NC_STRING:
|
|
118
|
-
NC_LONGLONG:
|
|
119
|
-
NC_ULONGLONG:
|
|
120
|
-
NC_VLEN:
|
|
121
|
-
NC_OPAQUE:
|
|
122
|
-
NC_ENUM:
|
|
123
|
-
NC_COMPOUND:
|
|
124
|
-
NC_FIRSTUSERTYPEID:
|
|
125
|
-
NC_FILL:
|
|
126
|
-
NC_NOFILL:
|
|
127
|
-
NC_CHUNKED:
|
|
128
|
-
NC_CONTIGUOUS:
|
|
129
|
-
NC_COMPACT:
|
|
130
|
-
NC_VIRTUAL:
|
|
131
|
-
NC_ENDIAN_NATIVE:
|
|
132
|
-
NC_ENDIAN_LITTLE:
|
|
133
|
-
NC_ENDIAN_BIG:
|
|
134
|
-
NC_UNLIMITED:
|
|
135
|
-
NC_GLOBAL:
|
|
136
|
-
NC_MAX_DIMS:
|
|
137
|
-
NC_MAX_ATTRS:
|
|
138
|
-
NC_MAX_VARS:
|
|
139
|
-
NC_MAX_NAME:
|
|
140
|
-
NC_MAX_VAR_DIMS:
|
|
141
|
-
NC_NOCHECKSUM:
|
|
142
|
-
NC_FLETCHER32:
|
|
143
|
-
NC_NOSHUFFLE:
|
|
144
|
-
NC_SHUFFLE:
|
|
2
|
+
readonly NC_NOERR: 0;
|
|
3
|
+
readonly NC_EBADID: -33;
|
|
4
|
+
readonly NC_ENFILE: -34;
|
|
5
|
+
readonly NC_EEXIST: -35;
|
|
6
|
+
readonly NC_EINVAL: -36;
|
|
7
|
+
readonly NC_EPERM: -37;
|
|
8
|
+
readonly NC_ENOTINDEFINE: -38;
|
|
9
|
+
readonly NC_EINDEFINE: -39;
|
|
10
|
+
readonly NC_EINVALCOORDS: -40;
|
|
11
|
+
readonly NC_EMAXDIMS: -41;
|
|
12
|
+
readonly NC_ENAMEINUSE: -42;
|
|
13
|
+
readonly NC_ENOTATT: -43;
|
|
14
|
+
readonly NC_EMAXATTS: -44;
|
|
15
|
+
readonly NC_EBADTYPE: -45;
|
|
16
|
+
readonly NC_EBADDIM: -46;
|
|
17
|
+
readonly NC_EUNLIMPOS: -47;
|
|
18
|
+
readonly NC_EMAXVARS: -48;
|
|
19
|
+
readonly NC_ENOTVAR: -49;
|
|
20
|
+
readonly NC_EGLOBAL: -50;
|
|
21
|
+
readonly NC_ENOTNC: -51;
|
|
22
|
+
readonly NC_ESTS: -52;
|
|
23
|
+
readonly NC_EMAXNAME: -53;
|
|
24
|
+
readonly NC_EUNLIMIT: -54;
|
|
25
|
+
readonly NC_ENORECVARS: -55;
|
|
26
|
+
readonly NC_ECHAR: -56;
|
|
27
|
+
readonly NC_EEDGE: -57;
|
|
28
|
+
readonly NC_ESTRIDE: -58;
|
|
29
|
+
readonly NC_EBADNAME: -59;
|
|
30
|
+
readonly NC_ERANGE: -60;
|
|
31
|
+
readonly NC_ENOMEM: -61;
|
|
32
|
+
readonly NC_EVARSIZE: -62;
|
|
33
|
+
readonly NC_EDIMSIZE: -63;
|
|
34
|
+
readonly NC_ETRUNC: -64;
|
|
35
|
+
readonly NC_EAXISTYPE: -65;
|
|
36
|
+
readonly NC_EDAP: -66;
|
|
37
|
+
readonly NC_ECURL: -67;
|
|
38
|
+
readonly NC_EIO: -68;
|
|
39
|
+
readonly NC_ENODATA: -69;
|
|
40
|
+
readonly NC_EDAPSVC: -70;
|
|
41
|
+
readonly NC_EDAS: -71;
|
|
42
|
+
readonly NC_EDDS: -72;
|
|
43
|
+
readonly NC_EDATADDS: -73;
|
|
44
|
+
readonly NC_EDAPURL: -74;
|
|
45
|
+
readonly NC_EDAPCONSTRAINT: -75;
|
|
46
|
+
readonly NC_ETRANSLATION: -76;
|
|
47
|
+
readonly NC_EACCESS: -77;
|
|
48
|
+
readonly NC_EAUTH: -78;
|
|
49
|
+
readonly NC_ENOTFOUND: -90;
|
|
50
|
+
readonly NC_ECANTREMOVE: -91;
|
|
51
|
+
readonly NC_EINTERNAL: -92;
|
|
52
|
+
readonly NC_EPNETCDF: -93;
|
|
53
|
+
readonly NC_EHDFERR: -101;
|
|
54
|
+
readonly NC_ECANTREAD: -102;
|
|
55
|
+
readonly NC_ECANTWRITE: -103;
|
|
56
|
+
readonly NC_ECANTCREATE: -104;
|
|
57
|
+
readonly NC_EFILEMETA: -105;
|
|
58
|
+
readonly NC_EDIMMETA: -106;
|
|
59
|
+
readonly NC_EATTMETA: -107;
|
|
60
|
+
readonly NC_EVARMETA: -108;
|
|
61
|
+
readonly NC_ENOCOMPOUND: -109;
|
|
62
|
+
readonly NC_EATTEXISTS: -110;
|
|
63
|
+
readonly NC_ENOTNC4: -111;
|
|
64
|
+
readonly NC_ESTRICTNC3: -112;
|
|
65
|
+
readonly NC_ENOTNC3: -113;
|
|
66
|
+
readonly NC_ENOPAR: -114;
|
|
67
|
+
readonly NC_EPARINIT: -115;
|
|
68
|
+
readonly NC_EBADGRPID: -116;
|
|
69
|
+
readonly NC_EBADTYPID: -117;
|
|
70
|
+
readonly NC_ETYPDEFINED: -118;
|
|
71
|
+
readonly NC_EBADFIELD: -119;
|
|
72
|
+
readonly NC_EBADCLASS: -120;
|
|
73
|
+
readonly NC_EMAPTYPE: -121;
|
|
74
|
+
readonly NC_ELATEFILL: -122;
|
|
75
|
+
readonly NC_ELATEDEF: -123;
|
|
76
|
+
readonly NC_EDIMSCALE: -124;
|
|
77
|
+
readonly NC_ENOGRP: -125;
|
|
78
|
+
readonly NC_ESTORAGE: -126;
|
|
79
|
+
readonly NC_EBADCHUNK: -127;
|
|
80
|
+
readonly NC_ENOTBUILT: -128;
|
|
81
|
+
readonly NC_EDISKLESS: -129;
|
|
82
|
+
readonly NC_ECANTEXTEND: -130;
|
|
83
|
+
readonly NC_EMPI: -131;
|
|
84
|
+
readonly NC_NOWRITE: 0;
|
|
85
|
+
readonly NC_WRITE: 1;
|
|
86
|
+
readonly NC_CLOBBER: 0;
|
|
87
|
+
readonly NC_NOCLOBBER: 4;
|
|
88
|
+
readonly NC_DISKLESS: 8;
|
|
89
|
+
readonly NC_MMAP: 16;
|
|
90
|
+
readonly NC_64BIT_DATA: 32;
|
|
91
|
+
readonly NC_CDF5: 32;
|
|
92
|
+
readonly NC_CLASSIC_MODEL: 256;
|
|
93
|
+
readonly NC_64BIT_OFFSET: 512;
|
|
94
|
+
readonly NC_NETCDF4: 4096;
|
|
95
|
+
readonly NC_SHARE: 2048;
|
|
96
|
+
readonly NC_INMEMORY: 32768;
|
|
97
|
+
readonly NC_FORMAT_CLASSIC: 1;
|
|
98
|
+
readonly NC_FORMAT_64BIT_OFFSET: 2;
|
|
99
|
+
readonly NC_FORMAT_64BIT: 2;
|
|
100
|
+
readonly NC_FORMAT_NETCDF4: 3;
|
|
101
|
+
readonly NC_FORMAT_NETCDF4_CLASSIC: 4;
|
|
102
|
+
readonly NC_FORMAT_64BIT_DATA: 5;
|
|
103
|
+
readonly NC_FORMAT_CDF5: 5;
|
|
104
|
+
readonly NC_NAT: 0;
|
|
105
|
+
readonly NC_BYTE: 1;
|
|
106
|
+
readonly NC_CHAR: 2;
|
|
107
|
+
readonly NC_SHORT: 3;
|
|
108
|
+
readonly NC_INT: 4;
|
|
109
|
+
readonly NC_LONG: 4;
|
|
110
|
+
readonly NC_FLOAT: 5;
|
|
111
|
+
readonly NC_DOUBLE: 6;
|
|
112
|
+
readonly NC_UBYTE: 7;
|
|
113
|
+
readonly NC_USHORT: 8;
|
|
114
|
+
readonly NC_UINT: 9;
|
|
115
|
+
readonly NC_INT64: 10;
|
|
116
|
+
readonly NC_UINT64: 11;
|
|
117
|
+
readonly NC_STRING: 12;
|
|
118
|
+
readonly NC_LONGLONG: 10;
|
|
119
|
+
readonly NC_ULONGLONG: 11;
|
|
120
|
+
readonly NC_VLEN: 13;
|
|
121
|
+
readonly NC_OPAQUE: 14;
|
|
122
|
+
readonly NC_ENUM: 15;
|
|
123
|
+
readonly NC_COMPOUND: 16;
|
|
124
|
+
readonly NC_FIRSTUSERTYPEID: 32;
|
|
125
|
+
readonly NC_FILL: 0;
|
|
126
|
+
readonly NC_NOFILL: 256;
|
|
127
|
+
readonly NC_CHUNKED: 0;
|
|
128
|
+
readonly NC_CONTIGUOUS: 1;
|
|
129
|
+
readonly NC_COMPACT: 2;
|
|
130
|
+
readonly NC_VIRTUAL: 3;
|
|
131
|
+
readonly NC_ENDIAN_NATIVE: 0;
|
|
132
|
+
readonly NC_ENDIAN_LITTLE: 1;
|
|
133
|
+
readonly NC_ENDIAN_BIG: 2;
|
|
134
|
+
readonly NC_UNLIMITED: 0;
|
|
135
|
+
readonly NC_GLOBAL: -1;
|
|
136
|
+
readonly NC_MAX_DIMS: 1024;
|
|
137
|
+
readonly NC_MAX_ATTRS: 8192;
|
|
138
|
+
readonly NC_MAX_VARS: 8192;
|
|
139
|
+
readonly NC_MAX_NAME: 256;
|
|
140
|
+
readonly NC_MAX_VAR_DIMS: 1024;
|
|
141
|
+
readonly NC_NOCHECKSUM: 0;
|
|
142
|
+
readonly NC_FLETCHER32: 1;
|
|
143
|
+
readonly NC_NOSHUFFLE: 0;
|
|
144
|
+
readonly NC_SHUFFLE: 1;
|
|
145
|
+
};
|
|
146
|
+
export declare const FILE_MODES: {
|
|
147
|
+
readonly r: {
|
|
148
|
+
readonly create: false;
|
|
149
|
+
readonly flags: 0;
|
|
150
|
+
};
|
|
151
|
+
readonly "r+": {
|
|
152
|
+
readonly create: false;
|
|
153
|
+
readonly flags: 1;
|
|
154
|
+
};
|
|
155
|
+
readonly a: {
|
|
156
|
+
readonly create: false;
|
|
157
|
+
readonly flags: 1;
|
|
158
|
+
};
|
|
159
|
+
readonly w: {
|
|
160
|
+
readonly create: true;
|
|
161
|
+
readonly flags: 0;
|
|
162
|
+
};
|
|
163
|
+
readonly "w-": {
|
|
164
|
+
readonly create: true;
|
|
165
|
+
readonly flags: 4;
|
|
166
|
+
};
|
|
145
167
|
};
|
|
146
168
|
export declare const DATA_TYPE_MAP: {
|
|
147
169
|
[key: string]: number;
|
|
@@ -152,7 +174,4 @@ export declare const CONSTANT_DTYPE_MAP: {
|
|
|
152
174
|
export declare const DATA_TYPE_SIZE: {
|
|
153
175
|
[key: number]: number;
|
|
154
176
|
};
|
|
155
|
-
export declare const TYPE_NAMES: {
|
|
156
|
-
[key: number]: string;
|
|
157
|
-
};
|
|
158
177
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6Kf,CAAC;AAGX,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;CAMb,CAAC;AAGX,eAAO,MAAM,aAAa,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAiClD,CAAC;AAGF,eAAO,MAAM,kBAAkB,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAcvD,CAAC;AAGF,eAAO,MAAM,cAAc,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAcnD,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -161,54 +161,62 @@ export const NC_CONSTANTS = {
|
|
|
161
161
|
NC_NOSHUFFLE: 0,
|
|
162
162
|
NC_SHUFFLE: 1,
|
|
163
163
|
};
|
|
164
|
+
// netcdf4-python modes: whether they create the file, and the nc_open/nc_create flags
|
|
165
|
+
export const FILE_MODES = {
|
|
166
|
+
r: { create: false, flags: NC_CONSTANTS.NC_NOWRITE },
|
|
167
|
+
"r+": { create: false, flags: NC_CONSTANTS.NC_WRITE },
|
|
168
|
+
a: { create: false, flags: NC_CONSTANTS.NC_WRITE },
|
|
169
|
+
w: { create: true, flags: NC_CONSTANTS.NC_CLOBBER },
|
|
170
|
+
"w-": { create: true, flags: NC_CONSTANTS.NC_NOCLOBBER },
|
|
171
|
+
};
|
|
164
172
|
// Data type mapping from string names to NetCDF constants
|
|
165
173
|
export const DATA_TYPE_MAP = {
|
|
166
174
|
// Short names
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
175
|
+
f8: NC_CONSTANTS.NC_DOUBLE,
|
|
176
|
+
f4: NC_CONSTANTS.NC_FLOAT,
|
|
177
|
+
i8: NC_CONSTANTS.NC_INT64,
|
|
178
|
+
i4: NC_CONSTANTS.NC_INT,
|
|
179
|
+
i2: NC_CONSTANTS.NC_SHORT,
|
|
180
|
+
i1: NC_CONSTANTS.NC_BYTE,
|
|
181
|
+
u8: NC_CONSTANTS.NC_UINT64,
|
|
182
|
+
u4: NC_CONSTANTS.NC_UINT,
|
|
183
|
+
u2: NC_CONSTANTS.NC_USHORT,
|
|
184
|
+
u1: NC_CONSTANTS.NC_UBYTE,
|
|
185
|
+
S1: NC_CONSTANTS.NC_CHAR,
|
|
178
186
|
// Long names
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
187
|
+
double: NC_CONSTANTS.NC_DOUBLE,
|
|
188
|
+
float: NC_CONSTANTS.NC_FLOAT,
|
|
189
|
+
int64: NC_CONSTANTS.NC_INT64,
|
|
190
|
+
int: NC_CONSTANTS.NC_INT,
|
|
191
|
+
short: NC_CONSTANTS.NC_SHORT,
|
|
192
|
+
byte: NC_CONSTANTS.NC_BYTE,
|
|
193
|
+
uint64: NC_CONSTANTS.NC_UINT64,
|
|
194
|
+
uint: NC_CONSTANTS.NC_UINT,
|
|
195
|
+
ushort: NC_CONSTANTS.NC_USHORT,
|
|
196
|
+
ubyte: NC_CONSTANTS.NC_UBYTE,
|
|
197
|
+
char: NC_CONSTANTS.NC_CHAR,
|
|
198
|
+
string: NC_CONSTANTS.NC_STRING,
|
|
199
|
+
str: NC_CONSTANTS.NC_STRING,
|
|
192
200
|
// Aliases
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
201
|
+
longlong: NC_CONSTANTS.NC_LONGLONG,
|
|
202
|
+
ulonglong: NC_CONSTANTS.NC_ULONGLONG,
|
|
203
|
+
long: NC_CONSTANTS.NC_INT,
|
|
196
204
|
};
|
|
197
205
|
// Reverse mapping: NetCDF type ID to dtype string
|
|
198
206
|
export const CONSTANT_DTYPE_MAP = {
|
|
199
|
-
0:
|
|
200
|
-
1:
|
|
201
|
-
2:
|
|
202
|
-
3:
|
|
203
|
-
4:
|
|
204
|
-
5:
|
|
205
|
-
6:
|
|
206
|
-
7:
|
|
207
|
-
8:
|
|
208
|
-
9:
|
|
209
|
-
10:
|
|
210
|
-
11:
|
|
211
|
-
12:
|
|
207
|
+
0: "NAT", // NC_NAT
|
|
208
|
+
1: "i1", // NC_BYTE
|
|
209
|
+
2: "S1", // NC_CHAR
|
|
210
|
+
3: "i2", // NC_SHORT
|
|
211
|
+
4: "i4", // NC_INT
|
|
212
|
+
5: "f4", // NC_FLOAT
|
|
213
|
+
6: "f8", // NC_DOUBLE
|
|
214
|
+
7: "u1", // NC_UBYTE
|
|
215
|
+
8: "u2", // NC_USHORT
|
|
216
|
+
9: "u4", // NC_UINT
|
|
217
|
+
10: "i8", // NC_INT64
|
|
218
|
+
11: "u8", // NC_UINT64
|
|
219
|
+
12: "str", // NC_STRING
|
|
212
220
|
};
|
|
213
221
|
// Data type sizes in bytes
|
|
214
222
|
export const DATA_TYPE_SIZE = {
|
|
@@ -226,24 +234,4 @@ export const DATA_TYPE_SIZE = {
|
|
|
226
234
|
11: 8, // NC_UINT64
|
|
227
235
|
12: 0, // NC_STRING (variable length)
|
|
228
236
|
};
|
|
229
|
-
// Human-readable type names
|
|
230
|
-
export const TYPE_NAMES = {
|
|
231
|
-
0: 'NAT',
|
|
232
|
-
1: 'byte',
|
|
233
|
-
2: 'char',
|
|
234
|
-
3: 'short',
|
|
235
|
-
4: 'int',
|
|
236
|
-
5: 'float',
|
|
237
|
-
6: 'double',
|
|
238
|
-
7: 'ubyte',
|
|
239
|
-
8: 'ushort',
|
|
240
|
-
9: 'uint',
|
|
241
|
-
10: 'int64',
|
|
242
|
-
11: 'uint64',
|
|
243
|
-
12: 'string',
|
|
244
|
-
13: 'vlen',
|
|
245
|
-
14: 'opaque',
|
|
246
|
-
15: 'enum',
|
|
247
|
-
16: 'compound',
|
|
248
|
-
};
|
|
249
237
|
//# sourceMappingURL=constants.js.map
|