小编Sno*_*rog的帖子

在R中的泰勒图中增加偏差

我正在使用包中的taylor.diagram功能,plotrix例如

obs = runif(100,1,100)
mod1 = runif(100,1,100)
mod2 = runif(100,1,100) 
mod3 = runif(100,1,100) 
taylor.diagram(obs,mod1)
taylor.diagram(obs,mod2,add=TRUE)
taylor.diagram(obs,mod3,add=TRUE)
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

在传统的泰勒图中没有偏见,但在他的论文中(Taylor,2001,KE总结模型性能的多个方面,在单个图中Taylor JGR,106,7183-7192)泰勒说

"Although the diagram has been designed to convey information about centered pattern differences it is also possible to indicate differences in overall means (i.e., the bias). This can be done on the diagram by attaching to each plotted point a line segment drawn at a right angle to the straight line defined by the point and the reference …

r plotrix

2
推荐指数
1
解决办法
1863
查看次数

在fortran中读取csv文件中的日期,时间和数据

我正在尝试读取看起来像这样的数据集

DATE,TIME,val
1/1/2001,1:00:00,0
Run Code Online (Sandbox Code Playgroud)

与该计划

program main
implicit none

real :: val
character(len=8) :: date
character(len=7) :: time
open(1,file='data.csv',status='old')
read(1,*) ! header
read(1,fmt=100)date,time,val
100 FORMAT (A,1x,A,1x,F3.1)
end program
Run Code Online (Sandbox Code Playgroud)

如果日期和时间总是有8或7个字符,但它们不是例如,这一切都很好

 4/21/2001,19:00:00,0
Run Code Online (Sandbox Code Playgroud)

我应该如何声明fortran的格式来读取示例中的日期,时间,val行?

谢谢

fortran

1
推荐指数
1
解决办法
4702
查看次数

在 fortran 中读写二进制文件 (GrADS)

我正在运行一个模型并将模型输出写入二进制文件(GrADS *gra 文件),例如:

integer,parameter :: nvar =3 ,& !number of variables to be written to file
                     nx=10,ny=10,& !number of girdboxes in lat & long
                     nt = 5
integer :: it, & ! loop counter
           irec  ! Record number
real :: var1(nx,ny), var2(nx,ny),var3(nx,ny)

OPEN(30,file='Outfile.gra',action='write',form='unformatted',access='direct',&
    recl=4*nVar*nx*ny,status='replace')
!loop over timesteps
it  = 1, nt
    irec = irec + 1
    WRITE(1,rec=irec) Var1(:,:),Var2(:,:),Var3(:,:)
enddo
Run Code Online (Sandbox Code Playgroud)

该文件可以在 GrADS 中读取,*ctl 文件如下所示

dset /mypath/Outfile.gra
title MyTitle
options little_endian
xdef 10 linear 1 1
ydef 10 linear 1 1
zdef …
Run Code Online (Sandbox Code Playgroud)

fortran grads

1
推荐指数
1
解决办法
6422
查看次数

具有预定义统计数据的多个箱图,使用r中的类似格子的图形

我有一个看起来像这样的数据集

 VegType    87MIN   87MAX   87Q25   87Q50   87Q75   96MIN   96MAX   96Q25   96Q50     96Q75 00MIN   00MAX   00Q25   00Q50   00Q75
 1          0.02    0.32    0.11    0.12    0.13    0.02    0.26    0.08    0.09    0.10    0.02    0.28    0.10    0.11    0.12
 2          0.02    0.45    0.12    0.13    0.13    0.02    0.20    0.09    0.10    0.11    0.02    0.26    0.11    0.12    0.12
 3          0.02    0.29    0.13    0.14    0.14    0.02    0.27    0.11    0.11    0.12    0.02    0.26    0.12    0.13    0.13
 4          0.02    0.41    0.13    0.13    0.14    0.02    0.58    0.10    0.11    0.12    0.02    0.34    0.12    0.13 …
Run Code Online (Sandbox Code Playgroud)

r ggplot2 lattice boxplot

1
推荐指数
1
解决办法
1087
查看次数

使用 RnetCDF 打开和读取多个 netcdf 文件

使用 R,我试图打开单个文件夹(例如 20 个文件)中的所有 netcdf 文件,读取单个变量,并创建一个结合所有文件值的单个 data.frame。我一直在使用 RnetCDF 来读取 netcdf 文件。对于单个文件,我使用以下命令读取变量:

library('RNetCDF')
nc = open.nc('file.nc')
lw = var.get.nc(nc,'LWdown',start=c(414,315,1),count=c(1,1,240))
Run Code Online (Sandbox Code Playgroud)

其中 414 和 315 是我想要提取的值的经度和纬度,240 是时间步数。

我找到了这个线程,它解释了如何打开多个文件。在此之后,我设法使用以下方法打开文件:

 filenames= list.files('/MY_FOLDER/',pattern='*.nc',full.names=TRUE)
 ldf = lapply(filenames,open.nc)
Run Code Online (Sandbox Code Playgroud)

但现在我被困住了。我试过

  var1= lapply(ldf, var.get.nc(ldf,'LWdown',start=c(414,315,1),count=c(1,1,240)))
Run Code Online (Sandbox Code Playgroud)

但它不起作用。增加的复杂性是每个 nc 文件都有不同数量的时间步长。所以我有两个问题:

1:如何打开所有文件,读取每个文件中的变量并将所有值合并到一个数据框中?2:如何将最后一个维度设置count为所有文件都不同?

r netcdf

1
推荐指数
1
解决办法
7710
查看次数

标签 统计

r ×3

fortran ×2

boxplot ×1

ggplot2 ×1

grads ×1

lattice ×1

netcdf ×1

plotrix ×1