You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This function should be best friends with read(), so data from numpy arrays could be symmetrically read/written for multidimensional arrays/bands. See #71 and #83 for background to the high-level read() implementation. This function will make use of write_band, which will remain the same.
The proposed prototype for the RasterUpdater class is:
defwrite(self, src, bidx=None, window=None)
where
src: source Numpy array (masked or regular)
A 3D array (nbands, nrow, ncol) with optional list of indexes e.g. bidx=[1, 3] for two bands: the first and third
A 2D array (nrow, ncol) with band index integer e.g. bidx=1 for the first
bidx: band index as list (for 3D) or integer (for 2D). Default of None assumes all indexes of the raster, and a length check is done with the 0th dimension of src
window: same as in write_band
When a mask array is used for src, the band array should be written using the MaskedArray.filled(fill_value=None) function, where fill_value is from nodatavals if not None for the band index, otherwise should this be set from the masked array fill_value. Only in this case, the nodatavals list for the raster could be modified by this function to update it from None to fill_value from the masked array.
Feedback and suggestions are welcome!
The text was updated successfully, but these errors were encountered:
@mwtoews I'd like to point out that we're now releasing the GIL when calling GDALRasterioIO (see https://github.com/mapbox/rasterio/blob/master/rasterio/_io.pyx#L42). If, instead of having write() call write_band() multiple times, we pushed the writes into almost-pure C functions (multi-band versions of the io_*() functions) we could release the GIL once for many reads/writes. Does that make sense to you? Then write_band() could just call write().
Hey, so we're not duplicating effort: I'm making good progress on io_multi_*() functions that read or write multiple bands in a branch I've dedicated to #96. Along the way I'm learning some new stuff about Cython typed memoryviews and the GIL (all good).
This function should be best friends with
read()
, so data from numpy arrays could be symmetrically read/written for multidimensional arrays/bands. See #71 and #83 for background to the high-levelread()
implementation. This function will make use ofwrite_band
, which will remain the same.The proposed prototype for the
RasterUpdater
class is:where
src
: source Numpy array (masked or regular)bidx=[1, 3]
for two bands: the first and thirdbidx=1
for the firstbidx
: band index as list (for 3D) or integer (for 2D). Default ofNone
assumes all indexes of the raster, and a length check is done with the 0th dimension ofsrc
window
: same as inwrite_band
When a mask array is used for
src
, the band array should be written using theMaskedArray.filled(fill_value=None)
function, wherefill_value
is fromnodatavals
if not None for the band index, otherwise should this be set from the masked arrayfill_value
. Only in this case, thenodatavals
list for the raster could be modified by this function to update it fromNone
tofill_value
from the masked array.Feedback and suggestions are welcome!
The text was updated successfully, but these errors were encountered: