[R] how to sub-sample a variable on another file coordinates

Paul Hiemstra p.hiemstra at geo.uu.nl
Mon Sep 3 11:44:18 CEST 2007


Dear Yogesh,

This question seems more appropriate for the r-sig-geo mailing list 
(https://stat.ethz.ch/mailman/listinfo/r-sig-geo).

The sampling of the netcdf files can be done by using the overlay 
function from the sp-package (available on CRAN). You would have to read 
both the netcdf file and the ASCII file into the spatial classes 
presented by sp (SpatialGrid for the CO2 data (I assume that it is a 
grid) and SpatialPoints for the ASCII data). This could be done using 
the rgdal-package.

good luck!

Paul

Yogesh Tiwari schreef:
>  Hello 'R' Users,
>
> I have a monthly mean CO2 necdf data file defined on 1x1 lat by lon
> coordinate. I want to sub-sample this variable CO2 on the coordinates
> of another ASCII data file. The coordinates of another ASCII data file are
> as:
>
>    -24.01 152.06 -18.58 150.19 -13.46 148.35 -8.29 147.03 -3.14 146.19 1.53
> 145.59 7.08 145.33 12.25 145.02 17.46 144.31 22.44 142.35 27.53 141.26 33.04
> 140.15 -23.49 152.07 -18.56 150.18 -13.41 150.14 -8.24 150.04 -3.07 149.21
> 2.05 148.31 7.19 147.45 12.37 147.03 17.53 146.21 22.56 144.47 28.04 143.38
> 32.54 142.26
>
> Kindly anybody can help on this.
>
> Many thanks,
>
> Cheers,
> Yogesh
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>   


-- 
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone: 	+31302535773
Fax:	+31302531145
http://intamap.geo.uu.nl/~paul



More information about the R-help mailing list