Re: [R-sig-Geo] Reading National Snow and Ice Data Center binary files

2011-10-19 Thread Anthony Fischbach
Thank you Robert, I amended my previous post to correct the duplicate use of the x variable and to provide an intuitive black to white color ramp for the ice. - Tony Fischbach, Wildlife Biologist Walrus Research Program Alaska Science Center U.S. Geological Survey 4210 University Drive Anchora

Re: [R-sig-Geo] Reading National Snow and Ice Data Center binary files

2011-10-19 Thread Robert J. Hijmans
Tony, On Wed, Oct 19, 2011 at 1:13 PM, Anthony Fischbach wrote: > This works beautifully. > Is there a trick to applying an intuitive color ramp to the png file You can provide a list of colors such as that generated by rainbow , heat.colors

Re: [R-sig-Geo] Reading National Snow and Ice Data Center binary files

2011-10-19 Thread Thomas . Adams
cron on Linux systems. Tom - Original Message - From: Anthony Fischbach Date: Wednesday, October 19, 2011 2:04 pm Subject: Re: [R-sig-Geo] Reading National Snow and Ice Data Center binary files To: r-sig-geo@r-project.org > Thank you for the GRASS suggestion. > It wo

Re: [R-sig-Geo] Reading National Snow and Ice Data Center binary files

2011-10-19 Thread Anthony Fischbach
This works beautifully. Is there a trick to applying an intuitive color ramp to the png file and setting the non-ice to null values? I have tried to assign all non ice and ice = 0 values to NA. This works down to the level of the extract function. ... fileName <- 'ftp://sidads.colorado.edu/pub/DA

Re: [R-sig-Geo] Reading National Snow and Ice Data Center binary files

2011-10-19 Thread Robert J. Hijmans
Anthony, projectRaster failed because it uses projectExtent, which fails to give the right answer for a circumpolar dataset. I used projectExtent to make projectRaster more efficient. I took it out and now things work as expected on these data (and perhaps a bit slower in some other cases). Fixed

Re: [R-sig-Geo] Reading National Snow and Ice Data Center binary files

2011-10-19 Thread Robert J. Hijmans
Not sure what's going on here, I need to investigate. But this work-around, which replicates the essence of projectRaster works for me: library(rgdal) x <- raster(ymn=60) res(x) <- 0.25 xy <- coordinates(x, sp=T) xypole <- spTransform(xy, projection(r, asText=F)) x[] <- extract(r, xypole, method=

Re: [R-sig-Geo] Reading National Snow and Ice Data Center binary files

2011-10-19 Thread Roger Bivand
On Wed, 19 Oct 2011, Anthony Fischbach wrote: Thank you for the GRASS suggestion. It would also be straight forward in ArgGIS, but I seek to run this all in a scripting environment with the full flexibility of R such that I may automate the whole process. I have a feeling that this is strandin

Re: [R-sig-Geo] Reading National Snow and Ice Data Center binary files

2011-10-19 Thread Anthony Fischbach
Thank you for the GRASS suggestion. It would also be straight forward in ArgGIS, but I seek to run this all in a scripting environment with the full flexibility of R such that I may automate the whole process. Following on the projectRaster idea, I have tried using the from and to options, first c

Re: [R-sig-Geo] Reading National Snow and Ice Data Center binary files

2011-10-19 Thread Thomas Adams
Tony, This would be a far easier task in, say, GRASS GIS — once the data is there, R integrates very nicely with GRASS, making the combination quite powerful. Tom On 10/19/11 1:36 PM, Anthony Fischbach wrote: Very elegant! But the projection seems to have trouble. Please see images of the

Re: [R-sig-Geo] Reading National Snow and Ice Data Center binary files

2011-10-19 Thread Anthony Fischbach
Very elegant! But the projection seems to have trouble. Please see images of the original raster and the projected raster produced with plot commands. http://r-sig-geo.2731867.n2.nabble.com/file/n6909694/rr.png http://r-sig-geo.2731867.n2.nabble.com/file/n6909694/rgeo.png - Tony Fischbach,

Re: [R-sig-Geo] Reading National Snow and Ice Data Center binary files

