Skip to main content
12 events
when toggle format what by license comment
Nov 7, 2021 at 19:05 comment added Manuel Popp The description of np.transpose says "Reverse or permute the axes of an array", so yes, you could probably change the order of bands. However, in the solution I gave there is no need for this function. Unfortunately, I just started learning Python 4 months ago and don't know every detail; I guess you will find better answers to such questions if you start a new question instead of commenting on this answer where few people will read it... I guess the people who know all the answers won't read this conversation
Nov 5, 2021 at 21:15 comment added Steven Does this command: (red, green, blue, alpha) = np.transpose(img, axes = (2,0,1)) affects the order that I get the color bands (channels). Does it reorder the channels?
Nov 1, 2021 at 18:37 comment added Steven The output file is unidentified with opencv, via which I am trying to open them....why? With the QGIS program, I open them without any problem....
Oct 29, 2021 at 11:10 comment added Manuel Popp If I understand correctly, you want to create img_path without using the wd variable? You could just replace wd with the directory path: img_path = os.path.join("/path/to/your/GTiff_file", "INPUT_FILE_NAME.tif") or you could set the variable directly as img_path = "/path/to/your/GTiff_file/INPUT_FILE_NAME.tif"
Oct 29, 2021 at 11:00 comment added Steven You are amazing!!!! The code works! One last question... in case I want to read the full path in the img_path, so the path + tif file, such as: "/path/to/your/GTiff_file/INPUT_FILE_NAME.tif" how I pass it to os.path.join(..). I tried this command: img_path = os.open("/path/to/your/GTiff_file/INPUT_FILE_NAME.tif", os.O_RDONLY) but it does not work.... Any ideas?
Oct 29, 2021 at 8:56 vote accept Steven
Oct 28, 2021 at 19:44 history edited Manuel Popp CC BY-SA 4.0
added 799 characters in body
Oct 28, 2021 at 19:23 comment added Manuel Popp ValueError: axes don't match array means the image currently stored under the variable name f has a number of dimensions that doesn't match what the function expects, given the parameters you set. Maybe you could provide the image somehow or show how you load it and what properties it has?
Oct 28, 2021 at 18:14 comment added Steven Please see my update on the initial post
Oct 28, 2021 at 15:00 history edited Manuel Popp CC BY-SA 4.0
added 160 characters in body
Oct 28, 2021 at 14:55 history edited Manuel Popp CC BY-SA 4.0
added 160 characters in body
Oct 28, 2021 at 11:16 history answered Manuel Popp CC BY-SA 4.0