[GRASS-dev] limits of r.patch

Doug_Newcomb at fws.gov Doug_Newcomb at fws.gov
Fri Jul 13 09:07:28 PDT 2012


Margherita,
        You may be running into the open file limit for linux.  
http://www.cyberciti.biz/faq/linux-increase-the-maximum-number-of-open-files/
, although 1573 files seems a bit low.    I generally batch my r.patch'ing 
in groups of 120 or so with a python script , then go back and r.patch the 
results.  It works well if the file names are related to the file 
locations. 

See ugly python script below where elevation grid data with the 
"temp_"grid tiles were named by the x coordinate were patched together ( 
yes, I know you can do this better now with direct python calls to 
grass:-)):

# grass_tile_merge.py
import os,string,re,glob
grdarr=['D2370','D2371','d2371','d2372','D2372','D2373']

for grdarrlist in grdarr:
        gtarr=['0','1','2','3','4','5','6','7','8','9']
        for gtarrl in gtarr:
                gtarrb=['0','1','2','3','4','5','6','7','8','9']
                for gtarrl2 in gtarrb:
                        gtarrc=['0','1','2','3','4','5','6','7','8','9']
                        for gtarrl3 in gtarrc:
                                grdstr=""
 gtemp="temp_"+grdarrlist+gtarrl+gtarrl2+gtarrl3
                                #print grpitem
 
greplist="/imagery/grass/ncstpftlidar_83/newdem/fcell/"+grdarrlist+gtarrl+gtarrl2+gtarrl3+"*_ras"
                                grdlist=glob.glob(greplist) # creates a 
list of those grid files
                                for t1 in grdlist:
                                        t1base=os.path.basename(t1)
                                        grdstr=grdstr+t1base+","
                                        #grdarr.append(t1base)
                                grdstr=grdstr[:-1]
                                print grdstr
                                regtite="g.region rast=%s"%(grdstr)
                                os.system(regtite)
                                patchgrp="r.patch input=%s 
output=%s"%(grdstr,gtemp)
                                print patchgrp
                                os.system(patchgrp)
#http://grass.fbk.eu/grass64/manuals/html64_user/r.patch.html

Hope this helps.

Doug



Doug Newcomb 
USFWS
Raleigh, NC
919-856-4520 ext. 14 doug_newcomb at fws.gov
---------------------------------------------------------------------------------------------------------
The opinions I express are my own and are not representative of the 
official policy of the U.S.Fish and Wildlife Service or Dept. of the 
Interior.   Life is too short for undocumented, proprietary data formats.



Margherita Di Leo <dileomargherita at gmail.com> 
Sent by: grass-dev-bounces at lists.osgeo.org
07/13/2012 11:27 AM

To
grass-dev at lists.osgeo.org
cc

Subject
[GRASS-dev] limits of r.patch






Hi All,

I probably am requiring too much, but this is just for sharing an 
experience. I've just imported in GRASS 1573 ASTER GDEM tiles, using 
r.external, and everything seemed to be OK. Then I ran:

GRASS 6.4.3svn (ASTER_GDEM):~ > r.patch in=`g.mlist pat=AST* sep=,` 
out=aster_gdem
ERROR 1: TIFFOpen:/forest/ASTER-GDEM/Dem_lzw/ASTGTM_N45E010_dem_lzw.tif: 
Too many open files
WARNING: Unable to open raster map <ASTGTM_N45E011_dem_lzw.tif at PERMANENT>
ERROR: One or more input raster maps not found

I'm on Red Hat Enterprise Linux Server Rel. 6.3, RAM 16 GB.

Cheers,

-- 
Dr. Margherita Di Leo


_______________________________________________
grass-dev mailing list
grass-dev at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20120713/6b676ca7/attachment-0001.html>


More information about the grass-dev mailing list