[GRASS-user] Help - Output difference between ARCGIS enviroment settings and GRASS g.region function

Hi, i tried to convert the following enviroments settings to GRASS g.region and r.mask for the next ARCGIS output (ASCII file):

fileTIF = r"x:\test\fileTIF.tif"
MASK = r"x:\test\mask_file"
env.extent = fileTIF
env.snapRaster = MASK
env.mask = MASK
fileGRD = r"x:\test\fileGRD"
outCon = Con(fileTIF, fileTIF, “”, “VALUE >= 0”)
outCon.save(fileGRD)
fileASC = r"x:\test\fileASC.asc"
env.workspace = fileGRD
RasterToASCII_conversion(fileGRD,fileASC)

So, i put on the GRASS command-line:

r.mask input=mask_file@default
g.region rast=fileTIF@default res=0.00208333333 align=MASK@default
r.mapcalc fileGRD = if(fileTIF@default < 0 , null(), fileTIF@default)
r.out.arc input= fileGRD@default output=x:\test\fileASC_grass.asc

However, the ArcGIS and GRASS outputs had a different extend and curiously the GRASS output didn’t snap their cells with the MASK. Also, when i observe the GRASS output cellsize, it only has the first 6 decimals (f.e. 0.002083)…

Finally i tried to setup the parameters of g.region with the ArcGIS output but GRASS output definetly didnt have the same properties of ArcGIS output (cellsize, columns and rows, extend)

If somebody knows how can i fix it, i’ll be grateful,

Thanks in advance,

Alejandro

Hi, i forgot… below I have included the gdalinfo from both ouputs (ArcMap and GRASS). Any ideas as to what else I should check would be appreciated.

ArcMap output gdalinfo

gdalinfo x:\test\fileASC_ARCMAP.asc
Driver: AAIGrid/Arc/Info ASCII Grid
Files: x:\test\fileASC_ARCMAP.asc
x:\test\fileASC_ARCMAP.asc.aux.xml
Size is 5245, 4800
Coordinate System is `’
Origin = (-60.925000056119998,-0.000000095999999)
Pixel Size = (0.002083333330000,-0.002083333330000)
Metadata:
PyramidResamplingType=NEAREST
Corner Coordinates:
Upper Left ( -60.9250001, -0.0000001)
Lower Left ( -60.9250001, -10.0000001)
Upper Right ( -49.9979167, -0.0000001)
Lower Right ( -49.9979167, -10.0000001)
Center ( -55.4614584, -5.0000001)
Band 1 Block=5245x1 Type=Int32, ColorInterp=Undefined
NoData Value=-9999
(Tue May 08 11:21:09 2012) Command finished (10 sec)
(Tue May 08 11:21:42 2012)

GRASS output gdalinfo

gdalinfo x:\test\fileASC_GRASS.asc
Driver: AAIGrid/Arc/Info ASCII Grid
Files: x:\test\fileASC_GRASS.asc
x:\test\fileASC_GRASS.asc.aux.xml
Size is 5246, 4801
Coordinate System is `’
Origin = (-60.927083000000003,0.000483000000001)
Pixel Size = (0.002083000000000,-0.002083000000000)
Metadata:
PyramidResamplingType=NEAREST
Corner Coordinates:
Upper Left ( -60.9270830, 0.0004830)
Lower Left ( -60.9270830, -10.0000000)
Upper Right ( -49.9996650, 0.0004830)
Lower Right ( -49.9996650, -10.0000000)
Center ( -55.4633740, -4.9997585)
Band 1 Block=5246x1 Type=Int32, ColorInterp=Undefined
NoData Value=-9999

2012/5/8 Alejandro Coca Castro <acocac@gmail.com>

Hi, i tried to convert the following enviroments settings to GRASS g.region and r.mask for the next ARCGIS output (ASCII file):

fileTIF = r"x:\test\fileTIF.tif"
MASK = r"x:\test\mask_file"
env.extent = fileTIF
env.snapRaster = MASK
env.mask = MASK
fileGRD = r"x:\test\fileGRD"
outCon = Con(fileTIF, fileTIF, “”, “VALUE >= 0”)
outCon.save(fileGRD)
fileASC = r"x:\test\fileASC.asc"
env.workspace = fileGRD
RasterToASCII_conversion(fileGRD,fileASC)

