Opened 9 years ago
Closed 5 years ago
#6040 closed enhancement (wontfix)
Support 3D array calculations in gdal_calc.py
Reported by: | Mike Taves | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | closed_because_of_github_migration |
Component: | default | Version: | unspecified |
Severity: | normal | Keywords: | |
Cc: |
Description
This request is to allow processing on 3D arrays, where the dimension are (nband, nrow, ncol). Numpy operations on 3D arrays can yield either another 3D array with variable numbers of bands (e.g. A*2
or A[::2]
), or a 2D array of a single band (e.g. A.mean(axis=0)
).
For forward compatibility, this should only be initiated with a suggested -3D
flag that is mutually exclusive to --allBands
. For example:
gdal_calc.py -A multiband.tif --outfile=mean.tif -3D --calc="A.mean(axis=0)"
will calculate the mean of all bands to a single-band result. In Python, this is similar to doing:
ds = gdal.Open('multiband.tif') A = ds.ReadAsArray() if A.ndim == 2: A.shape = (1,) + A.shape result = A.mean(axis=0)
Change History (2)
comment:1 by , 9 years ago
Type: | defect → enhancement |
---|
comment:2 by , 5 years ago
Milestone: | → closed_because_of_github_migration |
---|---|
Resolution: | → wontfix |
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
This ticket has been automatically closed because Trac is no longer used for GDAL bug tracking, since the project has migrated to GitHub. If you believe this ticket is still valid, you may file it to https://github.com/OSGeo/gdal/issues if it is not already reported there.