<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";
color:black;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:12.0pt;
font-family:"Times New Roman","serif";
color:black;}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0in;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";
color:black;}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:Consolas;
color:black;}
span.EmailStyle21
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body bgcolor=white lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Jonas,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I think your formatting of the arguments is not correct. There are lots of ways to do what you need to do. You can just use your commandline options directly in the python gdal.Translate options or you can call gdal_translate directly using the python subprocess.call command. There are plenty of examples if you just search for it. I think you can just do something like this for what you need:<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>from osgeo import gdal<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>ds = gdal.Warp(out_path+’tmp.tif’, [‘I:\\indata\\VPDsc\\VPD_scalar.tif’], options=’-s_srs EPSG:4326 -t_srs EPSG:32628 -overwrite -tr 20 20 -wm 9000 -multi -r near -te 453123 1702425 454123 1703425 -te_srs EPSG:32628’)<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>See the documentation sent earlier. Also, this example might help you:<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>https://gis.stackexchange.com/a/380429/53019<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Regards,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Chris<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'> gdal-dev [mailto:gdal-dev-bounces@lists.osgeo.org] <b>On Behalf Of </b>Jonas Ardö via gdal-dev<br><b>Sent:</b> Wednesday, November 02, 2022 8:30 AM<br><b>To:</b> Even Rouault; gdal-dev@lists.osgeo.org<br><b>Subject:</b> Re: [gdal-dev] Command line /python syntax differences<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal style='margin-bottom:12.0pt'><span style='font-family:"Courier New"'>Thanks Even,<br><br>Still some discrepancy.<br><br><b>Python (don't work but no error and no output ):<br> </b>src_ds = gdal.Open("I:\indata\VPDsc\VPD_scalar.tif")<br> #1 GDALWARP to warp all bands in one go<br> options = gdal.WarpOptions(options=srcSRS="EPSG:4326", dstSRS="EPSG:32628", xRes=20.0, yRes=20.0, resampleAlg="bilinear", format='GTiff', outputBounds=[453123, 1702425, 454123, 1703425])<br> newfile = gdal.Warp(out_path+"tmp.tif", src_ds, options=options)<br><br><b>Command line work ok:</b><br> gdalwarp -s_srs EPSG:4326 -t_srs EPSG:32628 -overwrite -tr 20 20 -wm 9000 -multi -r near -te 453123 1702425 454123 1703425 -te_srs EPSG:32628 /cygdrive/i/indata/VPDsc/VPD_scalar.tif /cygdrive/i/data/SNDHR/VPDsc/VPD_scalar_test.tif </span><o:p></o:p></p><div><p class=MsoNormal><span style='font-family:"Courier New"'>Assuming using -te_srs and -t_srs are redundant?<br>("<strong><span style='font-family:"Courier New"'>outputBoundsSRS</span></strong> – SRS in which output bounds are expressed, in the case they are not expressed in dstSRS")<br></span><br>Regards<br>/Jonas<br>On 02/11/2022 12:03, Even Rouault wrote:<o:p></o:p></p></div><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><p>Jonas,<o:p></o:p></p><p>The doc is at:<o:p></o:p></p><p><a href="https://gdal.org/api/python/osgeo.gdal.html#osgeo.gdal.TranslateOptions">https://gdal.org/api/python/osgeo.gdal.html#osgeo.gdal.TranslateOptions</a><o:p></o:p></p><p>Even<o:p></o:p></p><div><p class=MsoNormal>Le 02/11/2022 à 11:53, Jonas Ardö via gdal-dev a écrit :<o:p></o:p></p></div><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><p class=MsoNormal><span style='font-family:"Courier New"'>Dear gdal-gurus,<br><br>I am new to using gdal via Python.<br><br>As the command line arguments/keywords differ from command prompt mode and Python-mode (for example for example is <b>-r</b> in gdal_translate the same as <b>resampleAlg</b> in gdal.Translate in Python). <br>I find it tricky to find arguments/keywords in Python.<br><br>How can all options/full syntax for gdal-pythons commands be listed as done <a href="https://gis.stackexchange.com/questions/352643/gdal-translate-in-python-where-do-i-find-how-to-convert-the-command-line-argum">here</a> ?<br>Where they also refer to<a href="https://gdal.org/python/"> https://gdal.org/python/</a> which do not exist.<br>Any other (full/completed) online resource for this?<br>Can "pydoc -g osgeo" be used?<br>Are the The gdal-dev Archives searchable?<br><br><br>Regards </span><o:p></o:p></p><pre>/Jonas, Lund University, Sweden<o:p></o:p></pre><p class=MsoNormal><br><br><o:p></o:p></p><pre>_______________________________________________<o:p></o:p></pre><pre>gdal-dev mailing list<o:p></o:p></pre><pre><a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><o:p></o:p></pre><pre><a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><o:p></o:p></pre></blockquote><pre>-- <o:p></o:p></pre><pre><a href="http://www.spatialys.com">http://www.spatialys.com</a><o:p></o:p></pre><pre>My software is free, but my time generally not.<o:p></o:p></pre></blockquote><p class=MsoNormal><br><br><o:p></o:p></p><pre>-- <o:p></o:p></pre><pre>Jonas Ardö<o:p></o:p></pre><pre>Physical Geography and Ecosystem Science<o:p></o:p></pre><pre>Lund University<o:p></o:p></pre><pre>Sölvegatan 12 22362 Lund Sweden<o:p></o:p></pre><pre>+46462224031<o:p></o:p></pre></div></body></html>