0

normally I used the following terminal command to transform my Sentinel 2 Level 1C Data (it is a .jp2 format) to convert it into a .tif with the EPSG:3411 format

gdalwarp -t_srs EPSG:3411 input.jp2 output.tif

Due to the amount on satellite images I want to transform I want to have a python code for it. I read the this article and tried to apply it (did not work successfully). After a long time I found this really small "documention" of how to use gdal.Warp.

Now I have the following code, which does not work:

import gdal

input_file = 'path/test.jp2'
output_file = 'test.tif'

gdal.Warp(output_file, input_file, dstSRS='EPSG:3411')

This is the error I get:

return _gdal.wrapper_GDALWarpDestName(*args)

SystemError: <built-in function wrapper_GDALWarpDestName> returned NULL without setting an error

I would be happy if someone could say what is wrong in my short code. If this is important: I work in the spyder/anaconda3 enviornment.

Thanks!

Marek
  • 160
  • 1
  • 2
  • 17

1 Answers1

1

Okay, I found my mistake. The problem gets away when the input image and the code are in the same directory. Or you can use the path to your input file, but it must be the path from the root to the image, not from just the directory in which the code runs. (That was kind of a stupid monday mistake! :D )

Marek
  • 160
  • 1
  • 2
  • 17