繁体   English   中英

创建LAT -90至90和-180至90的网格

[英]Creating a grid of LAT -90 to 90 and -180 to 90

我想创建一个网格,我使用了这个:

reso = 0.25
xs <- seq(-180, 180, by=reso)
ys <- seq(-90, 90, by=reso)
grd <- expand.grid(
  x=xs,
  y=ys,
  presence=0
)
head(grd)

这给了我,

    x   y presence
1 -180.00 -90        0
2 -179.75 -90        0
3 -179.50 -90        0
4 -179.25 -90        0
5 -179.00 -90        0
6 -178.75 -90        0

但是我想要这个

x             y        presence
-179.875    -89.875     0
-179.875    -89.625     0
-179.875    -89.375     0
-179.875    -89.125     0
-179.875    -88.875     0
-179.875    -88.625     0
-179.875    -88.375     0
-179.875    -88.125     0
-179.875    -87.875     0
-179.875    -87.625     0
-179.875    -87.375     0
-179.875    -87.125     0
-179.875    -86.875     0
-179.875    -86.625     0
-179.875    -86.375     0

Please note how the x and y increases.
reso <- 0.25
xs <- seq(-179.875, 179.875, reso)
ys <- seq(-89.875, 89.875, reso)
grd <- expand.grid(y=ys, x=xs, presence=0)
grd <- grd[,c(2,1,3)]
head(grd)
#          x       y presence
# 1 -179.875 -89.875        0
# 2 -179.875 -89.625        0
# 3 -179.875 -89.375        0
# 4 -179.875 -89.125        0
# 5 -179.875 -88.875        0
# 6 -179.875 -88.625        0

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM