load#
- geowombat.load(image_list, time_names, band_names, chunks=512, nodata=65535, in_range=None, out_range=None, data_slice=None, num_workers=1, src=None, scheduler='ray')[source]#
Loads data into memory using
xarray.open_mfdataset()
andray
. This function does not check data alignments and CRSs. It assumes each image inimage_list
has the same y and x dimensions and that the coordinates align.The
load
function cannot be used ifdataclasses
was pip installed.- Parameters:
image_list (list) – The list of image file paths.
time_names (list) – The list of image
datetime
objects.band_names (list) – The list of bands to open.
chunks (Optional[int]) – The dask chunk size.
nodata (Optional[float | int]) – The ‘no data’ value.
in_range (Optional[tuple]) – The input (min, max) range. If not given, defaults to (0, 10000).
out_range (Optional[tuple]) – The output (min, max) range. If not given, defaults to (0, 1).
data_slice (Optional[tuple]) – The slice object to read, given as (time, bands, rows, columns).
num_workers (Optional[int]) – The number of threads.
scheduler (Optional[str]) – The distributed scheduler. Currently not implemented.
- Returns:
Datetime list, array of (time x bands x rows x columns)
- Return type:
list
,numpy.ndarray
Example
>>> import datetime >>> import geowombat as gw >>> >>> image_names = ['LT05_L1TP_227082_19990311_20161220_01_T1.nc', >>> 'LT05_L1TP_227081_19990311_20161220_01_T1.nc', >>> 'LT05_L1TP_227082_19990327_20161220_01_T1.nc'] >>> >>> image_dates = [datetime.datetime(1999, 3, 11, 0, 0), >>> datetime.datetime(1999, 3, 11, 0, 0), >>> datetime.datetime(1999, 3, 27, 0, 0)] >>> >>> data_slice = (slice(0, None), slice(0, None), slice(0, 64), slice(0, 64)) >>> >>> # Load data into memory >>> dates, y = gw.load(image_names, >>> image_dates, >>> ['red', 'nir'], >>> chunks=512, >>> nodata=65535, >>> data_slice=data_slice, >>> num_workers=4)