Re: NCL-FORTRAN -- flat binary

From: Erika Folova <e.folova_at_nyahnyahspammersnyahnyah>
Date: Wed Jul 10 2013 - 23:37:06 MDT

Thank you for the reply,
I did not find any mistakes in my fortran codes.

Fortran:
open(unit=1,file=xfile,form='unformatted',access='direct',
status='replace',recl=4*ny*nz*ntim)

NCL:
fo = "test.dat"
f1 = addfile ("rea-uwnd.nc", "r")
 x = f1->uwnd(:,:,{20:40})
 x1 = x(lat|:,lev|:,time|:)
 printVarSummary(x1)
 fbindirwrite(fo, x1)

however the result of calculation still contained a mistake if i compare
using the flat binary input
produced by MATLAB :

data=permute(x,[3 2 1]);
x1=reshape(data,numel(data),1);

thank you.
Erika,

On Thu, Jul 11, 2013 at 5:00 AM, Mary Haley <haley@ucar.edu> wrote:

> Erika,
>
> What does your Fortran code look like? If you wrote a float array in NCL
> that was nlev x nlat x nlon (10 x 64 x 128), then this is how you might
> read it in with Fortran:
>
> parameter (nlev=10, nlat=64, nlon=128)
> real x(nlon,nlat,nlev)
>
> open (unit=1,
> $ file='dummy_file.bin',
> $ form='unformatted',
> $ access='direct',
> $ recl=nlev*nlat*nlon*4)
>
> c read in each row as a single record
>
>
> read (1,rec=1) x
>
>
> On Jul 10, 2013, at 9:49 AM, Erika Folova <e.folova@gmail.com> wrote:
>
> Hallo,
> I am testing to produce flat binary using NCL dan Matlab,
> the size of file resulting from both of these tools are equal xxxx.byte.
> But, when once i used the binary files as for the fortran input
> (form='unformatted',access='direct')
> the result of the calculation are mistaken from the binary produced by
> NCL. I am using function * fbindirwrite.*
>
> How can I produce the flat binary as the input of fortran code.
> Thank you
>
> Erika,
>
> --
> Here is my code:
>
> fo = "test.dat"
> f1 = addfile ("rea-uwnd.nc", "r")
> x = f1->uwnd(:,:,{20:40}) ;NH
> printVarSummary(data)
> x1 = x(lat|:,lev|:,time|:)
> printVarSummary(x1)
> fbindirwrite(fo, x)
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Jul 10 23:37:20 2013

This archive was generated by hypermail 2.1.8 : Fri Jul 12 2013 - 16:37:39 MDT