将坐标指定给栅格r

时间:2017-01-11 04:16:53

标签: r maps coordinates raster

我想将<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> </head> <body> <form name="CarConfigurator"> <select name="Car_make" onchange="Transmission();"> <option value=" " selected="selected">None</option> <option value="1">Audi RS6</option> <option value="2">BMW M4</option> <option value="3">Mercedes C63 AMG</option> </select> <br> <br> <select name="A_M" onchange="Transmission();"> <option value="" selected="selected">None</option> <option value="1" selected="selected">Automatic</option> <option value="2" selected="selected">Manual</option> </select> <br> <br> <select name="Color" onchange="ChoicesMade();"> <option value="" selected="selected">None</option> <option value="1">Black</option> <option value="2">Blue</option> <option value="3">Red</option> <option value="4">White</option> <option value="5">Green</option> </select> <div id="imageContainer" style="display: none;"><img src="http://buyersguide.caranddriver.com/media/assets/submodel/6873.jpg" /></div> </form> <script type="text/javascript"> function Transmission() { var Car = document.CarConfigurator.Car_make.value; var make = document.CarConfigurator.A_M.value; var color = document.CarConfigurator.Color; color.options.length = 0; if (Car == "1" && make == '1') { color.options.add(new Option('Black', '1')); color.options.add(new Option('Blue', '2')); } else if(Car == '2' && make == '1') { color.options.add(new Option('Red', '3')); color.options.add(new Option('White', '4')); } ChoicesMade(); } function ChoicesMade() { var form = document.CarConfigurator; var car = form.Car_make.value; var make = form.A_M.value; var color = form.Color.value; if(car != ' ' && make != '' && color != '') { var imageContainer = document.querySelector('#imageContainer'); imageContainer.style.display = 'block'; } } </script> </body> </html> 分配给lonlatrasterbrickr已从r文件中读取netcdf。但是,在读取数据后,元数据看起来像:

latlon

然后我将class : RasterBrick dimensions : 699, 639, 446661, 4779 (nrow, ncol, ncell, nlayers) resolution : 1, 1 (x, y) extent : 0.5, 639.5, 0.5, 699.5 (xmin, xmax, ymin, ymax) coord. ref. : NA CRS=CRS("+proj=lcc +lat_1=33 +lat_2=45 +lat_0=40 +lon_0=-97 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs") # WRF proj4") 分别读入latlon

R

您会注意到library(ncdf4) ncname <- "file.nc" ncfname <- paste(ncname, ".nc4", sep = "") dname <- "tmp" # note: tmp means temperature (not temporary) # open a NetCDF file ncin <- nc_open(ncfname, write = T) print(ncin) #--------- lon <- ncvar_get(ncin, "XLONG") nlon <- dim(lon) head(lon) lat <- ncvar_get(ncin, "XLAT", verbose = F) nlat <- dim(lat) head(lat) print(c(nlon, nlat)) [1] 639 699 639 699 nlon的尺寸与nlat相同。 我不想r

问题:

如何将导入的projectRasterlon分配给lat,以使r的{​​{1}}为extent

我试过了r,但它没有用。

感谢。

0 个答案:

没有答案