如何从速度数据集创建向量图? [英] how to create vectorplot from velocity dataset?

查看:102
本文介绍了如何从速度数据集创建向量图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

与我之前有关的问题有关,请根据其中的两个栅格对象计算atan2 R?.可以根据以下等式创建矢量绘图,在其中以一组箭头(例如Matlab中的颤动)显示速度(坡度)和方向(纵横比):

Related to my previous question about calculate atan2 from two raster object in R?. It's possible to create a vector plot where the speed (slope) and direction (aspect) is displayed with a set of arrows (e.g. quiver in Matlab) based on this equation:

对于速度:ws<-sqrt(u ^ 2 + v ^ 2)

for speed : ws <- sqrt(u^2+v^2)

方向:wd<-(180/pi)*(atan2(u,v))

for direction : wd <- (180/pi)*(atan2(u,v))

我的数据集样本可以下载这里

u <- raster(flname, varname = 'U')
v <- raster(flname, varname = 'V')
uv <- stack(u,v)

我使用rasterVis软件包来绘制图,但结果不适合.

I used rasterVis package to figure the plot, but the result is not fit.

library(rasterVis)
vectorplot(uv)

推荐答案

vectorplot的帮助页面:

如果'isField ='dXY'''对象'必须是具有两个图层的栅格* 代表水平和垂直分量, 分别.

If ‘isField='dXY'’ ‘object’ must be a Raster* with two layers representing the horizontal and the vertical components, respectively.

因此,解决方案是:

vectorplot(uv, isField = 'dXY')

这篇关于如何从速度数据集创建向量图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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