No subject

Diane Stokes diane.stokes at NOAA.GOV
Tue Jun 21 17:34:10 EDT 2005


Arpita,

Regarding my 2nd comment below.  I didn't catch that you are attempting
to write the full u array (3 dimensions) in one shot to record 1.
Perhaps your compiler allows you to do that.  (My compiler doesn't).

The data file you attached in your original msg is only 167,040 bytes,
which is the size for just the one level of your array.  Yet, you say
you are able to set z to multiple levels.  Are you sure you are
attaching the same file you are reading in grads?

Regardless, if you don't correct the input part (my first comment),
you'll be writing the wrong data to your u output file.

   Diane


Diane Stokes wrote:

> Dear Arpita,
>
> You sent a couple of near repeat msgs with a slightly modified version
> of your code.  I'm responding to this msg because the version of the
> code you have here looks more complete.  Here are a couple problems I
> see in this version of your fortran code:
>
> 1) When you read the level fields, you keep reading the same record for
> each level for a variable:
>
>       do l=1,lyr
>         read(10,rec=7) ((z(i,j,l),i=1,idim),j=1,jdim)
>       enddo
>
>       do  l=1,lyr
>         read(10,rec=8)((u(i,j,l),i=1,idim),j=1,jdim)
>       enddo
>
> So, you are storing the 1st level of z data in every level of your z
> array and the 2nd level of z data in every level of your u array.
>
> You have already started incrementing variable "rec" with each single
> layer variable.  Use that variable in your read statement and continue
> to incremement the record number for each level.  Then continue
> incrementing from that point when you get to the next variable.  Eg:
>
>       do l=1,lyr
>         read(10,rec=rec) ((z(i,j,l),i=1,idim),j=1,jdim)
>         rec=rec+1
>       enddo
>
>       do  l=1,lyr
>         read(10,rec=rec) ((u(i,j,l),i=1,idim),j=1,jdim)
>         rec=rec+1
>       enddo
>
>
>
> 2) Similarly, on output, you are not incrementing the the record number:
>
>       do l=1,lyr
>       write(13,rec=1)u
>       enddo
>
> That file should have only one record in it the way your code is
> written.  Since you are able to change levels at all, I suspect earlier
> versions of your code wrote out multiple records.  Since this is a
> direct access file, you are only overwriting the first record and the
> old data remains.  It would be a good idea to delete your old file so
> you can start fresh.  Otherwise, you really don't know what is in there.
>
> Best regards,
>   Diane Stokes
>
>
>
>
>
> Arpita Mandal wrote:
>
>>
>> Dear sir
>> I hope you are fine. i could solve the earlier problem send to you. i am
>> using the program anal2.f to read the different variables of the file
>> anal.1998040100.288 .from GAME  reanalysis site.  sp, slp i could read
>> correctly and plot in grads. i
>> am having problem with the u, v,z variables. i can read the data for u,v
>> wind in binary form and wrote ctl file to plot them. in grads the
>> contours
>> are coming from 300 to 1000 interval 100. but when i am using the
>> origininal ctl file anal_125.ctl given in GAME site and plotting u,v, the
>> values are coming from -20 to 20, -30 to 30.
>> also i could not set the level.
>> when i am giving set lev 500
>> d u
>> i am getting contours from 300 to 1000,
>> the same is for all the levels.
>> kindly help me out
>> with regards
>> arpita
>>
>>
>>
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>>
>> C     Last change:  AM    5 May 2005    2:32 pm
>> C----------------------------------------------------------------------------------
>>
>> C    This is a sample fortran program to read 1.25 degree version of
>> GAME-reanalysis
>> C      Ver.1.5 global objective analysis.
>> C
>> C    Variables:
>> C      slp : Sea Level Pressure
>> C      sp  : Surface Pressure
>> C      su  : Surface U-comp
>> C      sv  : Surface V-comp
>> C      st  : Surface Temperature
>> C      ssh : Surface Specific Humidity
>> C      z   : heights (17 layers)
>> C      u   : U-comp (17 layers)
>> C      v   : V-comp (17 layers)
>> C      t   : Temperature (17 layers)
>> C      sh  : Specific Humidity (1000-300 hPa)
>> C
>> C      17 layers are as follows.   Unit is hPa.
>> C        1000 925 850 700 600 500 400 300 250 200 150 100 70 50 30 20 10
>> C
>> C   You should notice that these data were produced on the big_endian
>> machine.
>> C
>> C   by K.Takahashi, MRI/JMA on June 2002
>> C---------------------------------------------------------------------------------
>>
>> C     (idim,jdim)=(1,1) and (288,145) correspond to (0E,90N) and
>> (358.75E,90S) respectively.
>> C
>>       parameter (idim=288,jdim=145,lyr=17,lytd=8,nt=856)
>>       real *4 a(lyr)
>>       integer l
>>             real*4    slp(idim,jdim),sp(idim,jdim),su(idim,jdim),
>>      #          sv(idim,jdim),st(idim,jdim),ssh(idim,jdim),
>>      #          z(idim,jdim,lyr),u(idim,jdim,lyr),v(idim,jdim,lyr),
>>      #          t(idim,jdim,lyr),sh(idim,jdim,lytd)
>>
>>       real*4 dum(idim,jdim)
>>       open(10,file='@anal.1998040100.288',recl=idim*jdim*4,
>>      # form='unformatted', access='direct')
>>       open (11,FILE='sp.dat',recl=idim*jdim*4,access='direct')
>>       open(12,file='slp.dat',recl=idim*jdim*4,access='direct')
>>       open(13,file='u.dat',recl=idim*jdim*4,access='direct')
>>       open(14,file='v.dat',recl=idim*jdim*4,access='direct')
>>            rec=1
>>       read(10,rec=1) slp
>>       rec=rec+1
>>       read(10,rec=2) sp
>>       rec=rec+1
>>       read(10,rec=3) su
>>       rec=rec+1
>>       read(10,rec=4) sv
>>       rec=rec+1
>>       read(10,rec=5) st
>>       rec=rec+1
>>       read(10,rec=6) ssh
>> C
>>       do l=1,lyr
>>         read(10,rec=7) ((z(i,j,l),i=1,idim),j=1,jdim)
>>       enddo
>>       write(6,*) 'read z'
>> C
>>       do  l=1,lyr
>>         read(10,rec=8)((u(i,j,l),i=1,idim),j=1,jdim)
>>       enddo
>>       write(6,*) 'read u'
>> C
>>       do  l=1,lyr
>>         read(10,rec=9) ((v(i,j,l),i=1,idim),j=1,jdim)
>>       enddo
>>       write(6,*) 'read v'
>> C
>>       do  l=1,lyr
>>         read(10,rec=10) ((t(i,j,l),i=1,idim),j=1,jdim)
>>       enddo
>>       write(6,*) 'read t'
>> C
>>       do  l=1,lytd
>>         read(10,rec=11) ((sh(i,j,l),i=1,idim),j=1,jdim)
>>       enddo
>>       write(6,*) 'read sh'
>>             WRITE(11,rec=1) sp
>>       write (12,rec=1)slp
>>                 do l=1,lyr
>>       write(13,rec=1)u
>>       enddo
>>       do l=1,lyr
>>       write(14,rec=1)v
>>       enddo
>>       end
>>
>>
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> dset     ^u.dat
>> title     sample data set
>> undef    -9.99E33
>> options  byteswapped
>> options  yrev
>> xdef     288 linear   0.0  1.25
>> ydef     145 linear   -90  1.25
>> tdef     856   linear 00z01apr1998 6hr
>> zdef     17 levels 1000 925 850 700 600 500 400 300 250 200 150 100 70
>> 50 30 20 10
>> VARS       1
>> u    17  99 u-comp
>> endvars
>
>

--
Diane Stokes
Environmental Modeling Center
National Weather Service/NOAA



More information about the gradsusr mailing list