[R] [newbie] failure to plot a RasterLayer with raster::plot or fields::image.plot

Michael Sumner mdsumner at gmail.com
Mon Oct 22 10:03:47 CEST 2012


With NetCDF I would recommend working on understanding your data in a
more native way. Both rgdal and raster put their own take  (via ncdf
and GDAL respectively) on how the data are to be interpreted. Both are
limited in the GIS way of requiring regular grids and a set of 2D
layers, rather than more general arrays. There's no end to this
problem in general, the worldviews for the data systems are just
fundamentally different and both have pros and cons for different
tasks.

The RNetCDF, ncdf and ncdf4 packages provide a far more "NetCDF-like"
view of these files, with no graphics wrappers around the basic R
plotting functions. It might help to become familiar with them if you
aren't already, and so you can see how other packages interpret the
details and occasionally make assumptions that cause problems.

Cheers, Mike.




On Mon, Oct 22, 2012 at 4:21 PM, Tom Roche <Tom_Roche at pobox.com> wrote:
>
> https://stat.ethz.ch/pipermail/r-help/2012-October/326837.html
>> summary: spatial data to be input to a regional-scale environmental
>> model must (1) be converted to netCDF and then (2) "regridded"
>> (cropped, projected, increased resolution). In a public git
>> repository
>
>> https://github.com/TomRoche/GEIA_to_NetCDF
>
>> I have R code (with bash drivers) that does the conversion step, and
>> plots the converted output, apparently correctly. However attempts
>> to plot the output of the regridding step (twice with raster::plot,
>> once with fields::image.plot) are very wrong. How to fix?
>
>> details:
>
> In an effort to make this problem more understandable (and hopefully
> thereby to get help), I have added several graphics and lots more links
> here
>
> http://stackoverflow.com/questions/13005181/rasterplot-problems-unwanted-rotation-extents
>
> and restricted the discussion to just the raster::plot problems.
>
> Your assistance is appreciated, Tom "at wit's end" Roche <Tom_Roche at pobox.com>
>
> ______________________________________________
> R-help at r-project.org 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.



-- 
Michael Sumner
Hobart, Australia
e-mail: mdsumner at gmail.com




More information about the R-help mailing list