I have a GeoTIFF with daily average discharge data over 10 years (3652 bands per grid cell, each band representing one day). I would like to export this discharge data to a CSV file to work with it in Excel. Normally I would use the 'raster pixels to points' and subsequently save as CSV, but I need the data from every band. How should I go about getting this data into a CSV file?
-
1Best to take the Tour (gis.stackexchange.com/tour) to avoid your post getting closed for including multiple questions. This post has a Python solution for extracting out all of the bands to new raster files. Once you have sorted out the extraction post again for batch conversion of those bands: gis.stackexchange.com/questions/357129/…– GBGCommented May 24 at 15:40
1 Answer
You can create a multiband csv file with a Python utility gdal2xyz https://gdal.org/programs/gdal2xyz.html. Use the -allbands
option https://gdal.org/programs/gdal2xyz.html#cmdoption-gdal2xyz-allbands.
Unfortunately you cannot read that data back with the GDAL XYZ driver https://gdal.org/drivers/raster/xyz.html because it supports only one band. See this (closed) question How to convert multi-band CSV file generated from gdal2xyz to multi-band raster file.