grads

Opening multiple file in GrADS


Hopefully this question is simple and easy enough to be solved.

I am having a trouble in opening the second file in GrADS. Suppose I have two files. The first is "sst06.ctl" and the second is "sst07.ctl", and within each files, there is only one variable named "sst"

Below are what happened when I tried opening both of them together:

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

Basically, I cannot plot the second file (sst07.ctl) and it produced "entire grid undefined" plot. Of course one might suspect that there is something wrong with the file "sst07.ctl". However if I only open "sst07.ctl" file alone, there is no problem as it can be successfullty contoured as it was with the "sst06.ctl" file previously. Below is the message:

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 

The same error happened if I change the order of file opening (sst07.ctl first). The "sst06.ctl" file that is opened as the second file would result in an entire grid undefined message for the latter opened file. Below is the message:

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 

Anybody willing to help me with this? Thanks before!

EDIT1: Response to Ngoan Tran's post

This is the result of your suggestion.

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

Any ideas?


Solution

  • Looking at the output from the plot call from your second opened file you are requesting data beyond the available time and partially outside the horizontal domain:

     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 
    

    In GrADS the environment axes (X, Y, Z, T, E) are set relative to the first file you open. In your case the time and part of the horizontal domain are not the same (the x axis in the 2nd file has 2 more points) in both of your files, so you need to set the environment relative to the first file's constraints to plot from the second. Before you issue your second plot call you need to set the environment to (or a subset of) the second file but relative to the first file:

    set lon 0 361
    set lat 1 180
    set t 366
    

    or (better)

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

    It is usually better to close each file after use unless you are trying to plot a continuous output from both files as it can get confusing.