[GRASS-user] Re: r.in.gdal oddity

Markus Metz markus.metz.giswork at googlemail.com
Mon Oct 31 04:15:19 EDT 2011


Helmut Kudrnovsky wrote:
>>I am importing worldclim .asc files from the ipcc4 simulations
>>(http://ccafs-climate.org/). These are latlong files with a global
>>extent. I have compiled grass 6.4.2svn from source on ubuntu 11.10 and
>>hope that I did everything correctly, according to the wiki.
>>
>>When importing, here is what I do and what happens:
>>
>>r.in.gdal -o input="/D/Documents/Spatial_Datasets/Climate/WorldClim/\
>>hccpr_hadcm3_a2a_2020s_prec_2_5min_asc/prec_10.asc" output="prec_10"
>
> tested here with
> http://ccafs-climate.org/data/A2a_2020s/hccpr_hadcm3/hccpr_hadcm3_a2a_2020s_prec_2_5min_asc.zip
>
> gdalinfo hccpr_hadcm3_a2a_2020s_prec_2_5min.asc
>
> Driver: AAIGrid/Arc/Info ASCII Grid
> Files: prec_10.asc
> Size is 8640, 3600
> Coordinate System is `'
> Origin = (-180.000000000000000,90.000000000119996)
> Pixel Size = (0.041666666666700,-0.041666666666700)
> Corner Coordinates:
> Upper Left  (-180.0000000,  90.0000000)
> Lower Left  (-180.0000000, -60.0000000)
> Upper Right ( 180.0000000,  90.0000000)
> Lower Right ( 180.0000000, -60.0000000)
> Center      (   0.0000000,  15.0000000)
> Band 1 Block=8640x1 Type=Int32, ColorInterp=Undefined
>  NoData Value=-9999
>

There is a tiny precision loss:
Origin = (-180.000000000000000,90.000000000119996)
Pixel Size = (0.041666666666700,-0.041666666666700)
should be
Origin = (-180.000000000000000,90.000000000000000)
Pixel Size = (0.041666666666667,-0.041666666666667)

pixel size is now as close as possible to 2.5 min.

This is neither a gdal nor a grass bug, but a bug of the software used
to produce these data.

This can easily be fixed with e.g.
gdal_translate -a_ullr -180 90 180 -60 prec_1.asc prec_1.tif

then import the corrected tif.

HTH,

Markus M


More information about the grass-user mailing list