[R-sig-Geo] Gradient calculation with ESRI grid (.asc) format

Robert Hijmans r.hijmans at gmail.com
Wed May 6 05:50:09 CEST 2009

You could try the focalFilter function in the raster package:
install.packages("raster", repos="http://R-Forge.R-project.org")

with this argument for the Sobel filter:
filter=matrix(c(1,2,1,0,0,0,-1,-2,-1) / 4, nrow=3)

(For using raster this way you should upgrade to R 2.9 first, if you
have not done so yet; otherwise you will get an old version; this is
an unpleasant feature of R-forge)


On Wed, May 6, 2009 at 11:15 AM, Tim Sippel <tsippel at gmail.com> wrote:
> I'm looking to calculate gradients from oceanographic variables (ie. sea
> surface temperature, chlorophyll, etc.) for which I have downloaded in ESRI
> grid format (.asc).  From some research on gradient analysis, I have found a
> few people who have used a Sobel filter to estimate gradients in images (ie.
> presumably .tif or similar files).  However, I have tons of data in ESRI
> grid format, and all of it is unprojected (ie. lat/lon coordinates).  I'd
> appreciate suggestions on this if anyone has ideas.  One of the primary
> issues to overcome is that the units of my grids are different (ie.
> x=longitude, y=latitude, z=temperature) and my grid files span the entire
> south Pacific Ocean.
> Thanks,
> Tim
>        [[alternative HTML version deleted]]
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

More information about the R-sig-Geo mailing list