So, i put on the GRASS command-line:

r.mask input=mask_file@default
g.region rast=fileTIF@default res=0.00208333333 align=MASK@default
r.mapcalc fileGRD = if(fileTIF@default < 0 , null(), fileTIF@default)
r.out.arc input= fileGRD@default output=x:\test\fileASC_grass.asc

However, the ArcGIS and GRASS outputs had a different extend and curiously the GRASS output didn’t snap their cells with the MASK. Also, when i observe the GRASS output cellsize, it only has the first 6 decimals (f.e. 0.002083)…

Finally i tried to setup the parameters of g.region with the ArcGIS output but GRASS output definetly didnt have the same properties of ArcGIS output (cellsize, columns and rows, extend)

If somebody knows how can i fix it, i’ll be grateful,

Thanks in advance,

Alejandro


Alejandro Coca Castro

On Tue, May 8, 2012 at 6:09 PM, Alejandro Coca Castro <acocac@gmail.com> wrote:

Hi, i tried to convert the following enviroments settings to GRASS g.region
and r.mask for the next ARCGIS output (ASCII file):

fileTIF = r&quot;x:\\test\\fileTIF\.tif&quot;
MASK = r&quot;x:\\test\\mask\_file&quot;
env\.extent = fileTIF
env\.snapRaster = MASK
env\.mask = MASK
fileGRD = r&quot;x:\\test\\fileGRD&quot;
outCon = Con\(fileTIF, fileTIF, &quot;&quot;, &quot;VALUE &gt;= 0&quot;\)
outCon\.save\(fileGRD\)
fileASC = r&quot;x:\\test\\fileASC\.asc&quot;
env\.workspace = fileGRD
RasterToASCII\_conversion\(fileGRD,fileASC\)

So, i put on the GRASS command-line:

I would modify the work flow a bit:

r.mask input=mask_file@default

Set the region before any raster operations, i.e. before r.mask

g.region rast=fileTIF@default res=0.00208333333 align=MASK@default

The options res= and align= may not go well together. Do you want to
have current region aligned to mask_file or do you want a resolution
of res=0.00208333333? BTW, more accurate would be res=00:00:07.5

Thus rather
g.region rast=fileTIF@default align=mask_file@default
r.mask input=mask_file@default

r.mapcalc fileGRD = if(fileTIF@default < 0 , null(), fileTIF@default)
r.out.arc input= fileGRD@default output=x:\test\fileASC_grass.asc

However, the ArcGIS and GRASS outputs had a different extend and curiously
the GRASS output didn't snap their cells with the MASK. Also, when i observe
the GRASS output cellsize, it only has the first 6 decimals (f.e.
0.002083)....

Finally i tried to setup the parameters of g.region with the ArcGIS output
but GRASS output definetly didnt have the same properties of ArcGIS output
(cellsize, columns and rows, extend)

You can set the extents and resolution manually with g.region n= e= s=
w= res= (rows and columns will be determined from that).

Markus M

If somebody knows how can i fix it, i'll be grateful,

Thanks in advance,

Alejandro

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

On Tue, May 8, 2012 at 6:27 PM, Alejandro Coca Castro <acocac@gmail.com> wrote:

Hi, i forgot... below I have included the gdalinfo from both ouputs (ArcMap
and GRASS). Any ideas as to what else I should check would be appreciated.

#### ArcMap output gdalinfo ####

The extents and resolution seem to be written by ArcMap with single
precision. Can you write the raster out again with double precision?
More comments below.

