Robert J. Hijmans a écrit :
>> ncols  721
>>     
> is suspect. Presumably this is a global 0.5 degree grid. If so, ncols
> shoud be 720 (but your file may well have 721 columns, and perhaps a
> different x resolution; unless the ullcorner refers to the center of
> the cell, and the raster is from -180.25 to 180.25).
> Otherwise, if you have 721 columns, you will end up with an xr corner
> of 180.5, which, it seems, grass interprets as -179.5 (the world is
> round, after all). Then:
>
>   
>> 0.5/721
>>     
> [1] 0.0006934813
>   
>
> Robert
>
> 2009/11/28 Patrick Giraudoux <patrick.giraudoux@univ-fcomte.fr>:
>   
>> Dear all,
>>
>> I am using QGIS 0.11.0 Metis under windows and struggle to import a raster
>> into GRASS. This is an ARCINFO/ESRI grid file in natural coordinates (WGS84)
>> whose heading is:
>>
>> ncols  721
>> nrows  360
>> xllcorner  -180
>> yllcorner  -90
>> cellsize   0.5
>> NODATA_value  254
>>
>> etc....
>>
>> I do not meet any trouble when importing it from QGIS as a raster, nor
>> within R using the package rgdal and the function readGDAL, but when using
>> within QGIS the GRASS importation tools (r.in.gdal or r.in.arc), something
>> goes wrong. Il looks like the vertical resolution was respected (0.5), but
>> the horizontal resolution unexpectedely comes to be 0.000693481 in decimal
>> degrees (making the map a narrow vertical strip...), see the output of
>> r.info below
>>
>> I get the same result reading a geotif  from QGIS/GRASS with r.in.gdal. The
>> geotif file was obtained reading the original ascii raster from R
>>  (everything OK), then writing it to a geotif with writeGDAL().
>>
>> Any idea about what may happen ?
>>
>> Patrick
>>
>>
>>
>> ----------------------------------------------------------------------------+
>> | Layer:    tempave                        Date: Sat Nov 28 11:07:22 2009
>>  |
>> | Mapset:   giraudoux                      Login of Creator: pgiraudo
>>  |
>> | Location: ChinaWGS84
>> |
>> | DataBase: U:/Documents and Settings/pgiraudo/Mes documents/GIS/grassdata
>> |
>> | Title:     ( tempave )
>> |
>> | Timestamp: none
>>  |
>> |----------------------------------------------------------------------------|
>> |
>>  |
>> |   Type of Map:  raster               Number of Categories: 255
>> |
>> |   Data Type:    FCELL
>>  |
>> |   Rows:         360
>>  |
>> |   Columns:      721
>>  |
>> |   Total Cells:  259560
>> |
>> |        Projection: Latitude-Longitude
>>  |
>> |            N:        90N    S:        90S   Res:  0:30
>> |
>> |            E:    179:30W    W:       180W   Res: 0:00:02.496533
>>  |
>> |   Range of data:    min = 1.#QNAN0  max = 1.#QNAN0
>> |
>> |
>>  |
>> |   Data Description:
>>  |
>> |    generated by r.in.gdal
>>  |
>> |
>>  |
>> |   Comments:
>>  |
>> |    r.in.gdal -o input="U:\Documents and Settings\pgiraudo\Bureau\TEMPER\
>> |
>> |    AT\TEMPAVE.tif" output="tempave"
>>  |
>> |
>>  |
>> +----------------------------------------------------------------------------+
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo@stat.math.ethz.ch
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>>     
>
>   


This was exactly that. I have removed the 721th column and kept 720 
columns, and the raster was correctly imported and displayed (with 
correct coordinates, e.g. coast lines were compared to a georeferenced 
shapefile).

So it may be of interest to check what was wrong with the raster 
provided from the FAO website on global climatological data (a rich 
documentation from 
http://www.fao.org/geonetwork/srv/en/metadata.show?id=7417&currTab=simple). 
I was using the file on Annual Average Temperature (Leemans & Cramer 
1989-FAO Agromet 1997). Whatever the export format:

- the north coordinates exceeds 90° (due to an extra 361 column, not 
compatible with the global 0.5 degree grid) - I had detected that and 
removed it before coming to the list;
- the eastern coordinates exceeds 180° (due to en extra 721 column !) - 
this was the origin of my help call...

The workaround to get the data imported into grass is to edit an 
exported ascii file and to remove the extra row and column.

Thanks Robert for the hint,

Patrick






	[[alternative HTML version deleted]]

