从R中的Radolan数据制作GPS纬度/经度查找表,将立体投影转换为R中的纬度长网格 [英] Make a GPS Lat/Long Lookup Table from Radolan Data in R, convert stereographic projection into lat long grid in R

查看:43
本文介绍了从R中的Radolan数据制作GPS纬度/经度查找表,将立体投影转换为R中的纬度长网格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用此示例在R中加载Radolan数据

  class:RasterLayer尺寸:900,900,810000(nrow,ncol,ncell)分辨率:1,1(x,y)范围:-523.4622,376.5378,-4658.645,-3758.645(xmin,xmax,ymin,ymax)协调.参考:+ proj = stere + lat_0 = 90 + lat_ts = 90 + lon_0 = 10 + k = 0.93301270189 + x_0 = 0 + y_0 = 0 + a = 6370040 + b = 6370040 + to_meter = 1000 + no_defs数据源:在内存中名称:层值:0,2500(最小值,最大值) 

我很想为GPS数据制作纬度/经度查找表.我如何将这个rb对象转换为纬度/经度网格?

谢谢!

解决方案

rb 对象是栅格.如果要使用非投影地理坐标(wgs84),则只需重新投影:

 库(rgdal)图书馆(光栅)图书馆(地图)#添加国家/地区限制#纬度/经度非投影坐标的栅格rb_wgs84<-projectRaster(rb,crs ="+ proj = longlat + datum = WGS84 + no_defs")#在绘图中显示栅格情节(rb_wgs84)maps :: map("world",add = TRUE) 

 #获取数据框中的坐标和值xyz<-data.frame(坐标(rb_wgs84),z =值(rb_wgs84)) 

这是您要寻找的吗?

i´m using this example to load Radolan Data in R

Example, RADOLAN Specification

 binary_filepath <- paste0("raa01-rw_10000-1708091950-dwd---bin")
    header_end <- regexpr("\003", readLines(binary_filepath, 1))

    rb_stream <- file(binary_filepath, "rb")
    skip_temp <- readBin(rb_stream, "raw", n = header_end, endian = "little")
    rb_data <- readBin(rb_stream, "raw", size = 1, n = 900*900*2, endian = "big")
    rb_data <- rawToBits(rb_data)

    rbi <- lapply(seq(0, 900*900-1, 1), function(x){
      sum(as.integer(rb_data[(x*16+1):(x*16+12)]) * 2**seq(0, 11, 1))
    })
    rbi <- unlist(rbi)
    rbi[1:16]
    rb <- raster(t(matrix(rbi, ncol = 900, nrow = 900)))
    rb <- flip(rb, "y")
    radolan_proj <- 
      CRS("+proj=stere +lat_0=90 +lat_ts=90 +lon_0=10 +k=0.93301270189 +x_0=0 +y_0=0 +a=6370040 +b=6370040 +to_meter=1000 +no_defs")
    extent(rb) <- extent(-523.4622, 376.5378, -4658.645, -3758.645)
    projection(rb) <- radolan_proj

RADOLAN Data is a stereographic grid. Each point in this grid is 1 KM Apart.

class       : RasterLayer 
dimensions  : 900, 900, 810000  (nrow, ncol, ncell)
resolution  : 1, 1  (x, y)
extent      : -523.4622, 376.5378, -4658.645, -3758.645  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=stere +lat_0=90 +lat_ts=90 +lon_0=10 +k=0.93301270189 +x_0=0 +y_0=0 +a=6370040 +b=6370040 +to_meter=1000 +no_defs 
data source : in memory
names       : layer 
values      : 0, 2500  (min, max)

i wold like to make a Lat/Long lookup table for GPS Data. How could i convert this rb Object to Lat/Long Grid?

Thank you!

解决方案

This rb object is a raster. If you want it with non-projected geographical coordinates (wgs84), you only need to reproject it:

library(rgdal)
library(raster)
library(maps) # to add country limits 

# raster with Lat/Long non projected coordinates
rb_wgs84 <- projectRaster(rb, crs = "+proj=longlat +datum=WGS84 +no_defs")
# Show the raster in a plot
plot(rb_wgs84)
maps::map("world", add = TRUE)

# Get coordinates and values in a dataframe
xyz <- data.frame(coordinates(rb_wgs84), z = values(rb_wgs84))

Is this what you are looking for ?

这篇关于从R中的Radolan数据制作GPS纬度/经度查找表,将立体投影转换为R中的纬度长网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