? stato filtrato un testo allegato il cui set di caratteri non era indicato... Nome: non disponibile URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20131102/9c7242bf/attachment.pl>
If I understand what you are up to, my "pander" package might help. You mean something like this? I used the example form the package manual.> library(pander) > data(meuse) > coordinates(meuse) = ~x+y > pander(variogram(log(zinc)~1, meuse))-------------------------------------------- np dist gamma dir.hor dir.ver id ---- ------ ------- --------- --------- ---- 57 79.29 0.1234 0 0 var1 299 164 0.2162 0 0 var1 419 267.4 0.3028 0 0 var1 457 372.7 0.4121 0 0 var1 547 478.5 0.4634 0 0 var1 533 585.3 0.5647 0 0 var1 574 693.1 0.569 0 0 var1 564 796.2 0.6187 0 0 var1 589 903.1 0.6471 0 0 var1 543 1011 0.6916 0 0 var1 500 1118 0.7034 0 0 var1 477 1221 0.6039 0 0 var1 452 1329 0.6517 0 0 var1 457 1437 0.5665 0 0 var1 415 1543 0.5748 0 0 var1 -------------------------------------------- Best, Gergely On 2 November 2013 09:55, Enzo Cocca <enzo.ccc@gmail.com> wrote:> hi, > > I want to export in ascii-grid file a semivariogram map that I have did > with gstat library. > > How can I make it? > > Somebody can help me? > thanks! > > enzo > -- > Enzo Cocca (PhD Candidate) > Research Fellow > Università di Napoli "L'Orientale" > mail: enzo.ccc@gmail.com > cell: +393495087014 > > [[alternative HTML version deleted]] > > > ______________________________________________ > R-help@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. > >[[alternative HTML version deleted]]
Or do you mean you want to write the gridded output of an interpolation you did (perhaps using kriging) in gstat as an ESRI ASCII Grid file for reading into a GIS? If so, you can probably do it with writeGDAL from the rgdal package, or writeRaster from the raster package. I don't really know what a 'semivariogram map' is. On Sat, Nov 2, 2013 at 8:55 AM, Enzo Cocca <enzo.ccc at gmail.com> wrote:> hi, > > I want to export in ascii-grid file a semivariogram map that I have did > with gstat library. > > How can I make it? > > Somebody can help me? > thanks! > > enzo > -- > Enzo Cocca (PhD Candidate) > Research Fellow > Universit? di Napoli "L'Orientale" > mail: enzo.ccc at gmail.com > cell: +393495087014 > > [[alternative HTML version deleted]] >
On Mon, Nov 4, 2013 at 7:27 AM, Enzo Cocca <enzo.ccc at gmail.com> wrote:> yes barry I really need this. > > I tried to use raster or rgdal but with poor results. > > I have this function: > > VGM_PARAM_A3 <- gstat(id="bos_bison", > formula=combusto~1,locations=~coord_x+coord_y, data=archezoology_table, > nmax = 10) > > VGM_PARAM_A3 <- gstat(VGM_PARAM_A3, model=vgm(1, "Sph", 5, 0), > fill.all=TRUE) > > ESV_A3 <- variogram(VGM_PARAM_A3, map=True, with=0.1, cutoff=9) > > VARMODEL_A3 = fit.lmc(ESV_A3, VGM_PARAM_A3) > > plot(ESV_A3, threshold = 5, col.regions = bpy.colors(), xlab=, ylab=, > main="Map - A3") > png("C:\Users\User\pyarchinit_R_folder\A3 semivariogram_map.png", > width=10000, height=10000, res=400) > > I make a png file but how can I convert it in ascii-grid?Why do you want to make an ascii-grid out of this? The variogram map isn't in geographical coordinates, its in coordinate differences in x and y The return value when map=TRUE doesn't seem to be too well documented, but looks like it is a list with a 'map' element that is a spatial pixels data frame. Here's an example using the demo data (I can't run your code because I don't have your data, please try and make your problems easily reproducible): require(sp) require(gstat) data(meuse) coordinates(meuse)=~x+y v=variogram(log(zinc)~1, meuse,map=TRUE,cutoff=900,width=10) class(v$map) [1] "SpatialPixelsDataFrame" attr(,"package") [1] "sp" Now that can be written using rgdal's writeGDAL function. However, you need the AAIGrid driver to work properly:> writeGDAL(v$map,"vmap.ag",driver="AAIGrid")Error in .local(.Object, ...) : Dataset copy failed raster package to the rescue:> require(raster) > writeRaster(raster(v$map),"v.asc","ascii")class : RasterLayer [etc] When I look at the file, I have an ESRI grid file: $ head -5 v.asc NCOLS 181 NROWS 181 XLLCORNER -905 YLLCORNER -905 CELLSIZE 10 [+ data] Now, that's assuming you wanted to write the data, not a pretty image picture like you get when you plot the variogram map. And there's still the mystery of why you want to write a non-geographic coordinate-based dataset to a geographic data format... And you should probably have asked this on R-sig-geo where the geographRs (including the authors of gstat) hang out. Hope this helps anyway. Barry