gdalinfo x:\test\fileASC_ARCMAP.asc
Driver: AAIGrid/Arc/Info ASCII Grid
Files: x:\test\fileASC_ARCMAP.asc
x:\test\fileASC_ARCMAP.asc.aux.xml
Size is 5245, 4800
Coordinate System is `'

This

Origin = (-60.925000056119998,-0.000000095999999)
Pixel Size = (0.002083333330000,-0.002083333330000)

could also be in double precision
Origin = (-60.925000000000000,-0.000000000000000)
Pixel Size = (0.002083333333333,-0.002083333333333)

with pixel size equivalent to exactly 00:00:07.5

Metadata:
PyramidResamplingType=NEAREST
Corner Coordinates:

This

Upper Left ( -60.9250001, -0.0000001)
Lower Left ( -60.9250001, -10.0000001)
Upper Right ( -49.9979167, -0.0000001)
Lower Right ( -49.9979167, -10.0000001)
Center ( -55.4614584, -5.0000001)

could also be in double precision

Upper Left ( -60.9250000, -0.0000000)
Lower Left ( -60.9250000, -10.0000000)
Upper Right ( -49.9979167, -0.0000000)
Lower Right ( -49.9979167, -10.0000000)
Center ( -55.4614583, -5.0000000)

The differences may seem small but can make a difference for a 5245x4800 raster.

Markus M

Band 1 Block=5245x1 Type=Int32, ColorInterp=Undefined
NoData Value=-9999
(Tue May 08 11:21:09 2012) Command finished (10
sec)
(Tue May 08 11:21:42 2012)

#### GRASS output gdalinfo ####
gdalinfo x:\test\fileASC_GRASS.asc
Driver: AAIGrid/Arc/Info ASCII Grid
Files: x:\test\fileASC_GRASS.asc
x:\test\fileASC_GRASS.asc.aux.xml
Size is 5246, 4801
Coordinate System is `'
Origin = (-60.927083000000003,0.000483000000001)
Pixel Size = (0.002083000000000,-0.002083000000000)
Metadata:
PyramidResamplingType=NEAREST
Corner Coordinates:
Upper Left ( -60.9270830, 0.0004830)
Lower Left ( -60.9270830, -10.0000000)
Upper Right ( -49.9996650, 0.0004830)
Lower Right ( -49.9996650, -10.0000000)
Center ( -55.4633740, -4.9997585)
Band 1 Block=5246x1 Type=Int32, ColorInterp=Undefined
NoData Value=-9999

2012/5/8 Alejandro Coca Castro <acocac@gmail.com>

Hi, i tried to convert the following enviroments settings to GRASS
g.region and r.mask for the next ARCGIS output (ASCII file):

fileTIF = r&quot;x:\\test\\fileTIF\.tif&quot;
MASK = r&quot;x:\\test\\mask\_file&quot;
env\.extent = fileTIF
env\.snapRaster = MASK
env\.mask = MASK
fileGRD = r&quot;x:\\test\\fileGRD&quot;
outCon = Con\(fileTIF, fileTIF, &quot;&quot;, &quot;VALUE &gt;= 0&quot;\)
outCon\.save\(fileGRD\)
fileASC = r&quot;x:\\test\\fileASC\.asc&quot;
env\.workspace = fileGRD
RasterToASCII\_conversion\(fileGRD,fileASC\)

So, i put on the GRASS command-line:

r.mask input=mask_file@default
g.region rast=fileTIF@default res=0.00208333333 align=MASK@default
r.mapcalc fileGRD = if(fileTIF@default < 0 , null(), fileTIF@default)
r.out.arc input= fileGRD@default output=x:\test\fileASC_grass.asc

However, the ArcGIS and GRASS outputs had a different extend and curiously
the GRASS output didn't snap their cells with the MASK. Also, when i observe
the GRASS output cellsize, it only has the first 6 decimals (f.e.
0.002083)....

Finally i tried to setup the parameters of g.region with the ArcGIS output
but GRASS output definetly didnt have the same properties of ArcGIS output
(cellsize, columns and rows, extend)

If somebody knows how can i fix it, i'll be grateful,

Thanks in advance,

Alejandro

--
Alejandro Coca Castro

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Hi Mark, i followed your instructions, so i put in command-line

g.region rast=MASK@default nsres=0:00:07.5 ewres=0:00:07.5

Now, I get the same number of columns and rows. However, the cell size isn’t the same that ArcMAP output file…so i think it can be the reason of non-similar extend and origin…

Below i show you the output gdalinfo,