2011-10-19 Thread Robert J. Hijmans
Here is one approach: rgeo <- projectRaster(rr, crs="+proj=longlat +datum=WGS84") KML(rgeo, "file.kml") Best, Robert On Wed, Oct 19, 2011 at 10:00 AM, Anthony Fischbach wrote: > In my previous post I happily handled the binary National Snow and Ice Data > Center sea ice imagery and cast it int

Re: [R-sig-Geo] Reading National Snow and Ice Data Center binary files

2011-10-19 Thread Anthony Fischbach
In my previous post I happily handled the binary National Snow and Ice Data Center sea ice imagery and cast it into a GeoTiff. My next challenge is to wrap the GeoTiff into a kml overlay. Continuing the code from the previous post, I pick it up just after writing the raster object to the geoTiff.

Re: [R-sig-Geo] Reading National Snow and Ice Data Center binary files

2011-10-13 Thread Anthony Fischbach
This works: http://r-sig-geo.2731867.n2.nabble.com/file/n6890251/test.png require(sp) library(raster) library(rgdal) pixel <- 25000 #pixel dimension in meters for both x and y xMin <- -3837500 #From NSIDC: ulxmap -3837500 xMax <- xMin + (pixel*304) yMax <- 5837500 #From NSIDC: ulymap 5837500 yM

Re: [R-sig-Geo] Reading National Snow and Ice Data Center binary files

2011-10-12 Thread Robert J. Hijmans
in 1:304){ >x <- as.integer(readBin(bincon,"raw",1)) >if(x<251) result[i,j]<- x/250 >} >} >close(bincon) >image(result) > } > > >From here I would need to build t

Re: [R-sig-Geo] Reading National Snow and Ice Data Center binary files

2011-10-12 Thread Anthony S Fischbach
.. Tony Fischbach, Wildlife Biologist Walrus Research Program Alaska Science Center U.S. Geological Survey 4210 University Drive Anchorage, AK 99508-4650 Phone: 907 786-7145 FAX: 907 786-7150 afischb...@usgs.gov http://alaska.usgs.gov/science/biology/walrus From: Barry Rowlingson To: Mi

Re: [R-sig-Geo] Reading National Snow and Ice Data Center binary files

2011-10-12 Thread Michael Sumner
VRT is not designed to interrogate raw files, it's for arbitrarily specifying a raster sources from a variety of sources, including "raw" - there would be a driver and auto-recognition forze the files if GDAL knew about it. The 300 byte header is describe here so there's a nice little project for

Re: [R-sig-Geo] Reading National Snow and Ice Data Center binary files

2011-10-12 Thread Barry Rowlingson
On Wed, Oct 12, 2011 at 11:08 AM, Barry Rowlingson wrote: >  Annoyingly I don't think gdal's raw data vrt system can find out the > number of pixels across/down the raster - you have to code them into > the .vrt file. I reckon with a bit of unix (or in extremis, C code) > craftiness it would be p

Re: [R-sig-Geo] Reading National Snow and Ice Data Center binary files

2011-10-12 Thread Barry Rowlingson
On Wed, Oct 12, 2011 at 12:14 AM, Michael Sumner wrote: > Doing it manually is straightforward but laborious and error-prone, > another option is to use the GDAL VRT format - where you can formalize > all of the data type, georeferencing, projection and other metadata > (scaling and so on if nece

Re: [R-sig-Geo] Reading National Snow and Ice Data Center binary files

2011-10-11 Thread Michael Sumner
Since the format is raw binary it would be easy enough to read the raw values with ?readBin and construct a Spatial object from that. If there is sufficient metadata with the files it might already be recognized by a GDAL, and if you are lucky in turn by your build of rgdal (I've not checked the fi

[R-sig-Geo] Reading National Snow and Ice Data Center binary files

2011-10-11 Thread Anthony Fischbach
Has anyone developed scripts for converting the National Snow and Ice Data Center binary files to spatial pixel data frames? The data format is described under http://nsidc.org/data/docs/daac/nsidc0081_ssmi_nrt_seaice.gd.html#format - Tony Fischbach, Wildlife Biologist Walrus Research Program