-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
218 lines (201 loc) · 8.02 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
/// <reference types="@stdlib/types"/>
import ndarray from 'ndarray';
import * as stdlib from '@stdlib/types/ndarray';
import * as gdal from 'gdal-async';
declare module 'gdal-async' {
export type ArrayOptions<T extends TypedArray = TypedArray> = {
data?: ndarray.NdArray<T>|stdlib.ndarray;
x?: number;
y?: number;
width?: number;
height?: number;
resampling?: string;
progress_cb?: ProgressCb;
}
export type NDArrayOptions<T extends TypedArray = TypedArray> = {
data?: ndarray.NdArray<T>|stdlib.ndarray;
origin?: number[];
span?: number[];
}
export interface MDArray {
/**
*
* @class MDArray
*
* These functions are an augmentation of the gdal class gdal.RasterBandPixels
*/
/**
* Read the selection region into the given ndarray or a new ndarray.
*
* origin specify the origin of the selection region and width and height specify its size.
* origin defaults to [0, 0, ...], span defaults to the full size of the raster data.
* If an existing array if passed in data, it would be used keeping its current stride.
* If no array is specified, a new array of the full raster size with a default
* positive/positive row-major stride will be allocated.
*
* @method readArray<T extends TypedArray = TypedArray>
* @param {NDArrayOptions<T>} [options]
* @param {ndarray.NdArray<T>} [options.data] Existing ndarray to use
* @param {number[]} [options.origin] [0, ...] if not specified
* @param {number[]} [options.span] Full size if not specified
* @throws {Error}
* @returns {ndarray.NdArray<T>}
*/
readArray<T extends TypedArray = TypedArray>(options?: NDArrayOptions<T>): ndarray.NdArray<T>
/**
* @method readArray
* @param {NDArrayOptions<TypedArray>} [options]
* @param {stdlib.ndarray} [options.data] Existing ndarray to use
* @param {number[]} [options.origin] [0, ...] if not specified
* @param {number[]} [options.span] Full size if not specified
* @throws {Error}
* @returns {stdlib.ndarray}
*/
readArray(options?: NDArrayOptions<TypedArray>): stdlib.ndarray
/**
* Read the selection region into the given ndarray or a new ndarray, async version.
*
* origin specify the origin of the selection region and width and height specify its size.
* origin defaults to [0, 0, ...], span defaults to the full size of the raster data.
* If an existing array if passed in data, it would be used keeping its current stride.
* If no array is specified, a new array of the full raster size with a default
* positive/positive row-major stride will be allocated.
*
* @method readArrayAsync<T extends TypedArray = TypedArray>
* @param {NDArrayOptions<T>} [options]
* @param {ndarray.NdArray<T>} [options.data] Existing ndarray to use
* @param {number[]} [options.origin] [0, ...] if not specified
* @param {number[]} [options.span] Full size if not specified
* @returns {Promise<ndarray.NdArray<T>>}
*/
readArrayAsync<T extends TypedArray = TypedArray>(options?: NDArrayOptions<T>): Promise<ndarray.NdArray<T>>
/**
* @method readArrayAsync
* @param {NDArrayOptions} [options]
* @param {stdlib.ndarray} [options.data] Existing ndarray to use
* @param {number[]} [options.origin] [0, ...] if not specified
* @param {number[]} [options.span] Full size if not specified
* @returns {Promise<stdlib.ndarray>}
*/
readArrayAsync(options?: NDArrayOptions): Promise<stdlib.ndarray>
}
export interface RasterBandPixels {
/**
*
* @class RasterBandPixels
*
* These functions are an augmentation of the gdal class gdal.RasterBandPixels
*/
/**
* Read the selection region into the given ndarray or a new ndarray.
*
* x, y specify the origin of the selection region and width and height specify its size.
* [x, y] default to [0, 0], [width, height] default to the full size of the raster data.
* If an existing array if passed in data, it would be used keeping its current stride.
* If the array has a different size than the selection region, the data will be resampled.
* The resampling algorithm can be specified in resampling, otherwise GDAL's default one will be used.
* If no array is specified, a new scijs/ndarray of [width, height] size with a default
* positive/positive row-major stride will be allocated.
*
* @method readArray<T extends TypedArray = TypedArray>
* @param {ArrayOptions<T>} [options]
* @param {ndarray.NdArray<T>} [options.data]
* @param {number} [options.x]
* @param {number} [options.y]
* @param {number} [options.width]
* @param {number} [options.height]
* @param {string} [options.resampling]
* @param {ProgressCb} [options.progress_cb]
* @throws {Error}
* @returns {ndarray.NdArray<T>}
*/
readArray<T extends TypedArray = TypedArray>(options?: ArrayOptions<T>): ndarray.NdArray<T>
/**
* @method readArray
* @param {ArrayOptions<TypedArray>} [options]
* @param {stdlib.ndarray} [options.data]
* @param {number} [options.x]
* @param {number} [options.y]
* @param {number} [options.width]
* @param {number} [options.height]
* @param {string} [options.resampling]
* @param {ProgressCb} [options.progress_cb]
* @throws {Error}
* @returns {stdlib.ndarray}
*/
readArray(options?: ArrayOptions<TypedArray>): stdlib.ndarray
/**
* Read the selection region into the given ndarray or a new ndarray, async version.
*
* x, y specify the origin of the selection region and width and height specify its size.
* [x, y] default to [0, 0], [width, height] default to the full size of the raster data.
* If an existing array if passed in data, it would be used keeping its current stride.
* If the array has a different size than the selection region, the data will be resampled.
* The resampling algorithm can be specified in resampling, otherwise GDAL's default one will be used.
* If no array is specified, a new scijs/ndarray of [width, height] size with a default
* positive/positive row-major stride will be allocated.
*
* @method readArrayAsync<T extends TypedArray = TypedArray>
* @param {ArrayOptions<T>} [options]
* @param {ndarray.NdArray<T>} [options.data]
* @param {number} [options.x]
* @param {number} [options.y]
* @param {number} [options.width]
* @param {number} [options.height]
* @param {string} [options.resampling]
* @param {ProgressCb} [options.progress_cb]
* @returns {Promise<ndarray.NdArray<T>>}
*/
readArrayAsync<T extends TypedArray = TypedArray>(options?: ArrayOptions<T>): Promise<ndarray.NdArray<T>>
/**
* @method readArrayAsync
* @param {ArrayOptions<TypedArray>} [options]
* @param {stdlib.ndarray} [options.data]
* @param {number} [options.x]
* @param {number} [options.y]
* @param {number} [options.width]
* @param {number} [options.height]
* @param {string} [options.resampling]
* @param {ProgressCb} [options.progress_cb]
* @returns {Promise<stdlib.ndarray>}
*/
readArrayAsync(options?: ArrayOptions<TypedArray>): Promise<stdlib.ndarray>
/**
* Write the selection region from the given ndarray.
*
* x, y specify the origin of the selection region and width and height specify its size.
* [x, y] default to [0, 0], [width, height] default to the size of the array.
* Resampling when writing is not supported by GDAL.
*
* @method writeArray
* @param {ArrayOptions} options
* @param {ndarray.NdArray<TypedArray>|stdlib.ndarray} options.data
* @param {number} [options.x]
* @param {number} [options.y]
* @param {number} [options.width]
* @param {number} [options.height]
* @param {ProgressCb} [options.progress_cb]
* @throws {Error}
* @returns {void}
*/
writeArray(options: ArrayOptions): void
/**
* Write the selection region from the given ndarray, async version.
*
* x, y specify the origin of the selection region and width and height specify its size.
* [x, y] default to [0, 0], [width, height] default to the size of the array.
* Resampling when writing is not supported by GDAL.
*
* @method writeArrayAsync
* @param {ArrayOptions} options
* @param {ndarray.NdArray<TypedArray>|stdlib.ndarray} options.data
* @param {number} [options.x]
* @param {number} [options.y]
* @param {number} [options.width]
* @param {number} [options.height]
* @param {ProgressCb} [options.progress_cb]
* @returns {Promise<void>}
*/
writeArrayAsync(options: ArrayOptions): Promise<void>
}
}