Driver: AAIGrid/Arc/Info ASCII Grid
Files: D:\gras_data\temp\test5.asc
Size is 5245, 4800
Coordinate System is `’
Origin = (-60.924999999999997,-0.001600000000000)
Pixel Size = (0.002083000000000,-0.002083000000000)
Corner Coordinates:
Upper Left ( -60.9250000, -0.0016000)
Lower Left ( -60.9250000, -10.0000000)
Upper Right ( -49.9996650, -0.0016000)
Lower Right ( -49.9996650, -10.0000000)
Center ( -55.4623325, -5.0008000)
Band 1 Block=5245x1 Type=Int32, ColorInterp=Undefined
NoData Value=-9999

Do you have others ideas?

Jacquie, thanks for your comments, i hope the next SPs versions fix these kind of bugs.

regards,

2012/5/8 Alejandro Coca Castro <acocac@gmail.com>

Hi, i tried to convert the following enviroments settings to GRASS g.region and r.mask for the next ARCGIS output (ASCII file):

fileTIF = r"x:\test\fileTIF.tif"
MASK = r"x:\test\mask_file"
env.extent = fileTIF
env.snapRaster = MASK
env.mask = MASK
fileGRD = r"x:\test\fileGRD"
outCon = Con(fileTIF, fileTIF, “”, “VALUE >= 0”)
outCon.save(fileGRD)
fileASC = r"x:\test\fileASC.asc"
env.workspace = fileGRD
RasterToASCII_conversion(fileGRD,fileASC)

So, i put on the GRASS command-line:

r.mask input=mask_file@default
g.region rast=fileTIF@default res=0.00208333333 align=MASK@default
r.mapcalc fileGRD = if(fileTIF@default < 0 , null(), fileTIF@default)
r.out.arc input= fileGRD@default output=x:\test\fileASC_grass.asc

However, the ArcGIS and GRASS outputs had a different extend and curiously the GRASS output didn’t snap their cells with the MASK. Also, when i observe the GRASS output cellsize, it only has the first 6 decimals (f.e. 0.002083)…

Finally i tried to setup the parameters of g.region with the ArcGIS output but GRASS output definetly didnt have the same properties of ArcGIS output (cellsize, columns and rows, extend)

If somebody knows how can i fix it, i’ll be grateful,

Thanks in advance,

Alejandro


Alejandro Coca Castro

On Tue, May 8, 2012 at 9:41 PM, Alejandro Coca Castro <acocac@gmail.com> wrote:

Hi Mark, i followed your instructions, so i put in command-line

This

g.region rast=MASK@default nsres=0:00:07.5 ewres=0:00:07.5

will adjust, i.e. modify the resolution in order to fit into the
extents. The extents are not modified. In GRASS, the extents have
precedence over resolution, unless you use the -a flag, in which case
the extents are aligned to the desired resolution. Thus use either

g.region rast=MASK@default nsres=0:00:07.5 ewres=0:00:07.5 -a

to align the current region to the desired resolution and enforcing
this resolution, or

g.region rast=MASK@default

You can check if the current region is all right with g.region -p or
g.region -g, before doing any processing.

I tried to set the region with the gdalinfo output of the ArcMap
raster fileASC_ARCMAP.asc:

g.region w=-60.9250001 e=-49.9979167 n=-0.0000001 s=-10.0000001
res=0.00208333333

Output of g.region -g:
n=-1e-07
s=-10.0000001
w=-60.9250001
e=-49.9979167
nsres=0.00208333333333333
ewres=0.00208333334604385
rows=4800
cols=5245
cells=25176000

As you can see, the resolution needed to be adjusted, i.e. there are
floating point rounding errors in fileASC_ARCMAP.asc. Using rounded
DD:MM:SS.S format:

g.region w=60:55:30W e=49:59:52.5W n=0 s=10S res=00:00:07.5

Output of g.region -g:
n=0
s=-10
w=-60.925
e=-49.9979166666667
nsres=0.00208333333333333
ewres=0.00208333333333333
rows=4800
cols=5245
cells=25176000

This is probably the desired extents and resolution, the resolution
did not need to be adjusted (0.00208333333333333 = 00:00:07.5) .

Markus M

Now, I get the same number of columns and rows. However, the cell size isn't
the same that ArcMAP output file...so i think it can be the reason of
non-similar extend and origin....

Below i show you the output gdalinfo,

Driver: AAIGrid/Arc/Info ASCII Grid
Files: D:\gras_data\temp\test5.asc

Size is 5245, 4800
Coordinate System is `'
Origin = (-60.924999999999997,-0.001600000000000)
Pixel Size = (0.002083000000000,-0.002083000000000)
Corner Coordinates:
Upper Left ( -60.9250000, -0.0016000)
Lower Left ( -60.9250000, -10.0000000)
Upper Right ( -49.9996650, -0.0016000)
Lower Right ( -49.9996650, -10.0000000)
Center ( -55.4623325, -5.0008000)
Band 1 Block=5245x1 Type=Int32, ColorInterp=Undefined
NoData Value=-9999

