@earthyscience/netcdf4-wasm 0.1.0 → 0.1.2
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/README.md +10 -219
- package/dist/netcdf-getters.d.ts +16 -0
- package/dist/netcdf-getters.d.ts.map +1 -0
- package/dist/netcdf-getters.js +263 -0
- package/dist/netcdf-getters.js.map +1 -0
- package/dist/netcdf-worker.d.ts +2 -0
- package/dist/netcdf-worker.d.ts.map +1 -0
- package/dist/netcdf-worker.js +156 -0
- package/dist/netcdf-worker.js.map +1 -0
- package/dist/netcdf4-wasm.wasm +0 -0
- package/dist/netcdf4.d.ts +21 -14
- package/dist/netcdf4.d.ts.map +1 -1
- package/dist/netcdf4.js +228 -295
- package/dist/netcdf4.js.map +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/wasm-module.d.ts +2 -2
- package/dist/wasm-module.d.ts.map +1 -1
- package/dist/wasm-module.js.map +1 -1
- package/package.json +7 -11
package/README.md
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
# netcdf4-wasm
|
|
2
2
|
|
|
3
|
-
NetCDF4 library
|
|
3
|
+
Partial compilation of NetCDF4 library to WebAssembly with TypeScript bindings.
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
|
-
This project provides a
|
|
7
|
+
This project provides a partial WebAssembly port of the NetCDF4 C library, enabling NetCDF file operations in browser and Node.js environments. It includes:
|
|
8
8
|
|
|
9
|
-
-
|
|
9
|
+
- A partial NetCDF4 C library compiled to WASM using Emscripten
|
|
10
10
|
- High-level TypeScript/JavaScript API
|
|
11
11
|
- Support for reading and writing NetCDF4 files
|
|
12
|
-
- Comprehensive test suite
|
|
13
12
|
|
|
14
13
|
## Installation
|
|
15
14
|
|
|
16
15
|
```bash
|
|
17
|
-
npm install netcdf4-wasm
|
|
16
|
+
npm install @earthyscience/netcdf4-wasm
|
|
18
17
|
```
|
|
19
18
|
|
|
20
19
|
## Prerequisites
|
|
@@ -44,222 +43,24 @@ The JavaScript API is modeled closely on the [netcdf4-python](https://unidata.gi
|
|
|
44
43
|
|
|
45
44
|
### Basic Example
|
|
46
45
|
|
|
47
|
-
|
|
48
|
-
import { Dataset } from "netcdf4-wasm";
|
|
49
|
-
// or: import { NetCDF4 } from 'netcdf4-wasm';
|
|
50
|
-
|
|
51
|
-
async function example() {
|
|
52
|
-
// Create a new NetCDF file (similar to Python netCDF4.Dataset)
|
|
53
|
-
const nc = await Dataset("example.nc", "w", { format: "NETCDF4" });
|
|
54
|
-
// or: const nc = await NetCDF4.Dataset('example.nc', 'w', { format: 'NETCDF4' });
|
|
55
|
-
|
|
56
|
-
// Create dimensions
|
|
57
|
-
const lat = await nc.createDimension("lat", 73);
|
|
58
|
-
const lon = await nc.createDimension("lon", 144);
|
|
59
|
-
const time = await nc.createDimension("time", null); // unlimited dimension
|
|
60
|
-
|
|
61
|
-
// Create variables
|
|
62
|
-
const temp = await nc.createVariable("temperature", "f4", [
|
|
63
|
-
"time",
|
|
64
|
-
"lat",
|
|
65
|
-
"lon",
|
|
66
|
-
]);
|
|
67
|
-
const times = await nc.createVariable("time", "f8", ["time"]);
|
|
68
|
-
|
|
69
|
-
// Set variable attributes
|
|
70
|
-
temp.units = "Kelvin";
|
|
71
|
-
temp.long_name = "surface temperature";
|
|
72
|
-
times.units = "hours since 0001-01-01 00:00:00.0";
|
|
73
|
-
times.calendar = "gregorian";
|
|
74
|
-
|
|
75
|
-
// Set global attributes
|
|
76
|
-
nc.setncattr("description", "bogus example script");
|
|
77
|
-
nc.setncattr("history", "Created " + new Date().toISOString());
|
|
78
|
-
nc.setncattr("source", "netCDF4-wasm example");
|
|
79
|
-
|
|
80
|
-
// Write data
|
|
81
|
-
const tempData = new Float64Array(73 * 144);
|
|
82
|
-
tempData.fill(288.0); // Fill with 288K
|
|
83
|
-
await temp.setValue(tempData);
|
|
84
|
-
|
|
85
|
-
// Close the file
|
|
86
|
-
await nc.close();
|
|
87
|
-
}
|
|
88
|
-
```
|
|
46
|
+
- WIP
|
|
89
47
|
|
|
90
48
|
### Reading Files
|
|
91
49
|
|
|
92
|
-
|
|
93
|
-
import { Dataset } from "netcdf4-wasm";
|
|
94
|
-
|
|
95
|
-
async function readExample() {
|
|
96
|
-
// Open existing file for reading
|
|
97
|
-
const nc = await Dataset("data.nc", "r");
|
|
98
|
-
|
|
99
|
-
// Access dimensions
|
|
100
|
-
console.log("Dimensions:", Object.keys(nc.dimensions));
|
|
101
|
-
console.log("Time dimension size:", nc.dimensions.time.size);
|
|
102
|
-
|
|
103
|
-
// Access variables
|
|
104
|
-
console.log("Variables:", Object.keys(nc.variables));
|
|
105
|
-
const temp = nc.variables.temperature;
|
|
106
|
-
|
|
107
|
-
// Read variable attributes
|
|
108
|
-
console.log("Temperature units:", temp.units);
|
|
109
|
-
console.log("Temperature long name:", temp.long_name);
|
|
110
|
-
|
|
111
|
-
// Read data
|
|
112
|
-
const data = await temp.getValue();
|
|
113
|
-
console.log("Temperature data shape:", data.length);
|
|
114
|
-
console.log("First few values:", data.slice(0, 5));
|
|
115
|
-
|
|
116
|
-
// Access global attributes
|
|
117
|
-
console.log("Global attributes:", nc.ncattrs());
|
|
118
|
-
console.log("Description:", nc.getncattr("description"));
|
|
119
|
-
|
|
120
|
-
await nc.close();
|
|
121
|
-
}
|
|
122
|
-
```
|
|
50
|
+
- WIP
|
|
123
51
|
|
|
124
52
|
### Alternative Constructor (Direct Instantiation)
|
|
125
53
|
|
|
126
|
-
|
|
127
|
-
import { NetCDF4 } from "netcdf4-wasm";
|
|
128
|
-
|
|
129
|
-
async function directExample() {
|
|
130
|
-
// Direct instantiation (requires manual initialization)
|
|
131
|
-
const nc = new NetCDF4("example.nc", "w", { format: "NETCDF4" });
|
|
132
|
-
await nc.initialize();
|
|
133
|
-
|
|
134
|
-
// Use same API as above...
|
|
135
|
-
const lat = await nc.createDimension("lat", 10);
|
|
136
|
-
const temp = await nc.createVariable("temperature", "f8", ["lat"]);
|
|
137
|
-
|
|
138
|
-
await nc.close();
|
|
139
|
-
}
|
|
140
|
-
```
|
|
54
|
+
- WIP
|
|
141
55
|
|
|
142
56
|
### Working with Groups
|
|
143
57
|
|
|
144
|
-
|
|
145
|
-
async function groupExample() {
|
|
146
|
-
const nc = await Dataset("grouped.nc", "w", { format: "NETCDF4" });
|
|
147
|
-
|
|
148
|
-
// Create a group
|
|
149
|
-
const forecasts = nc.createGroup("forecasts");
|
|
150
|
-
|
|
151
|
-
// Create dimensions and variables in the group
|
|
152
|
-
const time = await forecasts.createDimension("time", 24);
|
|
153
|
-
const temp = await forecasts.createVariable("temperature", "f4", ["time"]);
|
|
154
|
-
|
|
155
|
-
// Set group attributes
|
|
156
|
-
forecasts.setncattr("description", "Forecast data");
|
|
157
|
-
|
|
158
|
-
await nc.close();
|
|
159
|
-
}
|
|
160
|
-
```
|
|
58
|
+
- WIP
|
|
161
59
|
|
|
162
60
|
## API Reference
|
|
163
61
|
|
|
164
62
|
The API closely follows netcdf4-python conventions for ease of use by scientists familiar with Python.
|
|
165
63
|
|
|
166
|
-
### Classes
|
|
167
|
-
|
|
168
|
-
#### `NetCDF4`
|
|
169
|
-
|
|
170
|
-
Main class for NetCDF file operations, similar to `netCDF4.Dataset` in Python.
|
|
171
|
-
|
|
172
|
-
**Constructor**
|
|
173
|
-
|
|
174
|
-
```typescript
|
|
175
|
-
new NetCDF4(filename?: string, mode?: string, options?: NetCDF4WasmOptions)
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
**Static Methods**
|
|
179
|
-
|
|
180
|
-
- `NetCDF4.Dataset(filename: string, mode?: string, options?: object): Promise<NetCDF4>` - Factory method (Python-like)
|
|
181
|
-
|
|
182
|
-
**Module Functions**
|
|
183
|
-
|
|
184
|
-
- `Dataset(filename: string, mode?: string, options?: object): Promise<NetCDF4>` - Convenience function (import directly)
|
|
185
|
-
|
|
186
|
-
**Properties**
|
|
187
|
-
|
|
188
|
-
- `dimensions: {[name: string]: Dimension}` - Dictionary of dimensions
|
|
189
|
-
- `variables: {[name: string]: Variable}` - Dictionary of variables
|
|
190
|
-
- `groups: {[name: string]: Group}` - Dictionary of groups
|
|
191
|
-
- `file_format: string` - File format (e.g., 'NETCDF4')
|
|
192
|
-
- `filepath: string` - Path to the file
|
|
193
|
-
- `isopen: boolean` - Whether file is currently open
|
|
194
|
-
|
|
195
|
-
**Methods**
|
|
196
|
-
|
|
197
|
-
_File Operations_
|
|
198
|
-
|
|
199
|
-
- `initialize(): Promise<void>` - Initialize the WASM module
|
|
200
|
-
- `close(): Promise<void>` - Close the file
|
|
201
|
-
- `sync(): Promise<void>` - Flush data to disk
|
|
202
|
-
|
|
203
|
-
_Structure Definition_
|
|
204
|
-
|
|
205
|
-
- `createDimension(name: string, size: number): Promise<Dimension>` - Create dimension
|
|
206
|
-
- `createVariable(name: string, datatype: string, dimensions: string[], options?: object): Promise<Variable>` - Create variable
|
|
207
|
-
- `createGroup(name: string): Group` - Create hierarchical group
|
|
208
|
-
|
|
209
|
-
_Attribute Access_
|
|
210
|
-
|
|
211
|
-
- `setncattr(name: string, value: any): void` - Set global attribute
|
|
212
|
-
- `getncattr(name: string): any` - Get global attribute
|
|
213
|
-
- `ncattrs(): string[]` - List all global attributes
|
|
214
|
-
|
|
215
|
-
#### `Variable`
|
|
216
|
-
|
|
217
|
-
Represents a NetCDF variable, similar to Python's Variable class.
|
|
218
|
-
|
|
219
|
-
**Properties**
|
|
220
|
-
|
|
221
|
-
- `name: string` - Variable name
|
|
222
|
-
- `datatype: string` - Data type ('f4', 'f8', 'i4', etc.)
|
|
223
|
-
- `dimensions: string[]` - Dimension names
|
|
224
|
-
- `units: string` - Units attribute (convenience property)
|
|
225
|
-
- `long_name: string` - Long name attribute (convenience property)
|
|
226
|
-
- `standard_name: string` - Standard name attribute (convenience property)
|
|
227
|
-
|
|
228
|
-
**Methods**
|
|
229
|
-
|
|
230
|
-
- `getValue(): Promise<Float64Array>` - Read variable data
|
|
231
|
-
- `setValue(data: Float64Array): Promise<void>` - Write variable data
|
|
232
|
-
- `setncattr(name: string, value: any): void` - Set variable attribute
|
|
233
|
-
- `getncattr(name: string): any` - Get variable attribute
|
|
234
|
-
- `ncattrs(): string[]` - List variable attributes
|
|
235
|
-
|
|
236
|
-
#### `Dimension`
|
|
237
|
-
|
|
238
|
-
Represents a NetCDF dimension.
|
|
239
|
-
|
|
240
|
-
**Properties**
|
|
241
|
-
|
|
242
|
-
- `name: string` - Dimension name
|
|
243
|
-
- `size: number` - Dimension size
|
|
244
|
-
- `isUnlimited: boolean` - Whether dimension is unlimited
|
|
245
|
-
|
|
246
|
-
**Methods**
|
|
247
|
-
|
|
248
|
-
- `__len__(): number` - Get dimension size (Python-like)
|
|
249
|
-
|
|
250
|
-
### Constants
|
|
251
|
-
|
|
252
|
-
The `NC_CONSTANTS` object provides NetCDF constants:
|
|
253
|
-
|
|
254
|
-
```typescript
|
|
255
|
-
NC_CONSTANTS.NC_NOERR; // No error
|
|
256
|
-
NC_CONSTANTS.NC_NOWRITE; // Read-only access
|
|
257
|
-
NC_CONSTANTS.NC_WRITE; // Write access
|
|
258
|
-
NC_CONSTANTS.NC_CLOBBER; // Overwrite existing file
|
|
259
|
-
NC_CONSTANTS.NC_NETCDF4; // NetCDF4 format
|
|
260
|
-
NC_CONSTANTS.NC_DOUBLE; // Double data type
|
|
261
|
-
NC_CONSTANTS.NC_UNLIMITED; // Unlimited dimension
|
|
262
|
-
```
|
|
263
64
|
|
|
264
65
|
## Building
|
|
265
66
|
|
|
@@ -324,6 +125,8 @@ netcdf4-wasm/
|
|
|
324
125
|
│ ├── types.ts # Type definitions
|
|
325
126
|
│ ├── constants.ts # NetCDF constants
|
|
326
127
|
│ ├── netcdf4.ts # Main NetCDF4 class
|
|
128
|
+
│ ├── netcdf-workers.ts
|
|
129
|
+
│ ├── netcdf-getters.ts
|
|
327
130
|
│ ├── group.ts # Group class
|
|
328
131
|
│ ├── variable.ts # Variable class
|
|
329
132
|
│ ├── dimension.ts # Dimension class
|
|
@@ -341,18 +144,6 @@ netcdf4-wasm/
|
|
|
341
144
|
└── package.json
|
|
342
145
|
```
|
|
343
146
|
|
|
344
|
-
### Contributing
|
|
345
|
-
|
|
346
|
-
1. Fork the repository
|
|
347
|
-
2. Create a feature branch
|
|
348
|
-
3. Make your changes
|
|
349
|
-
4. Add tests for new functionality
|
|
350
|
-
5. Run the test suite
|
|
351
|
-
6. Submit a pull request
|
|
352
|
-
|
|
353
|
-
## License
|
|
354
|
-
|
|
355
|
-
MIT License - see LICENSE file for details.
|
|
356
147
|
|
|
357
148
|
## NetCDF4 Documentation
|
|
358
149
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { NetCDF4Module } from './types.js';
|
|
2
|
+
export declare function getVariables(module: NetCDF4Module, ncid: number): Record<string, any>;
|
|
3
|
+
export declare function getVarCount(module: NetCDF4Module, ncid: number): number;
|
|
4
|
+
export declare function getDimCount(module: NetCDF4Module, ncid: number): number;
|
|
5
|
+
export declare function getDims(module: NetCDF4Module, ncid: number): Record<string, any>;
|
|
6
|
+
export declare function getDimIDs(module: NetCDF4Module, ncid: number): number[] | Int32Array;
|
|
7
|
+
export declare function getDim(module: NetCDF4Module, ncid: number, dimid: number): Record<string, any>;
|
|
8
|
+
export declare function getAttributeValues(module: NetCDF4Module, ncid: number, varid: number, attname: string): any;
|
|
9
|
+
export declare function getGlobalAttributes(module: NetCDF4Module, ncid: number): Record<string, any>;
|
|
10
|
+
export declare function getAttributeName(module: NetCDF4Module, ncid: number, varid: number, attId: number): string | undefined;
|
|
11
|
+
export declare function getFullMetadata(module: NetCDF4Module, ncid: number): Record<string, any>[];
|
|
12
|
+
export declare function getVarIDs(module: NetCDF4Module, ncid: number): number[] | Int32Array;
|
|
13
|
+
export declare function getVariableInfo(module: NetCDF4Module, ncid: number, variable: number | string): Record<string, any>;
|
|
14
|
+
export declare function getVariableArray(module: NetCDF4Module, ncid: number, variable: number | string): Float32Array | Float64Array | Int16Array | Int32Array | BigInt64Array | BigInt[] | string[];
|
|
15
|
+
export declare function getSlicedVariableArray(module: NetCDF4Module, ncid: number, variable: number | string, start: number[], count: number[]): Float32Array | Float64Array | Int16Array | Int32Array | BigInt64Array | BigInt[] | string[];
|
|
16
|
+
//# sourceMappingURL=netcdf-getters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"netcdf-getters.d.ts","sourceRoot":"","sources":["../src/netcdf-getters.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,wBAAgB,YAAY,CACxB,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,MAAM,GACb,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAiBrB;AAED,wBAAgB,WAAW,CACvB,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,MAAM,GACb,MAAM,CAMR;AAED,wBAAgB,WAAW,CACvB,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,MAAM,GACb,MAAM,CAMR;AAED,wBAAgB,OAAO,CACnB,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,MAAM,GACb,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAYrB;AAED,wBAAgB,SAAS,CACrB,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,MAAM,GACb,MAAM,EAAE,GAAG,UAAU,CAMvB;AAED,wBAAgB,MAAM,CAClB,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,GACd,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAUrB;AAED,wBAAgB,kBAAkB,CAC9B,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,GAChB,GAAG,CAkBL;AAED,wBAAgB,mBAAmB,CAC/B,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,M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+
const varCount = getVarCount(module, ncid);
|
|
5
|
+
const dimIds = getDimIDs(module, ncid);
|
|
6
|
+
for (let varid = 0; varid < varCount; varid++) {
|
|
7
|
+
if (dimIds.includes(varid))
|
|
8
|
+
continue; //Don't include spatial Vars
|
|
9
|
+
const result = module.nc_inq_varname(ncid, varid);
|
|
10
|
+
if (result.result !== NC_CONSTANTS.NC_NOERR || !result.name) {
|
|
11
|
+
console.warn(`Failed to get variable name for varid ${varid} (error: ${result.result})`);
|
|
12
|
+
continue;
|
|
13
|
+
}
|
|
14
|
+
variables[result.name] = {
|
|
15
|
+
id: varid
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
return variables;
|
|
19
|
+
}
|
|
20
|
+
export function getVarCount(module, ncid) {
|
|
21
|
+
const result = module.nc_inq_nvars(ncid);
|
|
22
|
+
if (result.result !== NC_CONSTANTS.NC_NOERR) {
|
|
23
|
+
throw new Error(`Failed to get number of variables (error: ${result.result})`);
|
|
24
|
+
}
|
|
25
|
+
return result.nvars || 0;
|
|
26
|
+
}
|
|
27
|
+
export function getDimCount(module, ncid) {
|
|
28
|
+
const result = module.nc_inq_ndims(ncid);
|
|
29
|
+
if (result.result !== NC_CONSTANTS.NC_NOERR) {
|
|
30
|
+
throw new Error(`Failed to get number of dimensions (error: ${result.result})`);
|
|
31
|
+
}
|
|
32
|
+
return result.ndims || 0;
|
|
33
|
+
}
|
|
34
|
+
export function getDims(module, ncid) {
|
|
35
|
+
const dimIDs = getDimIDs(module, ncid);
|
|
36
|
+
const dims = {};
|
|
37
|
+
for (const dimid of dimIDs) {
|
|
38
|
+
const dim = getDim(module, ncid, dimid);
|
|
39
|
+
dims[dim.name] = {
|
|
40
|
+
size: dim.len,
|
|
41
|
+
units: dim.units,
|
|
42
|
+
id: dim.id
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
return dims;
|
|
46
|
+
}
|
|
47
|
+
export function getDimIDs(module, ncid) {
|
|
48
|
+
const result = module.nc_inq_dimids(ncid, 0);
|
|
49
|
+
if (result.result !== NC_CONSTANTS.NC_NOERR) {
|
|
50
|
+
throw new Error(`Failed to get dimension IDs (error: ${result.result})`);
|
|
51
|
+
}
|
|
52
|
+
return result.dimids || [0];
|
|
53
|
+
}
|
|
54
|
+
export function getDim(module, ncid, dimid) {
|
|
55
|
+
const result = module.nc_inq_dim(ncid, dimid);
|
|
56
|
+
if (result.result !== NC_CONSTANTS.NC_NOERR) {
|
|
57
|
+
throw new Error(`Failed to get dim (error: ${result.result})`);
|
|
58
|
+
}
|
|
59
|
+
const varResult = module.nc_inq_varid(ncid, result.name);
|
|
60
|
+
const varID = varResult.varid;
|
|
61
|
+
const { result: output, ...dim } = result;
|
|
62
|
+
const unitResult = getAttributeValues(module, ncid, varID, "units");
|
|
63
|
+
return { ...dim, units: unitResult, id: varID };
|
|
64
|
+
}
|
|
65
|
+
export function getAttributeValues(module, ncid, varid, attname) {
|
|
66
|
+
const attInfo = module.nc_inq_att(ncid, varid, attname);
|
|
67
|
+
if (attInfo.result !== NC_CONSTANTS.NC_NOERR) {
|
|
68
|
+
console.warn(`Failed to get attribute info for ${attname} (error: ${attInfo.result})`);
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const attType = attInfo.type;
|
|
72
|
+
if (!attType)
|
|
73
|
+
throw new Error("Failed to allocate memory for attribute type.");
|
|
74
|
+
let attValue;
|
|
75
|
+
if (attType === 2)
|
|
76
|
+
attValue = module.nc_get_att_text(ncid, varid, attname, attInfo.len);
|
|
77
|
+
else if (attType === 3)
|
|
78
|
+
attValue = module.nc_get_att_short(ncid, varid, attname, attInfo.len);
|
|
79
|
+
else if (attType === 4)
|
|
80
|
+
attValue = module.nc_get_att_int(ncid, varid, attname, attInfo.len);
|
|
81
|
+
else if (attType === 5)
|
|
82
|
+
attValue = module.nc_get_att_float(ncid, varid, attname, attInfo.len);
|
|
83
|
+
else if (attType === 6)
|
|
84
|
+
attValue = module.nc_get_att_double(ncid, varid, attname, attInfo.len);
|
|
85
|
+
else if (attType === 10)
|
|
86
|
+
attValue = module.nc_get_att_longlong(ncid, varid, attname, attInfo.len);
|
|
87
|
+
else
|
|
88
|
+
attValue = module.nc_get_att_double(ncid, varid, attname, attInfo.len);
|
|
89
|
+
return attValue.data;
|
|
90
|
+
}
|
|
91
|
+
export function getGlobalAttributes(module, ncid) {
|
|
92
|
+
const attributes = {};
|
|
93
|
+
const nattsResult = module.nc_inq_natts(ncid);
|
|
94
|
+
if (nattsResult.result !== NC_CONSTANTS.NC_NOERR) {
|
|
95
|
+
throw new Error(`Failed to get number of global attributes (error: ${nattsResult.result})`);
|
|
96
|
+
}
|
|
97
|
+
const nAtts = nattsResult.natts;
|
|
98
|
+
const attNames = [];
|
|
99
|
+
for (let i = 0; i < nAtts; i++) {
|
|
100
|
+
const name = getAttributeName(module, ncid, NC_CONSTANTS.NC_GLOBAL, i);
|
|
101
|
+
attNames.push(name);
|
|
102
|
+
}
|
|
103
|
+
if (attNames.length === 0)
|
|
104
|
+
return attributes;
|
|
105
|
+
for (const attname of attNames) {
|
|
106
|
+
if (!attname)
|
|
107
|
+
continue;
|
|
108
|
+
attributes[attname] = getAttributeValues(module, ncid, NC_CONSTANTS.NC_GLOBAL, attname);
|
|
109
|
+
}
|
|
110
|
+
return attributes;
|
|
111
|
+
}
|
|
112
|
+
export function getAttributeName(module, ncid, varid, attId) {
|
|
113
|
+
const result = module.nc_inq_attname(ncid, varid, attId);
|
|
114
|
+
if (result.result !== NC_CONSTANTS.NC_NOERR) {
|
|
115
|
+
throw new Error(`Failed to get attribute (error: ${result.result})`);
|
|
116
|
+
}
|
|
117
|
+
return result.name;
|
|
118
|
+
}
|
|
119
|
+
export function getFullMetadata(module, ncid) {
|
|
120
|
+
const varIds = getVarIDs(module, ncid);
|
|
121
|
+
const metas = [];
|
|
122
|
+
for (const varid of varIds) {
|
|
123
|
+
const varMeta = getVariableInfo(module, ncid, varid);
|
|
124
|
+
const { attributes, ...varDeets } = varMeta;
|
|
125
|
+
metas.push({ ...varDeets, ...attributes });
|
|
126
|
+
}
|
|
127
|
+
return metas;
|
|
128
|
+
}
|
|
129
|
+
export function getVarIDs(module, ncid) {
|
|
130
|
+
const result = module.nc_inq_varids(ncid);
|
|
131
|
+
if (result.result !== NC_CONSTANTS.NC_NOERR) {
|
|
132
|
+
throw new Error(`Failed to get variable IDs (error: ${result.result})`);
|
|
133
|
+
}
|
|
134
|
+
return result.varids || [0];
|
|
135
|
+
}
|
|
136
|
+
export function getVariableInfo(module, ncid, variable) {
|
|
137
|
+
const info = {};
|
|
138
|
+
const isId = typeof variable === "number";
|
|
139
|
+
let varid = variable;
|
|
140
|
+
if (!isId) {
|
|
141
|
+
const result = module.nc_inq_varid(ncid, variable);
|
|
142
|
+
varid = result.varid;
|
|
143
|
+
}
|
|
144
|
+
const result = module.nc_inq_var(ncid, varid);
|
|
145
|
+
if (result.result !== NC_CONSTANTS.NC_NOERR) {
|
|
146
|
+
throw new Error(`Failed to get variable info (error: ${result.result})`);
|
|
147
|
+
}
|
|
148
|
+
const typeMultiplier = DATA_TYPE_SIZE[result.type];
|
|
149
|
+
//Dim Info
|
|
150
|
+
const dimids = result.dimids;
|
|
151
|
+
const dims = [];
|
|
152
|
+
const shape = [];
|
|
153
|
+
let size = 1;
|
|
154
|
+
if (dimids) {
|
|
155
|
+
for (const dimid of dimids) {
|
|
156
|
+
const dim = getDim(module, ncid, dimid);
|
|
157
|
+
size *= dim.len;
|
|
158
|
+
dims.push(dim);
|
|
159
|
+
shape.push(dim.len);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
//Attribute Info
|
|
163
|
+
const attNames = [];
|
|
164
|
+
if (result.natts) {
|
|
165
|
+
for (let i = 0; i < result.natts; i++) {
|
|
166
|
+
const attname = getAttributeName(module, ncid, varid, i);
|
|
167
|
+
attNames.push(attname);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
const atts = {};
|
|
171
|
+
if (attNames.length > 0) {
|
|
172
|
+
for (const attname of attNames) {
|
|
173
|
+
if (!attname)
|
|
174
|
+
continue;
|
|
175
|
+
atts[attname] = getAttributeValues(module, ncid, varid, attname);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
//Chunking Info
|
|
179
|
+
let chunks;
|
|
180
|
+
const chunkResult = module.nc_inq_var_chunking(ncid, varid);
|
|
181
|
+
const isChunked = chunkResult.chunking === NC_CONSTANTS.NC_CHUNKED;
|
|
182
|
+
if (isChunked) {
|
|
183
|
+
chunks = chunkResult.chunkSizes;
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
chunks = shape;
|
|
187
|
+
}
|
|
188
|
+
const chunkElements = chunks.reduce((a, b) => a * b, 1);
|
|
189
|
+
//Output
|
|
190
|
+
info["name"] = result.name;
|
|
191
|
+
info["dtype"] = CONSTANT_DTYPE_MAP[result.type];
|
|
192
|
+
info['nctype'] = result.type;
|
|
193
|
+
info["shape"] = shape;
|
|
194
|
+
info['dims'] = dims;
|
|
195
|
+
info["size"] = size;
|
|
196
|
+
info["totalSize"] = size * typeMultiplier;
|
|
197
|
+
info["attributes"] = atts;
|
|
198
|
+
info["chunked"] = isChunked;
|
|
199
|
+
info["chunks"] = chunks;
|
|
200
|
+
info["chunkSize"] = chunkElements * typeMultiplier;
|
|
201
|
+
return info;
|
|
202
|
+
}
|
|
203
|
+
export function getVariableArray(module, ncid, variable) {
|
|
204
|
+
const isId = typeof variable === "number";
|
|
205
|
+
let varid = isId ? variable : 0;
|
|
206
|
+
if (!isId) {
|
|
207
|
+
const result = module.nc_inq_varid(ncid, variable);
|
|
208
|
+
varid = result.varid;
|
|
209
|
+
}
|
|
210
|
+
const info = getVariableInfo(module, ncid, varid);
|
|
211
|
+
const arraySize = info.size;
|
|
212
|
+
const arrayType = info.nctype;
|
|
213
|
+
if (!arrayType || !arraySize)
|
|
214
|
+
throw new Error("Failed to allocate memory for array");
|
|
215
|
+
let arrayData;
|
|
216
|
+
if (arrayType === 2)
|
|
217
|
+
arrayData = module.nc_get_var_text(ncid, varid, arraySize);
|
|
218
|
+
else if (arrayType === 3)
|
|
219
|
+
arrayData = module.nc_get_var_short(ncid, varid, arraySize);
|
|
220
|
+
else if (arrayType === 4)
|
|
221
|
+
arrayData = module.nc_get_var_int(ncid, varid, arraySize);
|
|
222
|
+
else if (arrayType === 10)
|
|
223
|
+
arrayData = module.nc_get_var_longlong(ncid, varid, arraySize);
|
|
224
|
+
else if (arrayType === 5)
|
|
225
|
+
arrayData = module.nc_get_var_float(ncid, varid, arraySize);
|
|
226
|
+
else if (arrayType === 6)
|
|
227
|
+
arrayData = module.nc_get_var_double(ncid, varid, arraySize);
|
|
228
|
+
else
|
|
229
|
+
arrayData = module.nc_get_var_double(ncid, varid, arraySize);
|
|
230
|
+
if (!arrayData.data)
|
|
231
|
+
throw new Error("Failed to read array data");
|
|
232
|
+
return arrayData.data;
|
|
233
|
+
}
|
|
234
|
+
export function getSlicedVariableArray(module, ncid, variable, start, count) {
|
|
235
|
+
const isId = typeof variable === "number";
|
|
236
|
+
let varid = isId ? variable : 0;
|
|
237
|
+
if (!isId) {
|
|
238
|
+
const result = module.nc_inq_varid(ncid, variable);
|
|
239
|
+
varid = result.varid;
|
|
240
|
+
}
|
|
241
|
+
const info = getVariableInfo(module, ncid, varid);
|
|
242
|
+
const arrayType = info.nctype;
|
|
243
|
+
if (!arrayType)
|
|
244
|
+
throw new Error("Failed to allocate memory for array");
|
|
245
|
+
let arrayData;
|
|
246
|
+
if (arrayType === 3)
|
|
247
|
+
arrayData = module.nc_get_vara_short(ncid, varid, start, count);
|
|
248
|
+
else if (arrayType === 4)
|
|
249
|
+
arrayData = module.nc_get_vara_int(ncid, varid, start, count);
|
|
250
|
+
else if (arrayType === 5)
|
|
251
|
+
arrayData = module.nc_get_vara_float(ncid, varid, start, count);
|
|
252
|
+
else if (arrayType === 6)
|
|
253
|
+
arrayData = module.nc_get_vara_double(ncid, varid, start, count);
|
|
254
|
+
else
|
|
255
|
+
arrayData = module.nc_get_vara_double(ncid, varid, start, count);
|
|
256
|
+
if (!arrayData.data) {
|
|
257
|
+
console.log(arrayData);
|
|
258
|
+
throw new Error("Failed to read array data");
|
|
259
|
+
}
|
|
260
|
+
return arrayData.data;
|
|
261
|
+
}
|
|
262
|
+
// if (!module) throw new Error("Failed to load module. Ensure module is initialized before calling methods")
|
|
263
|
+
//# sourceMappingURL=netcdf-getters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"netcdf-getters.js","sourceRoot":"","sources":["../src/netcdf-getters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAGlF,MAAM,UAAU,YAAY,CACxB,MAAqB,EACrB,IAAY;IAEZ,MAAM,SAAS,GAAyB,EAAE,CAAC;IAC3C,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC3C,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IACtC,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,QAAQ,EAAE,KAAK,EAAE,EAAE,CAAC;QAC5C,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;YAAE,SAAS,CAAC,4BAA4B;QAElE,MAAM,MAAM,GAAG,MAAM,CAAC,cAAc,CAAC,IAAI,EAAC,KAAK,CAAC,CAAC;QACjD,IAAI,MAAM,CAAC,MAAM,KAAK,YAAY,CAAC,QAAQ,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YAC1D,OAAO,CAAC,IAAI,CAAC,yCAAyC,KAAK,YAAY,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;YACzF,SAAS;QACb,CAAC;QACD,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG;YACrB,EAAE,EAAE,KAAK;SACZ,CAAA;IACL,CAAC;IACD,OAAO,SAAS,CAAC;AACrB,CAAC;A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