similar to: How write raster files after manipulation?

Displaying 20 results from an estimated 1000 matches similar to: "How write raster files after manipulation?"

2013 Feb 18
1
How to calculate the moving average for binary files?
I have 12 binary (raster) files https://echange-fichiers.inra.fr/get?k=k3M2jatJyHy65Cs99G4 . I would like to calculate the moving average for the 12 values for each pixel in the 12 files. For a simple vector we can get a moving average by using this : x <- c(1,2,3,NA,NA,4,6,5,6,4,2,5) movingmean <- rollapply(x, 3, FUN = mean, na.rm = T,fill=NA) now
2011 Jan 24
0
writeRaster with raster package
Hello, I have a problem writing a raster with the raster package. I have the raster object "mask" which has the following geoinformation: ---- R output > mask class : RasterLayer filename : E:/Daten/FE/HyMAP/Luxembourg_2010/Kehlen_Useldange/mosaik/LUX_LC_noOverlap_mask nrow : 5198 ncol : 2813 ncell : 14621974 min value : 0 max value : 255
2013 Mar 19
1
How to get the rolling standard deviation in rasters?
I am using this code to calculate the moving average mean.It worked fine but when I wanted to also calculate based on sd(stander deviation) I got the error shown below. I read this documentation of R movingFun and found that sd was mentioned at http://hosho.ees.hokudai.ac.jp/~kubo/Rdoc/library/raster/html/movingFun.html I wonder if needs any other things to conseder or sd is not at all supplied
2013 Mar 21
0
Problems of exporting raster to ArcGIS
Hello: I am using R raster package to replace ArcGIS when processing multiple shp files. However, when I export R raster back to ArcGIS, it couldn't recognize R raster file correctly. For example, I used {raster} package and got a RasterLayer as followed. class : RasterLayer dimensions : 8280, 18480, 153014400 (nrow, ncol, ncell) resolution : 0.008333334, 0.008333334 (x, y)
2013 Jan 29
2
Netcdf and Raster Package Questions, Need .asc File for GIS
Hello R-Group, I am new working with netcdf files and the raster package in R.I am trying to read in a netcdf file using the package "ncdf".I am able to get the lat, lon and parameter I need and can plot using fill.contour.Ultimately, I am trying to create a .asc file to reafd into GIS.I am using the package "raster" to read the parameter.When I read in with
2013 Jan 24
0
How to add a function to another written code?
I have two directories https://echange-fichiers.inra.fr/get?k=AcHKdNI4No44GEsj7PK with 12 (global maps)binary files in each.I used the code given below to calculate the spatial correlation between these files and it worked well(the output is a global correlation map). I wonder if there is a simple way to calculate RMSE and bias along with cor.so finally we get three outputs (bias map,RMSE map,cor
2013 Mar 18
4
Why stacking rasters return NAs?
I have several rasters that I want to do some calculations ,basically calculating the moving average. dir2 <- list.files("D:\\2010+2011", "*.bin", full.names = TRUE) saf=stack(dir2) movi <- overlay(stack(saf),fun=function(x) movingFun(x, fun=mean, n=3, na.rm=TRUE)) Error in .overlayList(x, fun = fun, filename = filename,
2002 Mar 13
1
R matrix to Python
I'm trying to export an R (1.4.0 on linux) matrix to python (+Pyclimate) via a binary file. The problem is that while R writes by columns, python reads by rows. For a 2D matrix, there is no problem: writeBin writes vectors, so writeBin(t(x)[1:length(x)],...) works fine. But the objects I want to export are 3D arrays (slice rasters of lat,lon for each time t). One way is to use a loop over
2008 Nov 05
1
Using RGDAL to "copy" header information...
R-geographers... I'm trying to solve a problem to implement a line-by-line tiled processing using RGDAL (read 1 line of an image, process the one line, write one line of the image to a binary file). Everything except for the final step I'm able to do using a combination of RGDAL and r-base commands. Below is the basic structure, the input file "elev" can be any image file
2013 Jan 17
2
How to calculate monthly average from daily files in R?
I have 365 binary files: https://echange-fichiers.inra.fr/get?k=oy3CN1yV1Um7ouRWm2U ,I want to calculate the monthly average. So from the 365 files, I will get 12 files.I would like also to tell R not to take into account the no-data value (-32765).for example, for the first month, there are 31 records: 3 of these records has the value -32765,I want R to take the average of the rest records(28
2019 Dec 06
2
long vector support
All, At first glance, a recent commit to R-devel ( https://github.com/wch/r-source/commit/2c182014ecc8c2407a89092c9162d86046bd18da) appears to be related to long vector support. But as Henrik Bengtsson points out at https://github.com/HenrikBengtsson/Wishlist-for-R/issues/97#issuecomment-562659134, writeBin() still prohibits long vectors. Are there any plans to add long vector support to R
2002 Oct 07
2
Error in writeBin(object, con, size = 2)
Hi all, I wrote a function (in R batch mode) which reads binary data, interpolates sometimes and wrote a new binary file of the same size as the input file. Her is a bit of code: while (length( head <- readBin(si, integer(), 64, size=2))) { data <- readBin(si, integer(), head[5], size=2) ## now write head to new file writeBin(head, so, size=2) ## if head[4] is 9 or
2010 Jul 05
1
export VTK from R : impossible to write data as float
Hello, I've written a short code (below) to write 3D unstructured grid to binary VTK files from R. Problem : I can only write integers with the command : data<-as.numeric(c(3.3)) storage.mode(data)<-'integer' writeBin(data,bfile_celldata,endian="swap") the function storage.mode(data)<-'long' looks fine, but the VTK file is not readable. thanks for any
2003 Apr 25
2
Open an r+b file connection on Windows
I am trying to open an existing binary file, seek to a position in the middle, and then write one byte, while keeping the already existing data after that byte. It seems to me that I am unable to open a connection to a binary file in both read and write mode. I can open the "r+b" binary file connection and seek around, but I can't write to the file. And looking at the function
2019 Dec 07
0
long vector support
>>>>> Will L >>>>> on Fri, 6 Dec 2019 16:02:59 -0500 writes: > All, At first glance, a recent commit to R-devel ( > https://github.com/wch/r-source/commit/2c182014ecc8c2407a89092c9162d86046bd18da) > appears to be related to long vector support. yes, for a very limited case, with a very nice minimal reproducible example and proper R bug
2001 Dec 07
2
Memory problem
Dear all, I have written a little R program to convert images. See below. Within the loop over j (the filenames) memory consumption grows constantly. rm( ... ) inside the loop did not help. Memory does not grow if I remove the writeBin statements between the two #-------- marks. But obviously this is not solution I want... Thanks for any advice. Manfred Baumstark P.S. As I'm new to R:
2013 Aug 14
1
2 questions about signal & broken connection in R
Hi, all, I have 2 questions about signal handling in R. Would you pls help give me some suggestions? Many thanks! [How to block the signal in one R function]: If one R function hopes to be running without interrupting, how can we avoid this? To be more specific, for one R function "func1", it will do a loop to send messages to another R process, and receive responses from peers. How
2008 Jan 23
0
writeBin doesn't "send" until readBin executed
Hi all - I'm playing around with an attempt to do some serial communication from within R to a microcontroller board. I open a connection: zz = file("/dev/ttyUSB0",open="a+") ## text mode ... when I execute writeLines("0",con=zz) I know the board receives the "0" because the board's serial comm LEDs light up when submit the command at the R
2001 Jul 17
1
How to write the bytes 00 01 00 to a file/connection?
Is there any way to write (8-bit) bytes to a file which works on all [R] platforms? I have been looking at 1) writeBin 2) writeChar 3) cat and neither of them manage to write arbitrary sequences of bytes (0-255). For instance, I would like to create a binary file of length three containing the bytes 0, 1 and 0. I [R] I have the following vector of bytes: bfr <- c(0,1,0) 1) For
2009 Apr 30
2
NA_real_ <op> NaN -> NA or NaN, should we care?
On Linux when I compile R 2.10.0(devel) (src/main/arithmetic.c in particular) with gcc 3.4.5 using the flags -g -O2 I get noncommutative behavior when adding NA and NaN: > NA_real_ + NaN [1] NaN > NaN + NA_real_ [1] NA If I compile src/main/arithmetic.c without optimization (just -g) then both of those return NA. On Windows, using a precompiled R 2.8.1 from CRAN I get NA for