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

Anthony Fischbach afischbach at usgs.gov
Wed Oct 19 22:13:48 CEST 2011


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/DATASETS/nsidc0081_nrt_nasateam_seaice/north/nt_20110101_f17_nrt_n.bin'
con <- file(filename, 'rb')
x <- readBin(con, "raw", 300)
x <- readBin(con,"int", size=1, signed=FALSE, 150000)
close(con)
# no need for newx
x[x<251] <- (x[x<251])/250 #scale ice cover to 1
x[x==251] <- NA # set all non-ice to NA
x[x==0] <- NA    # set all 0 ice to NA
x[x>251] <- NA # set all non-ice pixels to NA
	
rr <- setValues(r, x) # place result in raster
#plot(rr)
rr <- writeRaster(rr, 'geoTiffFile.tif', overwrite=TRUE)

x[] <- extract(rr, xypole, method='bilinear')

Warning message:
In x[] <- extract(rr, xypole, method = "bilinear") :
  number of items to replace is not a multiple of replacement length


-----
Tony Fischbach, Wildlife Biologist
Walrus Research Program
Alaska Science Center
U.S. Geological Survey
4210 University Drive
Anchorage, AK 99508-4650

AFischbach at usgs.gov
http://alaska.usgs.gov/science/biology/walrus
--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Reading-National-Snow-and-Ice-Data-Center-binary-files-tp6882737p6910361.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list