[GRASS-user] making fcell raster maps using climate data

Hamish hamish_b at yahoo.com
Mon May 30 03:31:59 EDT 2011


Bulent wrote:
>   UTM_E   UTM_N ELEV DATE      Jan      Feb      Mar      Apr      May
> 1 502500 4398240 1661    0 35.35559 34.10211 41.08517 54.96244 53.24204
> >> 2 502500 4398240 1661 -100 35.35434 34.10950 41.11511 54.98155 51.01671
> 3 502500 4398240 1661 -200 34.95282 34.74009 43.04097 56.12360 45.02433
> 4 502500 4398240 1661 -300 35.35213 34.12072 41.16004 55.01019 48.52734
> [...]

to import that directly into GRASS, save as .csv out of Excel,
then:

v.in.ascii in=datafile.csv out=temperature_years \
   fs=tab x=2 y=3 skip=1 \
   columns='cat_id integer, utm_e double precision, utm_n double precision, elev integer,  date_bp integer, temp_f_jan double precision, temp_f_feb double precision, [...], temp_f_dec double precision'

(fill in mar-nov, I didn't feel like typing it in..)

note "date_bp" is used instead of "date", to avoid the SQL
reserved-word conflict. for a quick try leave off the column
naming option and it will auto-detect the column types.

note set fs= space,tab,comma, etc as you exported from the
spreadsheet. Do not save using fixed width columns.
AFAIK v.in.ascii doesn't respect "quoting" around text strings.

Empty, NULL, nan, or "*" values for floating point no-data may be
problematic; full support for importing those is a work in
progress. For now if you have any try leaving them empty.

v.surf.rst does a very nice job as long as your starting points
are not highly clumpy (then you'll get segmentation artifacts and
have to start tweaking the interp coefficients). For the sample
data above it should be ok.


Pierre, you may be interested in looking at the v.kridge(.py)
module, behind the scenes it calls R from GRASS to do the
interpolation. Requires python-rpy2 & the GRASS<->R cran package
to be installed, and a number of other support packages it will
tell you about.  (I'm having a little trouble starting it today..
but the method is sound)


Hamish



More information about the grass-user mailing list