Binary file from NEC-SX6

Sestak, Dr. Michael michael.sestak at FNMOC.NAVY.MIL
Fri Nov 18 10:16:11 EST 2005


A slight correction...

INQUIRE (IOLENTGH=lrec)

should be

INQUIRE (IOLENTGH=lrec) a

You need to indicate the variable you want the record length for.

I just found out about this technique.  It is a great idea for making code
more portable.

> -----Original Message-----
> From: GRADSUSR at LIST.CINECA.IT
> [mailto:GRADSUSR at LIST.CINECA.IT]On Behalf Of José Paulo Bonatti
> Sent: Friday, November 18, 2005 5:04 AM
> To: GRADSUSR at LIST.CINECA.IT
> Subject: Re: Binary file from NEC-SX6
>
>
> To avoid the problem of recl for diferent machines I use the
> following:
>
> INTEGER :: lrec
> REAL :: a(imax,jmax)
>
> INQUIRE (IOLENTGH=lrec)
> open(23,file='out.grads',status='new',
>     &              access='direct',form='unformatted',recl=lrec)
> write (23,rec=1) a
>
> This should work everywhere.
>
> Bonatti
>
> Heiner Körnich wrote:
>
> > Hi Karina,
> >
> > I used to do that and had no problem with "OPTIONS big_endian".
> >
> > One thing to be carefull with on NEC-SX6 is the record
> length in fortran
> > binary files. this has to be multiplied with 4.
> > Here is an example:
> > open(23,file='out.grads',status='new',
> >     &              access='direct',form='unformatted',recl=4*nrec)
> > nrec is the number of entries per write-command. On many
> machines you
> > only need recl=nrec.
> > But however I think, this would produce a different problem for you.
> >
> > Heiner
> >
> >
> >
> > Karina Lindberg wrote:
> >
> >> Hello!
> >>
> >> Are anyone running models on NEC-SX6 creating binary
> GRADS-files and
> >> then
> >> plotting these with GRADS on a different platform (f.ex. Linux) ?
> >>
> >> I am running a model on a NEC-SX6 creating binary
> GRADS-files which I
> >> want
> >> to look at with GRADS ran from Linux machine.
> >> The NEC-SX6 creates files with 64-bit and big-endian. The Linux
> >> machine has
> >> little-endian. I have tried to use the command
> >> OPTIONS byteswapped
> >> and/or
> >> OPTIONS big_endian
> >> in my .ctl file but with no luck.
> >>
> >> Does anyone have any experience with this or some good advise?
> >>
> >> Thanks in advance for the help.
> >> Karina Lindberg
> >> DMI
> >> Denmark
> >>
> >>
> >
> > --
> > Heiner Körnich
> > Dept. of Meteorology                    Tel:    +46 8 164333
> > Stockholms University
> > SE-106 91 Stockholm, Sweden             Email:  heiner at misu.su.se
> >
>
> --
> *****************************************************************
>                      Jose Paulo Bonatti
>            Dr. em Meteorologia - Pesquisador Titular
>         Instituto Nacional de Pesquisas Espaciais - INPE
>     Centro de Previsao de Tempo e Estudos Climaticos - CPTEC
>           Divisao de Modelagem e Desenvolvimento - DMD
>                   (http://www.cptec.inpe.br/)
>               Rodovia Presidente Dutra, km 40 SPRJ
>            12630-000 Cachoeira Paulista - SP - Brasil
>        Tel: (+55) (12) 3186.8421  Fax: (+55) (12) 3101.2835
> *****************************************************************
>



More information about the gradsusr mailing list