[GRASS-dev] Re: [GRASS-user] problems using r.proj with large data set

William Kyngesburye woklist at kyngchaos.com
Thu Feb 8 10:11:18 EST 2007


On Feb 8, 2007, at 5:12 AM, Glynn Clements wrote:

>> The docs should probably also be updated with info relevant to
>> r.proj.seg, instead of being a straight copy of the r.proj  
>> description.
>
> The only thing that differs between the two is the memory= option. I'm
> not sure what needs to be said about that option beyond what's already
> in its description string.
>
maybe mention it in the description?  Other than the memory option  
and name

>> In location saproj, mapset srtm.  Projecting data from location world
>> (LL proj), mapset sa, map sa (7.5GB):
>>
>>> r.proj.seg loc=world map=sa in=sa out=srtm
>>
>> Input Projection Parameters: blah blah
>> Output Projection Parameters: blah blah
>> Input: blah blah
>> Output: blah blah
>>
>> ERROR: can't make mapset element .tmp/Sumomo.local
>>         (/Volumes/Guu/gis/grassdb/world/srtm/.tmp)
>>
>> [it doesn't get to the "Allocating memory and reading input map..."
>> message]
>>
>> ... how the heck is it getting world/srtm as the current mapset (for
>> creating temp files in)!?  It should be saproj/srtm.  Somehow the
>> location is getting mixed up.
>
> Aha.
>
> r.proj.seg (and r.proj) both work by switching environments between
> the input and output locations. It appears to be creating the
> temporary file while the input location is active, when it should be
> using the output location (you may not have write permission for the
> input location).
>
That's the odd part - it's really a combination of the input  
*location* and the output (current) *mapset* name.

> Thanks for discovering this; I'll apply the following as soon as I've
> tested it:
>
> --- raster/r.proj.seg/readcell.c	19 Dec 2006 13:24:54 -0000	1.3
> +++ raster/r.proj.seg/readcell.c	8 Feb 2007 10:59:22 -0000
> @@ -51,7 +51,10 @@
>
>  	if (nblocks < nx * ny)
>  	{
> +		/* Temporary file must be created in output location */
> +		G__switch_env();
>  		filename = G_tempfile();
> +		G__switch_env();
>  		c->fd = open(filename, O_RDWR|O_CREAT|O_EXCL, 0600);
>  		if (c->fd < 0)
>  			G_fatal_error("Unable to open temporary file");
>

I didn't see the switch_env in main just before readcell is called  
(and might not have realized what it meant had seen it).

I'll give this a try, it'll help project the second have of this  
project today if it works.  Since you didn't get any response before,  
I'll try some timing tests to compare r.proj and r.proj.seg, and  
compare the data generated, some time in the next week or so.

-----
William Kyngesburye <kyngchaos at kyngchaos.com>
http://www.kyngchaos.com/

[Trillian]  What are you supposed to do WITH a maniacally depressed  
robot?

[Marvin]  You think you have problems?  What are you supposed to do  
if you ARE a maniacally depressed robot?  No, don't try and answer,  
I'm 50,000 times more intelligent than you and even I don't know the  
answer...

- HitchHiker's Guide to the Galaxy





More information about the grass-dev mailing list