Do you have others ideas?
------

Jacquie, thanks for your comments, i hope the next SPs versions fix these
kind of bugs.

regards,

2012/5/8 Alejandro Coca Castro <acocac@gmail.com>

Hi, i tried to convert the following enviroments settings to GRASS
g.region and r.mask for the next ARCGIS output (ASCII file):

fileTIF = r&quot;x:\\test\\fileTIF\.tif&quot;
MASK = r&quot;x:\\test\\mask\_file&quot;
env\.extent = fileTIF
env\.snapRaster = MASK
env\.mask = MASK
fileGRD = r&quot;x:\\test\\fileGRD&quot;
outCon = Con\(fileTIF, fileTIF, &quot;&quot;, &quot;VALUE &gt;= 0&quot;\)
outCon\.save\(fileGRD\)
fileASC = r&quot;x:\\test\\fileASC\.asc&quot;
env\.workspace = fileGRD
RasterToASCII\_conversion\(fileGRD,fileASC\)

So, i put on the GRASS command-line:

r.mask input=mask_file@default
g.region rast=fileTIF@default res=0.00208333333 align=MASK@default
r.mapcalc fileGRD = if(fileTIF@default < 0 , null(), fileTIF@default)
r.out.arc input= fileGRD@default output=x:\test\fileASC_grass.asc

However, the ArcGIS and GRASS outputs had a different extend and curiously
the GRASS output didn't snap their cells with the MASK. Also, when i observe
the GRASS output cellsize, it only has the first 6 decimals (f.e.
0.002083)....

Finally i tried to setup the parameters of g.region with the ArcGIS output
but GRASS output definetly didnt have the same properties of ArcGIS output
(cellsize, columns and rows, extend)

If somebody knows how can i fix it, i'll be grateful,

Thanks in advance,

Alejandro

--
Alejandro Coca Castro

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.

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…

Mark, i set the region as you tried…

Thanks in advance,

2012/5/9 Markus Metz <markus.metz.giswork@googlemail.com>

On Tue, May 8, 2012 at 9:41 PM, Alejandro Coca Castro <acocac@gmail.com> wrote:

Hi Mark, i followed your instructions, so i put in command-line

This

g.region rast=MASK@default nsres=0:00:07.5 ewres=0:00:07.5

will adjust, i.e. modify the resolution in order to fit into the
extents. The extents are not modified. In GRASS, the extents have
precedence over resolution, unless you use the -a flag, in which case
the extents are aligned to the desired resolution. Thus use either

g.region rast=MASK@default nsres=0:00:07.5 ewres=0:00:07.5 -a

to align the current region to the desired resolution and enforcing
this resolution, or

g.region rast=MASK@default

You can check if the current region is all right with g.region -p or
g.region -g, before doing any processing.

I tried to set the region with the gdalinfo output of the ArcMap
raster fileASC_ARCMAP.asc:

g.region w=-60.9250001 e=-49.9979167 n=-0.0000001 s=-10.0000001
res=0.00208333333

Output of g.region -g:
n=-1e-07
s=-10.0000001
w=-60.9250001
e=-49.9979167
nsres=0.00208333333333333
ewres=0.00208333334604385
rows=4800
cols=5245
cells=25176000

As you can see, the resolution needed to be adjusted, i.e. there are
floating point rounding errors in fileASC_ARCMAP.asc. Using rounded
DD:MM:SS.S format:

