[Thread Prev][Thread Next][Index]

Re: [ferret_users] Unable to write to the next vertical level



Hi Sulagna,

Two things:
  1. The syntax "let sst = temp[d=1,g=tgrid]+0*z[gz=znum,z=1]" isn't what you want for this purpose.  Yes, this syntax attaches the coordinate Z=1 to the definition of SST.  But when you later issue the command "let sst = temp[g=tgrid]+0*z[gz=znum,z=2]" you are replacing the first definition with this new one.   What you want instead is a sequence of definitions using the "IF" syntax on the order of this:
    • LET ensemble_sst = IF K[gz=znum] EQ 1 THEN temp[d=1] ELSE sst2
    • LET sst2 = IF K[gz=znum] EQ 2 THEN temp[d=2] ELSE sst3
    • LET sst3 = IF K[gz=znum] EQ 3 THEN temp[d=3] ELSE sst4
    • ...
  2. It looks as if you are using K=1 and Z=1 interchangeably.   That's OK if the axis znum is simply the coordinates 1, 2, 3, ....  But if so you can define it as simply as "DEFINE AXIS/Z=1:8:1 znum" 
    - Steve

On 1/25/2011 8:17 AM, sray@xxxxxxxxxxxxxx wrote:
Hi Ferreters,

   I have been trying to work with 8 ensemble outputs, which I have only at the surface level.
I added a z-axis to the data using a pseudo-dataset which has existing vertical levels.
Now my problem is though the vertical axis is created andI couldi write at k=1, but 
I could not write data from k=2:8. 
   I am attaching my script. Does any of you have some suggestions?

use Ensemble_1.cdf  ! Ensemble run 1
use test.cdf        ! A dataset which has z-axis (znum)

! Now add the z-axis (znum) to the existing grid

def grid/x=I/y=J263_289/z=znum/t=TIME tgrid  ! I, J263_289,TIME are axes names in Ensemble_1.cdf

!Create a new variable having a zaxis

let sst = temp[d=1,g=tgrid]+0*z[gz=znum,z=1]
set var/title="Ensembles"/units=ensemble sst

!save the new variable as k=1 in a file having 8 vertical levels
save/file=Outfile.cdf/KLIMITS=1:8/k=1/clobber sst
cancel data/all

! Similarly with the 2nd ensemble member
use Ensemble_2.cdf
let sst = temp[g=tgrid]+0*z[gz=znum,z=2]
save/append/file=Outfile.cdf/k=2 sst

!Though the Outfile.cdf has 8 vertical levels yet it has data only in k=1,
!but do not write the data of Ensemble_2.cdf in k=2

Thanking you,
Sulagna
Graduate student
Department of Oceanography
Physical Oceanography
Texas A&M University

[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement