<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"><head><!--[if gte mso 9]><xml><o:OfficeDocumentSettings><o:AllowPNG/><o:PixelsPerInch>96</o:PixelsPerInch></o:OfficeDocumentSettings></xml><![endif]--></head><body><div class="ydp396bd0f1yahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:16px;">Dear community,</div><div class="ydp396bd0f1yahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:16px;"><br></div><div class="ydp396bd0f1yahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:16px;">I am writing a function in python that takes the results from r.stats, adds headers, and makes some transformations in the value (such as converting areas from m2 to hectares), and then writes that on an output file.</div><div class="ydp396bd0f1yahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:16px;"><br></div><div class="ydp396bd0f1yahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:16px;">The way I am writing the output, however, is completely inneficient. Take a look here:</div><div class="ydp396bd0f1yahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:16px;"><a href="https://gist.github.com/bniebuhr/ecffc6a81313b72a67b6affce6981e09" rel="nofollow" target="_blank" class="enhancr_card_2882057663">script to edit and save statistics from raster maps in GRASS GIS, using r.stats</a></div><div><br></div><div class="link-enhancr-placeholder enhancr_card_2882057663" contenteditable="false"></div><div>For small maps there is not an issue, but for large maps this may be a huge problem. Any hints on how to write files in an efficient way in python?</div><div><br></div><div>Thanks in advance.</div><div>Best regards</div><div>Bernardo Niebuhr<br></div><div><br></div><div class="enhancr-link-previews ymail-preserve-class ymail-preserve-style" style="margin-top:10px"><h3 style="font-size:14px;font-weight:400;color:#454545;font-family:Helvetica Neue, Segoe UI, Helvetica, Arial, sans-serif;text-shadow:1px 1px 0 rgb(255, 255, 255);margin:0;padding:8px 0"><span>Links na mensagem <span class="link-enhancr-preview-count">(1)</span></span></h3><div id="ydpa8a723b1enhancr_card_2882057663" class="ydpa8a723b1yahoo-link-enhancr-card ydpa8a723b1ymail-preserve-class ydpa8a723b1ymail-preserve-style" style="max-width:288px;font-family:Helvetica Neue, Segoe UI, Helvetica, Arial, sans-serif;margin:5px 5px 5px 0;display:inline-block" data-url="https://gist.github.com/bniebuhr/ecffc6a81313b72a67b6affce6981e09" data-type="YENHANCER" data-size="APPEND" contenteditable="false"><a href="https://gist.github.com/bniebuhr/ecffc6a81313b72a67b6affce6981e09" style="text-decoration:none !important;color:#000 !important" class="ydpa8a723b1yahoo-enhancr-cardlink" rel="nofollow" target="_blank"><table class="ydpa8a723b1card ydpa8a723b1yahoo-ignore-table" style="border-width:1px;border-style:solid;border-color:rgb(224, 228, 233);width:288px;background-color:#fff;border-radius:2px" width="288" height="80" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td style="width:80px;background-color:#000;border-radius:2px 0 0 2px;border-right:1px solid rgb(224, 228, 233)" width="80px"><img src="https://s.yimg.com/lo/api/res/1.2/1IMdbYRfJ6B8mKouvqhMOA--~A/Zmk9ZmlsbDt3PTgwO2g9ODA7YXBwaWQ9aWV4dHJhY3Q-/https://avatars2.githubusercontent.com/u/8031905?s=400&v=4.cf.jpg" style="width:80px;vertical-align:middle;border-radius:2px 0 0 2px" data-inlineimagemanipulating="true" class="" width="80" height="80"></td><td style="width:10px" width="10px"></td><td><img class="ydpa8a723b1card-object" src="https://s.yimg.com/nq/storm/assets/enhancrV2/23/logos/github.png" data-inlineimagemanipulating="true" width="24" height="24"><h2 class="ydpa8a723b1card-title" style="font-size:14px;line-height:16px;color:#26282a;font-family:Helvetica Neue, Segoe UI, Helvetica, Arial, sans-serif;text-decoration:none !important;margin:4px 0;word-break:break-word">script to edit and save statistics from...</h2></td></tr></tbody></table></a></div></div></body></html>