g.region w=60:55:30W e=49:59:52.5W n=0 s=10S res=00:00:07.5

Output of g.region -g:
n=0
s=-10
w=-60.925
e=-49.9979166666667
nsres=0.00208333333333333
ewres=0.00208333333333333
rows=4800
cols=5245
cells=25176000

This is probably the desired extents and resolution, the resolution
did not need to be adjusted (0.00208333333333333 = 00:00:07.5) .

Markus M

Now, I get the same number of columns and rows. However, the cell size isn’t
the same that ArcMAP output file…so i think it can be the reason of
non-similar extend and origin…

Below i show you the output gdalinfo,

Driver: AAIGrid/Arc/Info ASCII Grid
Files: D:\gras_data\temp\test5.asc

Size is 5245, 4800
Coordinate System is `’
Origin = (-60.924999999999997,-0.001600000000000)
Pixel Size = (0.002083000000000,-0.002083000000000)
Corner Coordinates:
Upper Left ( -60.9250000, -0.0016000)
Lower Left ( -60.9250000, -10.0000000)
Upper Right ( -49.9996650, -0.0016000)
Lower Right ( -49.9996650, -10.0000000)
Center ( -55.4623325, -5.0008000)
Band 1 Block=5245x1 Type=Int32, ColorInterp=Undefined
NoData Value=-9999

Do you have others ideas?

Jacquie, thanks for your comments, i hope the next SPs versions fix these
kind of bugs.

regards,

2012/5/8 Alejandro Coca Castro <acocac@gmail.com>

Hi, i tried to convert the following enviroments settings to GRASS
g.region and r.mask for the next ARCGIS output (ASCII file):

fileTIF = r"x:\test\fileTIF.tif"
MASK = r"x:\test\mask_file"
env.extent = fileTIF
env.snapRaster = MASK
env.mask = MASK
fileGRD = r"x:\test\fileGRD"
outCon = Con(fileTIF, fileTIF, “”, “VALUE >= 0”)
outCon.save(fileGRD)
fileASC = r"x:\test\fileASC.asc"
env.workspace = fileGRD
RasterToASCII_conversion(fileGRD,fileASC)

So, i put on the GRASS command-line:

r.mask input=mask_file@default
g.region rast=fileTIF@default res=0.00208333333 align=MASK@default
r.mapcalc fileGRD = if(fileTIF@default < 0 , null(), fileTIF@default)
r.out.arc input= fileGRD@default output=x:\test\fileASC_grass.asc

However, the ArcGIS and GRASS outputs had a different extend and curiously
the GRASS output didn’t snap their cells with the MASK. Also, when i observe
the GRASS output cellsize, it only has the first 6 decimals (f.e.
0.002083)…

Finally i tried to setup the parameters of g.region with the ArcGIS output
but GRASS output definetly didnt have the same properties of ArcGIS output
(cellsize, columns and rows, extend)

If somebody knows how can i fix it, i’ll be grateful,

Thanks in advance,

Alejandro


Alejandro Coca Castro


Alejandro Coca Castro

(attachments)

error.JPG

On Wed, May 9, 2012 at 4:07 PM, Alejandro Coca Castro <acocac@gmail.com> wrote:

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.

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...

I think instead of r.out.arc, you can also use r.out.gdal
format=AAIGrid and see if that gives a better match.

Markus M

Mark, i set the region as you tried...

Thanks in advance,

2012/5/9 Markus Metz <markus.metz.giswork@googlemail.com>

On Tue, May 8, 2012 at 9:41 PM, Alejandro Coca Castro <acocac@gmail.com>
wrote:
> Hi Mark, i followed your instructions, so i put in command-line
>
This
> g.region rast=MASK@default nsres=0:00:07.5 ewres=0:00:07.5

will adjust, i.e. modify the resolution in order to fit into the
extents. The extents are not modified. In GRASS, the extents have
precedence over resolution, unless you use the -a flag, in which case
the extents are aligned to the desired resolution. Thus use either

g.region rast=MASK@default nsres=0:00:07.5 ewres=0:00:07.5 -a

to align the current region to the desired resolution and enforcing
this resolution, or

g.region rast=MASK@default

You can check if the current region is all right with g.region -p or
g.region -g, before doing any processing.

I tried to set the region with the gdalinfo output of the ArcMap
raster fileASC_ARCMAP.asc:

g.region w=-60.9250001 e=-49.9979167 n=-0.0000001 s=-10.0000001
res=0.00208333333

Output of g.region -g:
n=-1e-07
s=-10.0000001
w=-60.9250001
e=-49.9979167
nsres=0.00208333333333333
ewres=0.00208333334604385
rows=4800
cols=5245
cells=25176000

As you can see, the resolution needed to be adjusted, i.e. there are
floating point rounding errors in fileASC_ARCMAP.asc. Using rounded
DD:MM:SS.S format:

g.region w=60:55:30W e=49:59:52.5W n=0 s=10S res=00:00:07.5

Output of g.region -g:
n=0
s=-10
w=-60.925
e=-49.9979166666667
nsres=0.00208333333333333
ewres=0.00208333333333333
rows=4800
cols=5245
cells=25176000

This is probably the desired extents and resolution, the resolution
did not need to be adjusted (0.00208333333333333 = 00:00:07.5) .

Markus M

>
> Now, I get the same number of columns and rows. However, the cell size
> isn't
> the same that ArcMAP output file...so i think it can be the reason of
> non-similar extend and origin....
>
> Below i show you the output gdalinfo,
>
> Driver: AAIGrid/Arc/Info ASCII Grid
> Files: D:\gras_data\temp\test5.asc
>
> Size is 5245, 4800
> Coordinate System is `'
> Origin = (-60.924999999999997,-0.001600000000000)
> Pixel Size = (0.002083000000000,-0.002083000000000)
> Corner Coordinates:
> Upper Left ( -60.9250000, -0.0016000)
> Lower Left ( -60.9250000, -10.0000000)
> Upper Right ( -49.9996650, -0.0016000)
> Lower Right ( -49.9996650, -10.0000000)
> Center ( -55.4623325, -5.0008000)
> Band 1 Block=5245x1 Type=Int32, ColorInterp=Undefined
> NoData Value=-9999
>
> Do you have others ideas?
> ------
>
> Jacquie, thanks for your comments, i hope the next SPs versions fix
> these
> kind of bugs.
>
> regards,
>
> 2012/5/8 Alejandro Coca Castro <acocac@gmail.com>
>>
>> Hi, i tried to convert the following enviroments settings to GRASS
>> g.region and r.mask for the next ARCGIS output (ASCII file):
>>
>> fileTIF = r"x:\test\fileTIF.tif"
>> MASK = r"x:\test\mask_file"
>> env.extent = fileTIF
>> env.snapRaster = MASK
>> env.mask = MASK
>> fileGRD = r"x:\test\fileGRD"
>> outCon = Con(fileTIF, fileTIF, "", "VALUE >= 0")
>> outCon.save(fileGRD)
>> fileASC = r"x:\test\fileASC.asc"
>> env.workspace = fileGRD
>> RasterToASCII_conversion(fileGRD,fileASC)
>>
>> So, i put on the GRASS command-line:
>>
>> r.mask input=mask_file@default
>> g.region rast=fileTIF@default res=0.00208333333 align=MASK@default
>> r.mapcalc fileGRD = if(fileTIF@default < 0 , null(), fileTIF@default)
>> r.out.arc input= fileGRD@default output=x:\test\fileASC_grass.asc
>>
>> However, the ArcGIS and GRASS outputs had a different extend and
>> curiously
>> the GRASS output didn't snap their cells with the MASK. Also, when i
>> observe
>> the GRASS output cellsize, it only has the first 6 decimals (f.e.
>> 0.002083)....
>>
>> Finally i tried to setup the parameters of g.region with the ArcGIS
>> output
>> but GRASS output definetly didnt have the same properties of ArcGIS
>> output
>> (cellsize, columns and rows, extend)
>>
>> If somebody knows how can i fix it, i'll be grateful,
>>
>> Thanks in advance,
>>
>> Alejandro
>
>
>
>
> --
> Alejandro Coca Castro

--
Alejandro Coca Castro

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user