在GrADS中打开多个文件

时间:2017-02-26 02:43:23

标签: grads

希望这个问题简单易行,可以解决。

我在打开GrADS中的第二个文件时遇到了麻烦。假设我有两个文件。第一个是“sst06.ctl”,第二个是“sst07.ctl”,在每个文件中,只有一个名为“sst”的变量

以下是我尝试同时打开它们时发生的事情:

ga-> open sst06.ctl
Scanning description file:  sst06.ctl
Data file rcp4.5/y2006/sst is open as file 1
LON set to 0 360 
LAT set to -89.5 89.5 
LEV set to 1000 1000 
Time values set: 2006:1:1:0 2006:1:1:0 
E set to 1 1 
ga-> q file
File 1 : 
  Descriptor: sst06.ctl
  Binary: rcp4.5/y2006/sst
  Type = Gridded
  Xsize = 360  Ysize = 180  Zsize = 37  Tsize = 365  Esize = 1
  Number of Variables = 1
     sst  0  99  sea surface temperature [K]
ga-> d sst
Contouring: -0 to 30 interval 3 
ga-> c
ga-> open sst07.ctl 
Scanning description file:  sst07.ctl
Data file rcp4.5/y2007/sst is open as file 2
ga-> d sst.2
Data Request Warning:  Request is completely outside file limits
  Entire grid contents are set to missing data 
  Grid limits of file:     X = 1 360  Y = 1 180  Z = 1 37  T = 1 365  E = 1 1 
  Grid limits of request:  X = 0 361  Y = 1 180  Z = 1 1  T = -364 -364  E = 1 1 
  Warning issued for variable = sst.2
Cannot contour grid - all undefined values

基本上,我无法绘制第二个文件(sst07.ctl)并且它生成了“整个网格未定义”图。当然有人可能怀疑文件“sst07.ctl”有问题。但是,如果我只打开“sst07.ctl”文件,那么就没有任何问题,因为它可以像之前的“sst06.ctl”文件一样成功。以下是信息:

ga-> reinit
No hardcopy metafile open
All files closed; all defined objects released;
All GrADS attributes have been reinitialized
ga-> open sst07.ctl 
Scanning description file:  sst07.ctl
Data file rcp4.5/y2007/sst is open as file 1
LON set to 0 360 
LAT set to -89.5 89.5 
LEV set to 1000 1000 
Time values set: 2007:1:1:0 2007:1:1:0 
E set to 1 1 
ga-> q file
File 1 : 
  Descriptor: sst07.ctl
  Binary: rcp4.5/y2007/sst
  Type = Gridded
  Xsize = 360  Ysize = 180  Zsize = 37  Tsize = 365  Esize = 1
  Number of Variables = 1
     sst  0  99  sea surface temperature [K]
ga-> d sst
Contouring: -0 to 30 interval 3 

如果我更改文件打开的顺序(先是sst07.ctl),则会发生同样的错误。作为第二个文件打开的“sst06.ctl”文件将导致后一个打开文件的整个网格未定义消息。以下是信息:

ga-> reinit
ga-> open sst07.ctl 
Scanning description file:  sst07.ctl
Data file rcp4.5/y2007/sst is open as file 1
LON set to 0 360 
LAT set to -89.5 89.5 
LEV set to 1000 1000 
Time values set: 2007:1:1:0 2007:1:1:0 
E set to 1 1 
ga-> q file
File 1 : 
  Descriptor: sst07.ctl
  Binary: rcp4.5/y2007/sst
  Type = Gridded
  Xsize = 360  Ysize = 180  Zsize = 37  Tsize = 365  Esize = 1
  Number of Variables = 1
     sst  0  99  sea surface temperature [K]
ga-> d sst
Contouring: -0 to 30 interval 3 
ga-> c
ga-> open sst06.ctl 
Scanning description file:  sst06.ctl
Data file rcp4.5/y2006/sst is open as file 2
ga-> q file
File 1 : 
  Descriptor: sst07.ctl
  Binary: rcp4.5/y2007/sst
  Type = Gridded
  Xsize = 360  Ysize = 180  Zsize = 37  Tsize = 365  Esize = 1
  Number of Variables = 1
     sst  0  99  sea surface temperature [K]
ga-> d sst.2
Data Request Warning:  Request is completely outside file limits
  Entire grid contents are set to missing data 
  Grid limits of file:     X = 1 360  Y = 1 180  Z = 1 37  T = 1 365  E = 1 1 
  Grid limits of request:  X = 0 361  Y = 1 180  Z = 1 1  T = 366 366  E = 1 1 
  Warning issued for variable = sst.2
Cannot contour grid - all undefined values 

有人愿意帮我这个吗?先谢谢!

EDIT1:对Ngoan Tran的帖子的反应

这是你的建议的结果。

ga-> reinit
No hardcopy metafile open
All files closed; all defined objects released;
All GrADS attributes have been reinitialized
ga-> open sst07.ctl 
Scanning description file:  sst07.ctl
Data file rcp4.5/y2007/sst is open as file 1
LON set to 0 360 
LAT set to -89.5 89.5 
LEV set to 1000 1000 
Time values set: 2007:1:1:0 2007:1:1:0 
E set to 1 1 
ga-> d sst
Contouring: -0 to 30 interval 3 
ga-> open sst06.ctl
Scanning description file:  sst06.ctl
Data file rcp4.5/y2006/sst is open as file 2
ga-> set dfile 2
Default file set to: rcp4.5/y2006/sst 
ga-> d sst
Data Request Warning:  Request is completely outside file limits
  Entire grid contents are set to missing data 
  Grid limits of file:     X = 1 360  Y = 1 180  Z = 1 37  T = 1 365  E = 1 1 
  Grid limits of request:  X = 0 361  Y = 1 180  Z = 1 1  T = 366 366  E = 1 1 
  Warning issued for variable = sst
Cannot contour grid - all undefined values 
ga-> 

有什么想法吗?

2 个答案:

答案 0 :(得分:0)

为了同时处理多个文件,您必须使用set dfile <file-number>更改描述符文件。 file-number是您打开的文件的顺序。

在你的情况下:

  • reinit(重置所有配置)后open sst07.ctlsst07.ctl为文件1,将作为默认值使用。当您运行命令d sst时,GrADS将从sst文件中提取sst07.ctl的数据。

  • 然后您open sst06.ctlsst06.ctl将成为文件2并使用它,您必须按set dfile 2更改描述符文件。当您运行命令d sst时,GrADS将从sst文件中提取sst06.ctl的数据。

试试吧。

答案 1 :(得分:0)

查看来自第二个打开文件的绘图调用的输出,您要求的数据超出可用时间,部分位于水平域之外:

 Grid limits of file:     X = 1 360  Y = 1 180  Z = 1 37  T = 1 365  E = 1 1 
 Grid limits of request:  X = **0 361**  Y = 1 180  Z = 1 1  T = **366 366**  E = 1 1 

在GrADS中,环境轴(X,Y,Z,T,E)相对于您打开的第一个文件进行设置。在您的情况下,两个文件中的水平域的时间和部分不相同(第二个文件中的x轴有两个点),因此您需要设置相对于第一个文件的环境&#39; s从第二个绘制的约束。在发出第二个绘图调用之前,您需要将环境设置为第二个文件(或其子集),但相对于第一个文件:

set lon 0 361
set lat 1 180
set t 366

或(更好)

set time 00z01Jan2006;* <--- I've guessed at data dates here

通常最好在使用后关闭每个文件,除非您尝试从两个文件中绘制连续输出,因为它会让人感到困惑。