RE: [ncl-talk] (no subject)

From: Tummuri, Spandana <spandana.tummuri_at_nyahnyahspammersnyahnyah>
Date: Thu, 5 Jul 2007 17:14:51 -0500

Hello Dennis,
 
Thanks for the reply.
 
Sorry for the confusion over hybrid to constant pressure levels and time variables instead of time-steps. I am new to all this and still learning the terminology.
 
I will work on the suggestions.
 
Spandana.
 
Research Assistant,
Texas Tech University,
2717, 3rd St. # 315
Lubbock, Texas-79415
806-741-0901 (Home)
806-470-7732 (Cell).

________________________________

From: Dennis Shea [mailto:shea_at_ucar.edu]
Sent: Thu 7/5/2007 4:38 PM
To: Tummuri, Spandana
Cc: ncl-talk_at_ucar.edu
Subject: Re: (no subject)

Tummuri, Spandana wrote:
> Hello Everyone,
>
> I am using the attached fortran stub and the NCL program to convert Q, U, V, T, Z3 variables from pressure levels to sigma levels.
No, it is not.
This program is converting hybrid levels to constant pressure levels.

> When I run the program, it generates an output file with a weird name "FILE:H<?>-<aa>*-" instead of putting a proper year, month and time. Any idea how I can make the program write the proper output file name?
>
Well, this is not an NCL issue. The name is created in the fortran
subroutine.
I think you have to debug this on your end.

[1] To verify that ds and dt are correct upon entry in the fortran:
            print *, "ds=",ds , " dt=", dt
[2] After: b=dtt(1:4)//'-'//dtt(5:6)//'-'//dtt(7:8)//'_'//hh
            print *, "b=", b
[3] The fortran open statement has:
            file='FILE:'//b
       This concatenates the characters [string] FILE: to the "b"
variable contents.

       Some systems just do not allow this. .... specifically a colon [
: ] in a file name.
    

>
> Also, I did not write this program so I am not sure about couple of things:
>
> When I run the program for variable T and then run the program for variable U, the output for variable U is added to the same file with output for variable T. Is that how the output file be written? One file with T, U, V, Z3, Q output in it?
>
Well, you should talk to the person who wrote the program.

The

        open(1,file='FILE:'//b,form='unformatted',access='append',
     $ status='unknown')

says to append new data. This means it adds data to the end.
Please see a fortran text and look at the file IO section.

>
> My input file has 124 time variables. Instead of generating 124 different output files, it only generates one output file. Can anyone explain me why?
>
It has 124 time steps ... not variables.

Yes ... the "append" on the open statement.

 do j = 0, ntime-1
    do i = 0,dimsizes(interp_var)-1
      datesec1=datesec(j)
      date1=date(j)
      
SUBS::test3(i+1,lev_array(i,j,:,:,:),pnew,doubletofloat(lat),doubletofloat(lon),datesec1,date1)
    end do
  end do

The above loops over all 124 time steps.

If you want 124 files with one time step each

        open(1,file='FILE:'//b,form='unformatted',status='unknown')

        do 50 i=18,1,-1
                write(1)3
                write(1)c,1.,field(n),units(n),desc(n),p(i),256,128,0
                write(1)-88.9277353523,0.,1.40625,1.40625
50 write(1)((x(jj,ii,i),jj=1,256),ii=1,128)

        close (1)

>
> Thanks in advance.
>
> Spandana Tummuri
>
> Research Assistant,
> Texas Tech University,
> 2717, 3rd St. # 315
> Lubbock, Texas-79415
> 806-741-0901 (Home)
> 806-470-7732 (Cell).
>
> ------------------------------------------------------------------------
>
> C NCLFORTSTART
> subroutine output_lev2 (n,x,p,lat,lon,ds,dt)
> real x(256,128,18),p(18),lat(128),lon(256)
> integer ds,dt,h,m,s,n
> C NCLEND
> character desc(5)*46,field(5)*9,units(5)*25
> character*8 dtt
> character*4 a
> character*2 hh,mm,ss
> character*13 b
> character*24 c
> data field/'U ','V ','T ',
> & 'HGT ','SPECHUMD'/
> C 1 2 3 4
> C 12345678901234567890123456789012345678901234567890
> data desc/'U ',
> & 'V ',
> & 'Temperature ',
> & 'Height ',
> & 'Specific Humidity '/
> data units/' m s{-1} ',
> & ' m s{-1} ',
> & ' K ',
> & ' m ',
> & ' kg kg{-1} '/
>
>
>
> 5 format(i8)
> h=ds/3600
> xh=1.*h
> m=(ds-h*3600)/60
> s=ds-h*3600-m*60
> write(a,10)h
> 10 format(i2)
> hh=a(1:2)
> if(hh(1:1).eq.' ') hh(1:1)='0'
> write(a,10)m
> mm=a(1:2)
> if(mm(1:1).eq.' ') mm(1:1)='0'
> write(a,10)s
> ss=a(1:2)
> if(ss(1:1).eq.' ') ss(1:1)='0'
> b=dtt(1:4)//'-'//dtt(5:6)//'-'//dtt(7:8)//'_'//hh
> c=b//':'//mm//':'//ss
> * write(0,*)c,xh
> open(1,file='FILE:'//b,form='unformatted',access='append',
> $ status='unknown')
> write(0,*)'open OK'
> do 50 i=18,1,-1
> write(1)3
> write(1)c,1.,field(n),units(n),desc(n),p(i),256,128,0
> write(1)-88.9277353523,0.,1.40625,1.40625
> 50 write(1)((x(jj,ii,i),jj=1,256),ii=1,128)
> return
> end
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>

--
======================================================
Dennis J. Shea                  tel: 303-497-1361    |
P.O. Box 3000                   fax: 303-497-1333    |
Climate Analysis Section                             |
Climate & Global Dynamics Div.                       |
National Center for Atmospheric Research             |
Boulder, CO  80307                                   |
USA                        email: shea 'at' ucar.edu |
======================================================
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Jul 05 2007 - 16:14:51 MDT

This archive was generated by hypermail 2.2.0 : Wed Jul 11 2007 - 08:55:54 MDT