嘿,
在过去的几个月中,我收到了多个请求,以提供有关在同时使用年度最大值系列和部分持续时间系列时如何创建组合收益水平图的信息。我有 由于我打算提出一个不错的ggplot解决方案,因此推迟了提供这些脚本的工作时间。
幸运的是,我只需要为会议海报创建这些合并的回传水平图中的另一个,我真的 shuddered at the thought of digging up my old R scripts I had used for that occasion. Even though it immediately turned out that my fear was not clearly not unfounded, for lack of time I have not been able to rework this behemoth of code (which is based on plot.fevd()
from the extRemes
package)to make it as tidy as initially intended. However, I think I have at least been able to restructure the basic plotting function rlplot()
in a way that it might be understandable to other users. I might completely rework this function by building it from scratch one day, since the current version is an extremely verbose 和 somewhat very hacky solution. But it works, 和 that should be sufficient for now.
由于该功能有些繁琐,因此我通过我们提供了该功能 GitLab存储库.
附带的是一个简短的应用示例,基于我已经在该主题的其他帖子中使用的相同降水数据集。运行代码所需的功能是 read_ehyd()
和 rlplot()
.
# load required packages library(extRemes) library(xts) # get 数据 from eHYD ehyd_url <- "http://ehyd.gv.at/eHYD/MessstellenExtraData/nlv?id=107540&file=2" precipitation_xts <- read_ehyd(ehyd_url) precipitation_xts <- na.omit(precipitation_xts) # derive AMS for maximum precipitation ams <- apply.yearly(precipitation_xts, max) ams <- as.vector(ams) # annual maxima series gev_mle <- fevd(ams, method = "MLE",类型="GEV") gev_lmom <- fevd(ams, method = "Lmoments",类型="GEV") gev_gmle <- fevd(ams, method = "GMLE",类型="GEV") gev_bpe <- fevd(ams, method = "贝叶斯",类型="GEV") # partial duration series u <- 40 precipitation_xts <- as.vector(precipitation_xts) gp_mle <-fevd(precipitation_xts,method ="MLE",类型="GP",阈值= u) gp_lmom <-fevd(precipitation_xts,method ="Lmoments",类型="GP",阈值= u) gp_gmle <-fevd(precipitation_xts,method ="GMLE",类型="GP",阈值= u) gp_bpe <-fevd(precipitation_xts,method ="贝叶斯",类型="GP",阈值= u) main_title= paste("Return Level Plot of Daily Precipitation Totals at Bärnkopf") rlplot(GEV_MLE = gev_mle, GEV_LMOM = gev_lmom, GEV_GMLE = gev_gmle, GEV_BPE = gev_bpe, GP_MLE = gp_mle, GP_LMOM = gp_lmom, GP_GMLE = gp_gmle, GP_BPE = gp_bpe, plottitle= main_title, unit = "[mm/d]", y_seq = seq(0, 180, 10), do_ci = FALSE)
6条留言
您可以在这篇文章中发表评论。
您好Matthias,
很好写。我是GIS的新手,并且拥有未分类的Lidar点数据。我必须将它们分为地面和植被类别。我该怎么办?
阿图尔·舒克拉(Atul Shukla) 3年前
你好
这实际上是一个完全不同的主题。
通过简单的互联网搜索,您可以找到有关此主题的有趣教程和博客文章,例如: http://amsantac.co/blog/en/2015/11/28/classification-r.html
马蒂亚斯 3年前
你好
感谢您的有趣博客
当我运行代码时,出现此错误。
>#从eHYD获取数据
>ehyd_url降水量_xts降水量_xts
>#派生AMS以实现最大降水
> ams ams
>#年度最大值系列
>gev_mle gev_lmom gev_gmle gev_bpe
>#部分持续时间系列
>u降水量_xts gp_mle gp_lmom gp_gmle gp_bpe<-fevd(precipitation_xts,method ="Bayesian", type="GP", threshold=u)
is.element("formula", class(x)) :
目的'precipitation_xts' not found
能告诉我如何解决吗?
穆斯塔法 1年前
你好
apparently, there is no 目的called
rainfall_xts
. Have you correctly specified this object?问候,
马蒂亚斯
马蒂亚斯 1年前
您好Matthias,
我已经尝试过Rstudio中的脚本,但是它们无法正常工作。您能在这方面提供帮助吗?
特梅斯根 2年前
你好
to be honest, my code for the combined return level plot is quite a mess. Its basically just a really ugly hack of the extRemes function
plot.fevd()
to produce the desired output once. It might be easier to simply use ggplot to construct the plot from scratch.除此之外,请提供问题的更具体说明。否则,很难提供任何帮助。
马蒂亚斯 1年前
发表回复