Re: Converting history tape to GrADS format


Subject: Re: Converting history tape to GrADS format
From: Ana Gusmao (angusmao@model.iag.usp.br)
Date: Tue Jan 19 1999 - 10:03:00 MST


On Mon, 18 Jan 1999, Bill Campbell wrote:

> Does anyone have a Fortran program that can read a history tape from
> mass store and write it on the Cray disk in GrADS format? I need to ftp
> the file to my local computer system for postprocessing with GrADS.

=====================================================================

      program binar
c Este programa transforma dados originalmente em
c formato ASCII para binario, legivel para o GRADS.
c Aplicavel para saida do modelo barotropico
c (i.e., 1 nivel na vertical) e 1 variavel.
c
c This program Transforms data originallly in
c format ASCII to binary that ca be read by GRADS
c
c It ca be aplyied tp the output of the barotropic model
c
c parameter (nhem=2,ndia=6,nlat=16,nlon=64,nvar=1) -> para 30 dias
...
      parameter (nhem=2,ndia=6,nlat=16,nlon=64,nvar=1)

c OBS: nhem = numero de hemisferios (i.e., 2=global)
c
c ndia = numero de arquivos gravados na integracao
c vai depender do intevalo de gravacao, pois
c a saida NAO esta sendo gravada todos os dias
c
c nlat = numero de linhas (latitudes)
c number of lines
c nlon = numero de colunas (longitudes)
c number of coluns
c nvar = numero de variaveis
c number of variables

      dimension vort(ndia,nvar,nhem,nlat,nlon)

c Definindo o arquivo que contem os dados em formato ASCII.
C open (2, file='/dataout.dat', FORM='FORMATTED')
c Definindo o arquivo de saida, contendo os dados em binario.
C open (3, file='j5_10cemres10.grd',FORM='UNFORMATTED',
C & status='UNKNOWN',ACCESS='DIRECT',recl=16*64*4)

c Definindo o arquivo que contem os dados em formato ASCII.
      Defining the archive which has the data in format ASCII
      open (2, file='Expmfc5.dat', FORM='FORMATTED')
c Definindo o arquivo de saida, contendo os dados em binario.
c DEfinig the archive which contains data in binary
c Take care whith this file it may changes from machine to machine
      open (3, file='/pmt3/angusmao/barotrop/plot/Expmfc5.grd',
     & FORM='UNFORMATTED',status='UNKNOWN',ACCESS='DIRECT',recl=16*64*4)

c Leitura de dados.
      do m=1,ndia
       do k=1,nvar
        do n=1,nhem
         read(2,*)((vort(m,k,n,i,j),j=1,nlon),i=1,nlat)
        enddo
       enddo
      enddo
      close(2)

c Escrevendo em binario.
      irec=1
      do m=1,ndia
       do k=1,nvar
        do n=1,nhem
         write(3,rec=irec)((vort(m,k,nhem+1-n,nlat+1-i,j),
     & j=1,nlon),i=1,nlat)
         irec=irec+1
        enddo
       enddo
      enddo
      close(3)

      stop
      end

  =========================================================

  Sorry for the coments in Portuguese but I just had not the
  time to fix it.

  I hope this usefull for something ...

 | | Ana Maria Gusmao | |
 | | CAIXA POSTAL 67035 | |
 | | Universidade de Sao Paulo (USP), | |
 | | DCA/IAG/USP, Brasil | |
 | | tel: (55)(011)8184661 -room | |
 | | (55)(011)8184714 -fax | |
 | | E-Mail: angusmao@iag.usp.br | |
 | | | |

  Ana

>
> Bill Campbell
> UMD Dept. of Meteorology
>
>



This archive was generated by hypermail 2b27 : Thu Jun 01 2000 - 09:26:32 MDT