Re: writing fortran equivalent binary file using python

2013-11-14 Thread Antoon Pardon
Op 14-11-13 01:53, Sudheer Joseph schreef: > Hi, > I need to write a binary file exactly as written by fortran code > below to be read by another code which is part of a model which is not > advisable to edit.I would like to use python for this purpose as python has > mode flexibility a

Re: writing fortran equivalent binary file using python

2013-11-14 Thread Sudheer Joseph
Thank you, But it wont allow to write it in unformatted way so that the fortran code can read with open(11,file="input.bin") read(11) IWI,JWI,XFIN,YFIN,DXIN,DYIN,NREC,WDAY with best regards, sudheer On Thu, Nov 14, 2013 at 7:48 PM, Oscar Benjamin wrote: > On 14 November

Re: writing fortran equivalent binary file using python

2013-11-14 Thread Oscar Benjamin
On 14 November 2013 00:53, Sudheer Joseph wrote: > My trial code with Python (data is read from file here) > > from netCDF4 import Dataset as nc > import numpy as np > XFIN=0.0,YFIN=-90.0,NREC=1461,DXIN=0.5;DYIN=0.5 > TITLE="NCMRWF 6HOURLY FORCING MKS" > nf=nc('ncmrwf_uv.nc') > ncv=nf.variables.ke

Re: writing fortran equivalent binary file using python

2013-11-13 Thread David Froger
Hi Sudheer, Fortan binary format is not portable, and it's hard to work with it with different langages, compilers, architectures... In you're Python code, you also use NetCDF, which solve all these problems. I would suggest to use only NetCDF files in both Python and Fortran code. (So never use

writing fortran equivalent binary file using python

2013-11-13 Thread Sudheer Joseph
Hi, I need to write a binary file exactly as written by fortran code below to be read by another code which is part of a model which is not advisable to edit.I would like to use python for this purpose as python has mode flexibility and easy coding methods. character(40) :: TITLE="