Hi, i share an image where the display n.1 shows the non-align between the Arcmap ASCII and the output Grass ASCII which was created by the r.out.arc function.<br><br>I think the problem is in this step... . As you can observe in the display n.2, the output grid of r.mapcalc function is aligned with the Arcmap ASCII, but it loss the g.region properties when it is exported. Finally, i checked the properties of the output grid of r.mapcalc with the g.region -g function and it retained the same extend and resolution of Arcmap ASCII...<br>
<br>Mark, i set the region as you tried...<br><br>Thanks in advance,<br><br><br><div class="gmail_quote">2012/5/9 Markus Metz <span dir="ltr"><<a href="mailto:markus.metz.giswork@googlemail.com" target="_blank">markus.metz.giswork@googlemail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Tue, May 8, 2012 at 9:41 PM, Alejandro Coca Castro <<a href="mailto:acocac@gmail.com">acocac@gmail.com</a>> wrote:<br>
> Hi Mark, i followed your instructions, so i put in command-line<br>
><br>
</div>This<br>
<div class="im">> g.region rast=MASK@default nsres=0:00:07.5 ewres=0:00:07.5<br>
<br>
</div>will adjust, i.e. modify the resolution in order to fit into the<br>
extents. The extents are not modified. In GRASS, the extents have<br>
precedence over resolution, unless you use the -a flag, in which case<br>
the extents are aligned to the desired resolution. Thus use either<br>
<br>
g.region rast=MASK@default nsres=0:00:07.5 ewres=0:00:07.5 -a<br>
<br>
to align the current region to the desired resolution and enforcing<br>
this resolution, or<br>
<br>
g.region rast=MASK@default<br>
<br>
You can check if the current region is all right with g.region -p or<br>
g.region -g, before doing any processing.<br>
<br>
I tried to set the region with the gdalinfo output of the ArcMap<br>
raster fileASC_ARCMAP.asc:<br>
<br>
g.region w=-60.9250001 e=-49.9979167 n=-0.0000001 s=-10.0000001<br>
res=0.00208333333<br>
<br>
Output of g.region -g:<br>
n=-1e-07<br>
s=-10.0000001<br>
w=-60.9250001<br>
e=-49.9979167<br>
nsres=0.00208333333333333<br>
ewres=0.00208333334604385<br>
rows=4800<br>
cols=5245<br>
cells=25176000<br>
<br>
As you can see, the resolution needed to be adjusted, i.e. there are<br>
floating point rounding errors in fileASC_ARCMAP.asc. Using rounded<br>
DD:MM:SS.S format:<br>
<br>
g.region w=60:55:30W e=49:59:52.5W n=0 s=10S res=00:00:07.5<br>
<br>
Output of g.region -g:<br>
n=0<br>
s=-10<br>
w=-60.925<br>
e=-49.9979166666667<br>
nsres=0.00208333333333333<br>
ewres=0.00208333333333333<br>
rows=4800<br>
cols=5245<br>
cells=25176000<br>
<br>
This is probably the desired extents and resolution, the resolution<br>
did not need to be adjusted (0.00208333333333333 = 00:00:07.5) .<br>
<br>
Markus M<br>
<div class="HOEnZb"><div class="h5"><br>
><br>
> Now, I get the same number of columns and rows. However, the cell size isn't<br>
> the same that ArcMAP output file...so i think it can be the reason of<br>
> non-similar extend and origin....<br>
><br>
> Below i show you the output gdalinfo,<br>
><br>
> Driver: AAIGrid/Arc/Info ASCII Grid<br>
> Files: D:\gras_data\temp\test5.asc<br>
><br>
> Size is 5245, 4800<br>
> Coordinate System is `'<br>
> Origin = (-60.924999999999997,-0.001600000000000)<br>
> Pixel Size = (0.002083000000000,-0.002083000000000)<br>
> Corner Coordinates:<br>
> Upper Left ( -60.9250000, -0.0016000)<br>
> Lower Left ( -60.9250000, -10.0000000)<br>
> Upper Right ( -49.9996650, -0.0016000)<br>
> Lower Right ( -49.9996650, -10.0000000)<br>
> Center ( -55.4623325, -5.0008000)<br>
> Band 1 Block=5245x1 Type=Int32, ColorInterp=Undefined<br>
> NoData Value=-9999<br>
><br>
> Do you have others ideas?<br>
> ------<br>
><br>
> Jacquie, thanks for your comments, i hope the next SPs versions fix these<br>
> kind of bugs.<br>
><br>
> regards,<br>
><br>
> 2012/5/8 Alejandro Coca Castro <<a href="mailto:acocac@gmail.com">acocac@gmail.com</a>><br>
>><br>
>> Hi, i tried to convert the following enviroments settings to GRASS<br>
>> g.region and r.mask for the next ARCGIS output (ASCII file):<br>
>><br>
>> fileTIF = r"x:\test\fileTIF.tif"<br>
>> MASK = r"x:\test\mask_file"<br>
>> env.extent = fileTIF<br>
>> env.snapRaster = MASK<br>
>> env.mask = MASK<br>
>> fileGRD = r"x:\test\fileGRD"<br>
>> outCon = Con(fileTIF, fileTIF, "", "VALUE >= 0")<br>
>> outCon.save(fileGRD)<br>
>> fileASC = r"x:\test\fileASC.asc"<br>
>> env.workspace = fileGRD<br>
>> RasterToASCII_conversion(fileGRD,fileASC)<br>
>><br>
>> So, i put on the GRASS command-line:<br>
>><br>
>> r.mask input=mask_file@default<br>
>> g.region rast=fileTIF@default res=0.00208333333 align=MASK@default<br>
>> r.mapcalc fileGRD = if(fileTIF@default < 0 , null(), fileTIF@default)<br>
>> r.out.arc input= fileGRD@default output=x:\test\fileASC_grass.asc<br>
>><br>
>> However, the ArcGIS and GRASS outputs had a different extend and curiously<br>
>> the GRASS output didn't snap their cells with the MASK. Also, when i observe<br>
>> the GRASS output cellsize, it only has the first 6 decimals (f.e.<br>
>> 0.002083)....<br>
>><br>
>> Finally i tried to setup the parameters of g.region with the ArcGIS output<br>
>> but GRASS output definetly didnt have the same properties of ArcGIS output<br>
>> (cellsize, columns and rows, extend)<br>
>><br>
>> If somebody knows how can i fix it, i'll be grateful,<br>
>><br>
>> Thanks in advance,<br>
>><br>
>> Alejandro<br>
><br>
><br>
><br>
><br>
> --<br>
> Alejandro Coca Castro<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><b><i><span style="font-size:9.0pt;font-family:"Arial","sans-serif";color:#404040">Alejandro Coca Castro</span></i></b><b><i><span style="font-size:9.0pt;font-family:"Arial","sans-serif";color:black"></span></i></b><b><i><span style="font-size:9.0pt;font-family:"Arial","sans-serif";color:#00502e"></span></i></b><span style="font-size:9.0pt;font-family:"Arial","sans-serif";color:#404040"></span>
<b><i><span style="font-size:8.0pt;font-family:"Arial","sans-serif";color:black" lang="ES-CO"></span></i></b><i><span style="font-size:9.0pt;font-family:"Arial","sans-serif";color:#404040"></span></i><br>