Hello,
I’m new to Python and I tried to use this code with 2 Planetscope images (3B_AnalyticMS_SR) but I have difficulties to implement the script.
I changed the full_basename for the 2 images:
full_candidate_basename = ‘20200331_082156_1001_3B_AnalyticMS_SR’
full_reference_basename = ‘20181020_081539_0f3f_3B_AnalyticMS_SR'
I keep the same basename:
candidate_basename = 'candidate'
reference_basename = 'reference'
I changed the coordinates for my AOI in the next lines:
for full_filename, cropped_filename in zip(full_candidate_filenames, candidate_filenames):
subprocess.check_call(['gdal_translate', '-projwin', '278244', '104796', '288288', '110928', full_filename, cropped_filename])
for full_filename, cropped_filename in zip(full_reference_filenames, reference_filenames):
subprocess.check_call(['gdal_translate', '-projwin', '278244', '104796', '288288', '110928', full_filename, cropped_filename])
I also changed the paths to specify the location of the image on disk:
candidate_path =‘D:/Data/20200331_082156_1001_3B_AnalyticMS_SR.tif’
reference_path = ‘D:/Data/20181020_081539_0f3f_3B_AnalyticMS_SR.tif’
result_path = ' D:/Data/normalized.tif'
But when I run the code it seems there is a problem with the command gdal_transalte:
CalledProcessError: Command '['gdal_translate', '-projwin', '278244', '104796', '288288', '110928', '20201015_082258_1040_3B_B2.TIF', 'candidate_blue.TIF']' returned non-zero exit status 1.
I don’t know where I’m wrong.
Would it be possible to give me an example of this code for PlanetScope images?
Thanks for your help.
Best regards,
Kévin
Hello,
I’m new to Python and I tried to use this code with 2 Planetscope images (3B_AnalyticMS_SR) but I have difficulties to implement the script.
I changed the full_basename for the 2 images:
full_candidate_basename = ‘20200331_082156_1001_3B_AnalyticMS_SR’
full_reference_basename = ‘20181020_081539_0f3f_3B_AnalyticMS_SR'
I keep the same basename:
candidate_basename = 'candidate'
reference_basename = 'reference'
I changed the coordinates for my AOI in the next lines:
for full_filename, cropped_filename in zip(full_candidate_filenames, candidate_filenames):
subprocess.check_call(['gdal_translate', '-projwin', '278244', '104796', '288288', '110928', full_filename, cropped_filename])
for full_filename, cropped_filename in zip(full_reference_filenames, reference_filenames):
subprocess.check_call(['gdal_translate', '-projwin', '278244', '104796', '288288', '110928', full_filename, cropped_filename])
I also changed the paths to specify the location of the image on disk:
candidate_path =‘D:/Data/20200331_082156_1001_3B_AnalyticMS_SR.tif’
reference_path = ‘D:/Data/20181020_081539_0f3f_3B_AnalyticMS_SR.tif’
result_path = ' D:/Data/normalized.tif'
But when I run the code it seems there is a problem with the command gdal_transalte:
CalledProcessError: Command '['gdal_translate', '-projwin', '278244', '104796', '288288', '110928', '20201015_082258_1040_3B_B2.TIF', 'candidate_blue.TIF']' returned non-zero exit status 1.
I don’t know where I’m wrong.
Would it be possible to give me an example of this code for PlanetScope images?
Thanks for your help.
Best regards,
Kévin