<div dir="auto"><div>Dear Mr. Neteler & Mr. Silver,</div><div dir="auto"><br></div><div dir="auto">    Thank you both for your responses. Yes both of the methods seems to be working. </div><div dir="auto"><br></div><div dir="auto">Also, while going through some other documentation i discovered another metho. We can output the entire data into a text file by including an output argument in the command. (<b style="color:rgb(80,0,80);font-family:sans-serif;font-size:12.8px">g.list type='raster' mapset='.' output='rasterNames.txt' )</b></div><div dir="auto"><br></div><div dir="auto">Problem solved... Thanks</div><div dir="auto"><br></div><div dir="auto">Regards,</div><div dir="auto">Bharath<br><br><div data-smartmail="gmail_signature" dir="auto">Bsr</div><br><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">On Sat, Dec 12, 2020, 5:05 PM Micha Silver <<a href="mailto:tsvibar@gmail.com" rel="noreferrer noreferrer" target="_blank">tsvibar@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">You can use the grass.script module 'read_command' to save the output of <br>
commands. i.e.<br>
<br>
<br>
In [1]: import grass.script as gscript<br>
<br>
In [2]: rast_list = gscript.read_command('g.list', type='rast', <br>
mapset="shkharia").strip().split('\n')<br>
<br>
In [3]: type(rast_list)<br>
Out[4]: list<br>
In [5]: rast_list<br>
Out[6]: ['aspect_4m', 'dtm_08_4m', 'dtm_4m', 'geomorph', 'shade_4m', <br>
'slope_4m']<br>
<br>
Typically the output will be a string (or dict), but calling split('\n') <br>
breaks it into a list.<br>
<br>
<br>
On 12/12/20 1:07 PM, BHARATH RAM wrote:<br>
> Hello,<br>
><br>
>      I have a list of raster files inside a mapset that I need to <br>
> interpolate to a different size. I am aware of the command *g.list <br>
> type='raster' mapset='.'*<br>
> and its equivalent python version. But the command prints the <br>
> filenames out on screen instead of returning it as a list (I am <br>
> talking wrt python API).<br>
><br>
> Am I missing something or is there any workaround for this?<br>
><br>
> Thank you.<br>
><br>
> Regards,<br>
> Bharath.<br>
><br>
> ------------------------------------------------------------------------<br>
> *Disclaimer: *This email and any files transmitted with it are <br>
> confidential and intended solely for the use of the individual or <br>
> entity to whom they are addressed. If you have received this email in <br>
> error please notify the system manager. This message contains <br>
> confidential information and is intended only for the individual <br>
> named. If you are not the named addressee you should not disseminate, <br>
> distribute or copy this e-mail. Please notify the sender immediately <br>
> by e-mail if you have received this e-mail by mistake and delete this <br>
> e-mail from your system. If you are not the intended recipient you are <br>
> notified that disclosing, copying, distributing or taking any action <br>
> in reliance on the contents of this information is strictly prohibited.<br>
><br>
> _______________________________________________<br>
> grass-user mailing list<br>
> <a href="mailto:grass-user@lists.osgeo.org" rel="noreferrer noreferrer noreferrer" target="_blank">grass-user@lists.osgeo.org</a><br>
> <a href="https://lists.osgeo.org/mailman/listinfo/grass-user" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/grass-user</a><br>
<br>
-- <br>
Micha Silver<br>
Ben Gurion Univ.<br>
Sde Boker, Remote Sensing Lab<br>
cell: +972-523-665918<br>
<br>
</blockquote></div></div></div>

<br>
<hr><font face="Verdana" size="1"><b>Disclaimer: </b>This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.</font>