@loaders.gl/netcdf 4.0.0-alpha.4 → 4.0.0-alpha.5
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/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/iobuffer/iobuffer.d.ts +254 -0
- package/dist/iobuffer/iobuffer.d.ts.map +1 -0
- package/dist/netcdf-loader.d.ts +52 -0
- package/dist/netcdf-loader.d.ts.map +1 -0
- package/dist/netcdf-loader.js +1 -1
- package/dist/netcdfjs/netcdf-reader.d.ts +68 -0
- package/dist/netcdfjs/netcdf-reader.d.ts.map +1 -0
- package/dist/netcdfjs/netcdf-types.d.ts +70 -0
- package/dist/netcdfjs/netcdf-types.d.ts.map +1 -0
- package/dist/netcdfjs/read-data.d.ts +18 -0
- package/dist/netcdfjs/read-data.d.ts.map +1 -0
- package/dist/netcdfjs/read-header.d.ts +16 -0
- package/dist/netcdfjs/read-header.d.ts.map +1 -0
- package/dist/netcdfjs/read-type.d.ts +36 -0
- package/dist/netcdfjs/read-type.d.ts.map +1 -0
- package/package.json +5 -5
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AAEtD,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
declare type InputData = number | ArrayBufferLike | ArrayBufferView | IOBuffer | Buffer;
|
|
3
|
+
interface IOBufferOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Ignore the first n bytes of the ArrayBuffer.
|
|
6
|
+
*/
|
|
7
|
+
offset?: number;
|
|
8
|
+
}
|
|
9
|
+
export declare class IOBuffer {
|
|
10
|
+
/**
|
|
11
|
+
* Reference to the internal ArrayBuffer object.
|
|
12
|
+
*/
|
|
13
|
+
buffer: ArrayBufferLike;
|
|
14
|
+
/**
|
|
15
|
+
* Byte length of the internal ArrayBuffer.
|
|
16
|
+
*/
|
|
17
|
+
byteLength: number;
|
|
18
|
+
/**
|
|
19
|
+
* Byte offset of the internal ArrayBuffer.
|
|
20
|
+
*/
|
|
21
|
+
byteOffset: number;
|
|
22
|
+
/**
|
|
23
|
+
* Byte length of the internal ArrayBuffer.
|
|
24
|
+
*/
|
|
25
|
+
length: number;
|
|
26
|
+
/**
|
|
27
|
+
* The current offset of the buffer's pointer.
|
|
28
|
+
*/
|
|
29
|
+
offset: number;
|
|
30
|
+
private lastWrittenByte;
|
|
31
|
+
private littleEndian;
|
|
32
|
+
private _data;
|
|
33
|
+
private _mark;
|
|
34
|
+
private _marks;
|
|
35
|
+
private textDecoder;
|
|
36
|
+
private textEncoder;
|
|
37
|
+
/**
|
|
38
|
+
* @param data - The data to construct the IOBuffer with.
|
|
39
|
+
* If data is a number, it will be the new buffer's length<br>
|
|
40
|
+
* If data is `undefined`, the buffer will be initialized with a default length of 8Kb<br>
|
|
41
|
+
* If data is an ArrayBuffer, SharedArrayBuffer, an ArrayBufferView (Typed Array), an IOBuffer instance,
|
|
42
|
+
* or a Node.js Buffer, a view will be created over the underlying ArrayBuffer.
|
|
43
|
+
* @param options
|
|
44
|
+
*/
|
|
45
|
+
constructor(data?: InputData, options?: IOBufferOptions);
|
|
46
|
+
/**
|
|
47
|
+
* Checks if the memory allocated to the buffer is sufficient to store more
|
|
48
|
+
* bytes after the offset.
|
|
49
|
+
* @param byteLength - The needed memory in bytes.
|
|
50
|
+
* @returns `true` if there is sufficient space and `false` otherwise.
|
|
51
|
+
*/
|
|
52
|
+
available(byteLength?: number): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Check if little-endian mode is used for reading and writing multi-byte
|
|
55
|
+
* values.
|
|
56
|
+
* @returns `true` if little-endian mode is used, `false` otherwise.
|
|
57
|
+
*/
|
|
58
|
+
isLittleEndian(): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Set little-endian mode for reading and writing multi-byte values.
|
|
61
|
+
*/
|
|
62
|
+
setLittleEndian(): this;
|
|
63
|
+
/**
|
|
64
|
+
* Check if big-endian mode is used for reading and writing multi-byte values.
|
|
65
|
+
* @returns `true` if big-endian mode is used, `false` otherwise.
|
|
66
|
+
*/
|
|
67
|
+
isBigEndian(): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Switches to big-endian mode for reading and writing multi-byte values.
|
|
70
|
+
*/
|
|
71
|
+
setBigEndian(): this;
|
|
72
|
+
/**
|
|
73
|
+
* Move the pointer n bytes forward.
|
|
74
|
+
* @param n - Number of bytes to skip.
|
|
75
|
+
*/
|
|
76
|
+
skip(n?: number): this;
|
|
77
|
+
/**
|
|
78
|
+
* Move the pointer to the given offset.
|
|
79
|
+
* @param offset
|
|
80
|
+
*/
|
|
81
|
+
seek(offset: number): this;
|
|
82
|
+
/**
|
|
83
|
+
* Store the current pointer offset.
|
|
84
|
+
* @see {@link IOBuffer#reset}
|
|
85
|
+
*/
|
|
86
|
+
mark(): this;
|
|
87
|
+
/**
|
|
88
|
+
* Move the pointer back to the last pointer offset set by mark.
|
|
89
|
+
* @see {@link IOBuffer#mark}
|
|
90
|
+
*/
|
|
91
|
+
reset(): this;
|
|
92
|
+
/**
|
|
93
|
+
* Push the current pointer offset to the mark stack.
|
|
94
|
+
* @see {@link IOBuffer#popMark}
|
|
95
|
+
*/
|
|
96
|
+
pushMark(): this;
|
|
97
|
+
/**
|
|
98
|
+
* Pop the last pointer offset from the mark stack, and set the current
|
|
99
|
+
* pointer offset to the popped value.
|
|
100
|
+
* @see {@link IOBuffer#pushMark}
|
|
101
|
+
*/
|
|
102
|
+
popMark(): this;
|
|
103
|
+
/**
|
|
104
|
+
* Move the pointer offset back to 0.
|
|
105
|
+
*/
|
|
106
|
+
rewind(): this;
|
|
107
|
+
/**
|
|
108
|
+
* Make sure the buffer has sufficient memory to write a given byteLength at
|
|
109
|
+
* the current pointer offset.
|
|
110
|
+
* If the buffer's memory is insufficient, this method will create a new
|
|
111
|
+
* buffer (a copy) with a length that is twice (byteLength + current offset).
|
|
112
|
+
* @param byteLength
|
|
113
|
+
*/
|
|
114
|
+
ensureAvailable(byteLength?: number): this;
|
|
115
|
+
/**
|
|
116
|
+
* Read a byte and return false if the byte's value is 0, or true otherwise.
|
|
117
|
+
* Moves pointer forward by one byte.
|
|
118
|
+
*/
|
|
119
|
+
readBoolean(): boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Read a signed 8-bit integer and move pointer forward by 1 byte.
|
|
122
|
+
*/
|
|
123
|
+
readInt8(): number;
|
|
124
|
+
/**
|
|
125
|
+
* Read an unsigned 8-bit integer and move pointer forward by 1 byte.
|
|
126
|
+
*/
|
|
127
|
+
readUint8(): number;
|
|
128
|
+
/**
|
|
129
|
+
* Alias for {@link IOBuffer#readUint8}.
|
|
130
|
+
*/
|
|
131
|
+
readByte(): number;
|
|
132
|
+
/**
|
|
133
|
+
* Read `n` bytes and move pointer forward by `n` bytes.
|
|
134
|
+
*/
|
|
135
|
+
readBytes(n?: number): Uint8Array;
|
|
136
|
+
/**
|
|
137
|
+
* Read a 16-bit signed integer and move pointer forward by 2 bytes.
|
|
138
|
+
*/
|
|
139
|
+
readInt16(): number;
|
|
140
|
+
/**
|
|
141
|
+
* Read a 16-bit unsigned integer and move pointer forward by 2 bytes.
|
|
142
|
+
*/
|
|
143
|
+
readUint16(): number;
|
|
144
|
+
/**
|
|
145
|
+
* Read a 32-bit signed integer and move pointer forward by 4 bytes.
|
|
146
|
+
*/
|
|
147
|
+
readInt32(): number;
|
|
148
|
+
/**
|
|
149
|
+
* Read a 32-bit unsigned integer and move pointer forward by 4 bytes.
|
|
150
|
+
*/
|
|
151
|
+
readUint32(): number;
|
|
152
|
+
/**
|
|
153
|
+
* Read a 32-bit floating number and move pointer forward by 4 bytes.
|
|
154
|
+
*/
|
|
155
|
+
readFloat32(): number;
|
|
156
|
+
/**
|
|
157
|
+
* Read a 64-bit floating number and move pointer forward by 8 bytes.
|
|
158
|
+
*/
|
|
159
|
+
readFloat64(): number;
|
|
160
|
+
/**
|
|
161
|
+
* Read a 1-byte ASCII character and move pointer forward by 1 byte.
|
|
162
|
+
*/
|
|
163
|
+
readChar(): string;
|
|
164
|
+
/**
|
|
165
|
+
* Read `n` 1-byte ASCII characters and move pointer forward by `n` bytes.
|
|
166
|
+
*/
|
|
167
|
+
readChars(n?: number): string;
|
|
168
|
+
/**
|
|
169
|
+
* Read the next `n` bytes, return a UTF-8 decoded string and move pointer
|
|
170
|
+
* forward by `n` bytes.
|
|
171
|
+
*/
|
|
172
|
+
readUtf8(n?: number): string;
|
|
173
|
+
/**
|
|
174
|
+
* Write 0xff if the passed value is truthy, 0x00 otherwise and move pointer
|
|
175
|
+
* forward by 1 byte.
|
|
176
|
+
*/
|
|
177
|
+
writeBoolean(value: unknown): this;
|
|
178
|
+
/**
|
|
179
|
+
* Write `value` as an 8-bit signed integer and move pointer forward by 1 byte.
|
|
180
|
+
*/
|
|
181
|
+
writeInt8(value: number): this;
|
|
182
|
+
/**
|
|
183
|
+
* Write `value` as an 8-bit unsigned integer and move pointer forward by 1
|
|
184
|
+
* byte.
|
|
185
|
+
*/
|
|
186
|
+
writeUint8(value: number): this;
|
|
187
|
+
/**
|
|
188
|
+
* An alias for {@link IOBuffer#writeUint8}.
|
|
189
|
+
*/
|
|
190
|
+
writeByte(value: number): this;
|
|
191
|
+
/**
|
|
192
|
+
* Write all elements of `bytes` as uint8 values and move pointer forward by
|
|
193
|
+
* `bytes.length` bytes.
|
|
194
|
+
*/
|
|
195
|
+
writeBytes(bytes: ArrayLike<number>): this;
|
|
196
|
+
/**
|
|
197
|
+
* Write `value` as a 16-bit signed integer and move pointer forward by 2
|
|
198
|
+
* bytes.
|
|
199
|
+
*/
|
|
200
|
+
writeInt16(value: number): this;
|
|
201
|
+
/**
|
|
202
|
+
* Write `value` as a 16-bit unsigned integer and move pointer forward by 2
|
|
203
|
+
* bytes.
|
|
204
|
+
*/
|
|
205
|
+
writeUint16(value: number): this;
|
|
206
|
+
/**
|
|
207
|
+
* Write `value` as a 32-bit signed integer and move pointer forward by 4
|
|
208
|
+
* bytes.
|
|
209
|
+
*/
|
|
210
|
+
writeInt32(value: number): this;
|
|
211
|
+
/**
|
|
212
|
+
* Write `value` as a 32-bit unsigned integer and move pointer forward by 4
|
|
213
|
+
* bytes.
|
|
214
|
+
*/
|
|
215
|
+
writeUint32(value: number): this;
|
|
216
|
+
/**
|
|
217
|
+
* Write `value` as a 32-bit floating number and move pointer forward by 4
|
|
218
|
+
* bytes.
|
|
219
|
+
*/
|
|
220
|
+
writeFloat32(value: number): this;
|
|
221
|
+
/**
|
|
222
|
+
* Write `value` as a 64-bit floating number and move pointer forward by 8
|
|
223
|
+
* bytes.
|
|
224
|
+
*/
|
|
225
|
+
writeFloat64(value: number): this;
|
|
226
|
+
/**
|
|
227
|
+
* Write the charCode of `str`'s first character as an 8-bit unsigned integer
|
|
228
|
+
* and move pointer forward by 1 byte.
|
|
229
|
+
*/
|
|
230
|
+
writeChar(str: string): this;
|
|
231
|
+
/**
|
|
232
|
+
* Write the charCodes of all `str`'s characters as 8-bit unsigned integers
|
|
233
|
+
* and move pointer forward by `str.length` bytes.
|
|
234
|
+
*/
|
|
235
|
+
writeChars(str: string): this;
|
|
236
|
+
/**
|
|
237
|
+
* UTF-8 encode and write `str` to the current pointer offset and move pointer
|
|
238
|
+
* forward according to the encoded length.
|
|
239
|
+
*/
|
|
240
|
+
writeUtf8(str: string): this;
|
|
241
|
+
/**
|
|
242
|
+
* Export a Uint8Array view of the internal buffer.
|
|
243
|
+
* The view starts at the byte offset and its length
|
|
244
|
+
* is calculated to stop at the last written byte or the original length.
|
|
245
|
+
*/
|
|
246
|
+
toArray(): Uint8Array;
|
|
247
|
+
/**
|
|
248
|
+
* Update the last written byte offset
|
|
249
|
+
* @private
|
|
250
|
+
*/
|
|
251
|
+
private _updateLastWrittenByte;
|
|
252
|
+
}
|
|
253
|
+
export {};
|
|
254
|
+
//# sourceMappingURL=iobuffer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iobuffer.d.ts","sourceRoot":"","sources":["../../src/iobuffer/iobuffer.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Loader, LoaderWithParser, LoaderOptions } from '@loaders.gl/loader-utils';
|
|
2
|
+
import type { NetCDFHeader } from './netcdfjs/netcdf-types';
|
|
3
|
+
export declare type NetCDF = {
|
|
4
|
+
loaderData: NetCDFHeader;
|
|
5
|
+
data: {
|
|
6
|
+
[variableName: string]: any[][];
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export declare type NetCDFLoaderOptions = LoaderOptions & {
|
|
10
|
+
netcdf?: {
|
|
11
|
+
loadData?: boolean;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Worker loader for NETCDF
|
|
16
|
+
*/
|
|
17
|
+
export declare const NetCDFWorkerLoader: {
|
|
18
|
+
name: string;
|
|
19
|
+
id: string;
|
|
20
|
+
module: string;
|
|
21
|
+
version: any;
|
|
22
|
+
extensions: string[];
|
|
23
|
+
mimeTypes: string[];
|
|
24
|
+
category: string;
|
|
25
|
+
options: {
|
|
26
|
+
netcdf: {
|
|
27
|
+
loadVariables: boolean;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Loader for the NetCDF format
|
|
33
|
+
*/
|
|
34
|
+
export declare const NetCDFLoader: {
|
|
35
|
+
parse: (arrayBuffer: any, options: any) => Promise<NetCDF>;
|
|
36
|
+
binary: boolean;
|
|
37
|
+
name: string;
|
|
38
|
+
id: string;
|
|
39
|
+
module: string;
|
|
40
|
+
version: any;
|
|
41
|
+
extensions: string[];
|
|
42
|
+
mimeTypes: string[];
|
|
43
|
+
category: string;
|
|
44
|
+
options: {
|
|
45
|
+
netcdf: {
|
|
46
|
+
loadVariables: boolean;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
export declare const _typecheckNetCDFWorkerLoader: Loader;
|
|
51
|
+
export declare const _typecheckNetCDFLoader: LoaderWithParser;
|
|
52
|
+
//# sourceMappingURL=netcdf-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"netcdf-loader.d.ts","sourceRoot":"","sources":["../src/netcdf-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAE,gBAAgB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AACtF,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,yBAAyB,CAAC;AAO1D,oBAAY,MAAM,GAAG;IACnB,UAAU,EAAE,YAAY,CAAC;IACzB,IAAI,EAAE;QAAC,CAAC,YAAY,EAAE,MAAM,GAAG,GAAG,EAAE,EAAE,CAAA;KAAC,CAAC;CACzC,CAAC;AAEF,oBAAY,mBAAmB,GAAG,aAAa,GAAG;IAChD,MAAM,CAAC,EAAE;QACP,QAAQ,CAAC,EAAE,OAAO,CAAC;KACpB,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;CAiB9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;CAIxB,CAAC;AAiBF,eAAO,MAAM,4BAA4B,EAAE,MAA2B,CAAC;AACvE,eAAO,MAAM,sBAAsB,EAAE,gBAA+B,CAAC"}
|
package/dist/netcdf-loader.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NetCDFReader } from './netcdfjs/netcdf-reader';
|
|
2
|
-
const VERSION = typeof "4.0.0-alpha.
|
|
2
|
+
const VERSION = typeof "4.0.0-alpha.5" !== 'undefined' ? "4.0.0-alpha.5" : 'latest';
|
|
3
3
|
export const NetCDFWorkerLoader = {
|
|
4
4
|
name: 'NetCDF',
|
|
5
5
|
id: 'mvt',
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { IOBuffer } from '../iobuffer/iobuffer';
|
|
2
|
+
import type { NetCDFHeader, NetCDFDimension, NetCDFRecordDimension, NetCDFAttribute, NetCDFVariable } from './netcdf-types';
|
|
3
|
+
/**
|
|
4
|
+
* Reads a NetCDF v3.x file
|
|
5
|
+
* https://www.unidata.ucar.edu/software/netcdf/docs/file_format_specifications.html
|
|
6
|
+
* @param {ArrayBuffer} data - ArrayBuffer or any Typed Array (including Node.js' Buffer from v4) with the data
|
|
7
|
+
* @constructor
|
|
8
|
+
*/
|
|
9
|
+
export declare class NetCDFReader {
|
|
10
|
+
header: NetCDFHeader;
|
|
11
|
+
buffer: IOBuffer;
|
|
12
|
+
constructor(data: any);
|
|
13
|
+
/**
|
|
14
|
+
* @return {string} - Version for the NetCDF format
|
|
15
|
+
*/
|
|
16
|
+
get version(): "classic format" | "64-bit offset format";
|
|
17
|
+
/**
|
|
18
|
+
* Get metadata for the record dimension
|
|
19
|
+
*/
|
|
20
|
+
get recordDimension(): NetCDFRecordDimension;
|
|
21
|
+
/**
|
|
22
|
+
* Get list of dimensions (each with `name` and `size`)
|
|
23
|
+
*/
|
|
24
|
+
get dimensions(): NetCDFDimension[];
|
|
25
|
+
/**
|
|
26
|
+
* Get list of global attributes with:
|
|
27
|
+
* * `name`: String with the name of the attribute
|
|
28
|
+
* * `type`: String with the type of the attribute
|
|
29
|
+
* * `value`: A number or string with the value of the attribute
|
|
30
|
+
*/
|
|
31
|
+
get attributes(): NetCDFAttribute[];
|
|
32
|
+
/**
|
|
33
|
+
* Get list of variables
|
|
34
|
+
*/
|
|
35
|
+
get variables(): NetCDFVariable[];
|
|
36
|
+
/**
|
|
37
|
+
* Check if an attribute exists
|
|
38
|
+
* @param attributeName - Name of the attribute to find
|
|
39
|
+
* @return
|
|
40
|
+
*/
|
|
41
|
+
attributeExists(attributeName: string): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Returns the value of an attribute
|
|
44
|
+
* @param attributeName
|
|
45
|
+
* @return Value of the attributeName or null
|
|
46
|
+
*/
|
|
47
|
+
getAttribute(attributeName: string): string | null;
|
|
48
|
+
/**
|
|
49
|
+
* Check if a dataVariable exists
|
|
50
|
+
* @param variableName - Name of the variable to find
|
|
51
|
+
* @return
|
|
52
|
+
*/
|
|
53
|
+
dataVariableExists(variableName: string): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Returns the value of a variable as a string
|
|
56
|
+
* @param variableName
|
|
57
|
+
* @return Value of the variable as a string or null
|
|
58
|
+
*/
|
|
59
|
+
getDataVariableAsString(variableName: string): string | null;
|
|
60
|
+
/**
|
|
61
|
+
* Retrieves the data for a given variable
|
|
62
|
+
* @param variableName - Name of the variable to search or variable object
|
|
63
|
+
* @return List with the variable values
|
|
64
|
+
*/
|
|
65
|
+
getDataVariable(variableName: string | object): any[];
|
|
66
|
+
toString(): string;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=netcdf-reader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"netcdf-reader.d.ts","sourceRoot":"","sources":["../../src/netcdfjs/netcdf-reader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAC9C,OAAO,KAAK,EACV,YAAY,EACZ,eAAe,EACf,qBAAqB,EACrB,eAAe,EACf,cAAc,EACf,MAAM,gBAAgB,CAAC;AAIxB;;;;;GAKG;AACH,qBAAa,YAAY;IAChB,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,EAAE,QAAQ,CAAC;gBAEZ,IAAI,KAAA;IAqBhB;;OAEG;IACH,IAAI,OAAO,8CAKV;IAED;;OAEG;IACH,IAAI,eAAe,IAAI,qBAAqB,CAE3C;IAED;;OAEG;IACH,IAAI,UAAU,IAAI,eAAe,EAAE,CAElC;IAED;;;;;OAKG;IACH,IAAI,UAAU,IAAI,eAAe,EAAE,CAElC;IAED;;OAEG;IACH,IAAI,SAAS,IAAI,cAAc,EAAE,CAEhC;IAED;;;;OAIG;IACH,eAAe,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO;IAK/C;;;;OAIG;IACH,YAAY,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAMlD;;;;OAIG;IACH,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO;IAOjD;;;;OAIG;IACH,uBAAuB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAM5D;;;;OAIG;IACH,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,EAAE;IA2BrD,QAAQ,IAAI,MAAM;CA4BnB"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Header describing a NetDCF file
|
|
3
|
+
* @param recordDimension: Number with the length of record dimension
|
|
4
|
+
* @param dimensions: List of dimensions
|
|
5
|
+
* @param attributes: List of global attributes
|
|
6
|
+
* @param variables: List of variables
|
|
7
|
+
*/
|
|
8
|
+
export declare type NetCDFHeader = {
|
|
9
|
+
version: number;
|
|
10
|
+
recordDimension: NetCDFRecordDimension;
|
|
11
|
+
dimensions: NetCDFDimension[];
|
|
12
|
+
attributes: NetCDFAttribute[];
|
|
13
|
+
variables: NetCDFVariable[];
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Metadata for the record dimension
|
|
17
|
+
* @param length Number of elements in the record dimension
|
|
18
|
+
* @param id Id in the list of dimensions for the record dimension
|
|
19
|
+
* @param name name of the record dimension
|
|
20
|
+
* @param recordStep the record variables step size
|
|
21
|
+
*/
|
|
22
|
+
export declare type NetCDFRecordDimension = {
|
|
23
|
+
length: number;
|
|
24
|
+
id: number;
|
|
25
|
+
name: string;
|
|
26
|
+
recordStep: number;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* `dimensions` is an array of dimension objects:
|
|
30
|
+
* @param name name of the dimension
|
|
31
|
+
* @param size size of the dimension
|
|
32
|
+
* @param recordId: id of the dimension that has unlimited size or undefined,
|
|
33
|
+
* @param recordName: name of the dimension that has unlimited size
|
|
34
|
+
*/
|
|
35
|
+
export declare type NetCDFDimension = {
|
|
36
|
+
name: string;
|
|
37
|
+
size: number;
|
|
38
|
+
recordId: number;
|
|
39
|
+
recordName: string;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Number of recordStep and list of variables with:
|
|
43
|
+
* @param name String with the name of the variable
|
|
44
|
+
* @param dimensions Array with the dimension IDs of the variable
|
|
45
|
+
* @param attributes Array with the attributes of the variable
|
|
46
|
+
* @param type String with the type of the variable
|
|
47
|
+
* @param size Number with the size of the variable
|
|
48
|
+
* @param offset Number with the offset where of the variable begins
|
|
49
|
+
* @param record True if is a record variable, false otherwise (unlimited size)
|
|
50
|
+
*/
|
|
51
|
+
export declare type NetCDFVariable = {
|
|
52
|
+
name: string;
|
|
53
|
+
dimensions: [];
|
|
54
|
+
attributes: [];
|
|
55
|
+
type: string;
|
|
56
|
+
size: number;
|
|
57
|
+
offset: number;
|
|
58
|
+
record: boolean;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* @param name name of the attribute
|
|
62
|
+
* @param type type of the attribute
|
|
63
|
+
* @param value number or string with the value of the attribute
|
|
64
|
+
*/
|
|
65
|
+
export declare type NetCDFAttribute = {
|
|
66
|
+
name: string;
|
|
67
|
+
type: string;
|
|
68
|
+
value: string;
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=netcdf-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"netcdf-types.d.ts","sourceRoot":"","sources":["../../src/netcdfjs/netcdf-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,oBAAY,YAAY,GAAG;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,qBAAqB,CAAC;IACvC,UAAU,EAAE,eAAe,EAAE,CAAC;IAC9B,UAAU,EAAE,eAAe,EAAE,CAAC;IAC9B,SAAS,EAAE,cAAc,EAAE,CAAC;CAC7B,CAAC;AAEF;;;;;;GAMG;AACH,oBAAY,qBAAqB,GAAG;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;GAMG;AACH,oBAAY,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;;;;GASG;AACH,oBAAY,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,EAAE,CAAC;IACf,UAAU,EAAE,EAAE,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF;;;;GAIG;AACH,oBAAY,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { IOBuffer } from '../iobuffer/iobuffer';
|
|
2
|
+
import type { NetCDFRecordDimension, NetCDFVariable } from './netcdf-types';
|
|
3
|
+
/**
|
|
4
|
+
* Read data for the given non-record variable
|
|
5
|
+
* @param buffer - Buffer for the file data
|
|
6
|
+
* @param variable - Variable metadata
|
|
7
|
+
* @return Data of the element
|
|
8
|
+
*/
|
|
9
|
+
export declare function readNonRecord(buffer: IOBuffer, variable: NetCDFVariable): (string | number | number[] | Uint8Array)[];
|
|
10
|
+
/**
|
|
11
|
+
* Read data for the given record variable
|
|
12
|
+
* @param buffer - Buffer for the file data
|
|
13
|
+
* @param variable - Variable metadata
|
|
14
|
+
* @param recordDimension - Record dimension metadata
|
|
15
|
+
* @return - Data of the element
|
|
16
|
+
*/
|
|
17
|
+
export declare function readRecord(buffer: IOBuffer, variable: NetCDFVariable, recordDimension: NetCDFRecordDimension): (string | number | number[] | Uint8Array)[];
|
|
18
|
+
//# sourceMappingURL=read-data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-data.d.ts","sourceRoot":"","sources":["../../src/netcdfjs/read-data.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAC,qBAAqB,EAAE,cAAc,EAAC,MAAM,gBAAgB,CAAC;AAK1E;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,QAAQ,EAChB,QAAQ,EAAE,cAAc,GACvB,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,UAAU,CAAC,EAAE,CAc7C;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,QAAQ,EAChB,QAAQ,EAAE,cAAc,EACxB,eAAe,EAAE,qBAAqB,GACrC,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,UAAU,CAAC,EAAE,CAoB7C"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { IOBuffer } from '../iobuffer/iobuffer';
|
|
2
|
+
import type { NetCDFHeader } from './netcdf-types';
|
|
3
|
+
/**
|
|
4
|
+
* Read the header of the file
|
|
5
|
+
* @param buffer - Buffer for the file data
|
|
6
|
+
* @param version - Version of the file
|
|
7
|
+
* @return - Header
|
|
8
|
+
*/
|
|
9
|
+
export declare function readNetCDFHeader(buffer: IOBuffer, version: number): NetCDFHeader;
|
|
10
|
+
/**
|
|
11
|
+
* Reads the name
|
|
12
|
+
* @param buffer - Buffer for the file data
|
|
13
|
+
* @return Name
|
|
14
|
+
*/
|
|
15
|
+
export declare function readName(buffer: IOBuffer): string;
|
|
16
|
+
//# sourceMappingURL=read-header.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-header.d.ts","sourceRoot":"","sources":["../../src/netcdfjs/read-header.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAC,YAAY,EAAmD,MAAM,gBAAgB,CAAC;AAWnG;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,GAAG,YAAY,CA4BhF;AA2MD;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,QAAQ,GAAG,MAAM,CAWjD"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { IOBuffer } from '../iobuffer/iobuffer';
|
|
2
|
+
export declare const TYPES: {
|
|
3
|
+
BYTE: number;
|
|
4
|
+
CHAR: number;
|
|
5
|
+
SHORT: number;
|
|
6
|
+
INT: number;
|
|
7
|
+
FLOAT: number;
|
|
8
|
+
DOUBLE: number;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Given a type and a size reads the next element
|
|
12
|
+
* @param buffer - Buffer for the file data
|
|
13
|
+
* @param type - Type of the data to read
|
|
14
|
+
* @param size - Size of the element to read
|
|
15
|
+
* @return
|
|
16
|
+
*/
|
|
17
|
+
export declare function readType(buffer: IOBuffer, type: number, size: number): string | number | number[] | Uint8Array;
|
|
18
|
+
/**
|
|
19
|
+
* Parse a number into their respective type
|
|
20
|
+
* @param type - integer that represents the type
|
|
21
|
+
* @return parsed value of the type
|
|
22
|
+
*/
|
|
23
|
+
export declare function num2str(type: number): string;
|
|
24
|
+
/**
|
|
25
|
+
* Parse a number type identifier to his size in bytes
|
|
26
|
+
* @param type - integer that represents the type
|
|
27
|
+
* @return size of the type
|
|
28
|
+
*/
|
|
29
|
+
export declare function num2bytes(type: number): number;
|
|
30
|
+
/**
|
|
31
|
+
* Reverse search of num2str
|
|
32
|
+
* @param type string that represents the type
|
|
33
|
+
* @return parsed value of the type
|
|
34
|
+
*/
|
|
35
|
+
export declare function str2num(type: string): number;
|
|
36
|
+
//# sourceMappingURL=read-type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-type.d.ts","sourceRoot":"","sources":["../../src/netcdfjs/read-type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAE9C,eAAO,MAAM,KAAK;;;;;;;CAOjB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,QAAQ,CACtB,MAAM,EAAE,QAAQ,EAChB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GACX,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,UAAU,CAkBzC;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAkB5C;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAkB9C;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAkB5C"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/netcdf",
|
|
3
3
|
"description": "Loader for NetCDF",
|
|
4
|
-
"version": "4.0.0-alpha.
|
|
4
|
+
"version": "4.0.0-alpha.5",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"parser",
|
|
17
17
|
"NetCDF"
|
|
18
18
|
],
|
|
19
|
-
"types": "
|
|
19
|
+
"types": "dist/index.d.ts",
|
|
20
20
|
"main": "dist/index.js",
|
|
21
21
|
"module": "dist/index.js",
|
|
22
22
|
"sideEffects": false,
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
],
|
|
28
28
|
"scripts": {
|
|
29
29
|
"pre-build-disabled": "npm run build-bundle",
|
|
30
|
-
"build-bundle": "esbuild src/bundle.ts --bundle --outfile=dist/
|
|
30
|
+
"build-bundle": "esbuild src/bundle.ts --bundle --outfile=dist/dist.min.js"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@loaders.gl/loader-utils": "4.0.0-alpha.
|
|
33
|
+
"@loaders.gl/loader-utils": "4.0.0-alpha.5"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "7a71a54bdf1ddf985cc3af3db90b82e7fa97d025"
|
|
36
36
|
}
|