在 GrADS 中打开多个文件

Opening multiple file in 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),它生成了 "entire grid undefined" 图。当然,有人可能会怀疑文件 "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 的回应 post

这是您建议的结果。

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-> 

有什么想法吗?

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

你的情况:

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

  • 然后你 open sst06.ctl, sst06.ctl 将是文件 2 并且要使用它你必须通过 set dfile 2 更改描述符文件。当你运行命令d sst时,GrADS将从sst06.ctl文件中提取sst的数据。

试一试。

查看第二个打开文件的 plot 调用的输出,您请求的数据超出了可用时间并且部分超出了水平域:

 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 轴还有 2 个点),因此您需要设置相对于第一个文件的约束的环境以从中绘制第二。在发出第二个 plot 调用之前,您需要将环境设置为第二个文件(或子集),但相对于第一个文件:

set lon 0 361
set lat 1 180
set t 366

或(更好)

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

通常最好在使用后关闭每个文件,除非您试图绘制两个文件的连续输出,否则会造成混淆。