[MITgcm-support] output files from the FLT package to netcdf

Camille Mazoyer mazoyer at univ-tln.fr
Tue May 2 10:46:23 EDT 2017


Hi Yu-Kun,

Thanks a lot, you were right! if I specified CONVERT="BIG_ENDIAN" while 
opening the binary file, it works! :

open(1,file=dataFname,status="old",form="unformatted",access="direct",recl=ilen,CONVERT="BIG_ENDIAN")

Now, I will play with this netcdf. If I have more questions, I will ask 
the mailing group again.

Thanks again,

Camille


Le 02/05/2017 à 14:24, 钱钰坤 a écrit :
> Hi Camille,
>
> I'm pretty sure the strange value of tmp is due to the incorrect 
> big_endian/little_endian format that you have specified in the fortran 
> program.  I'm not familiar with fortran but I know you can alter the 
> format using compiler argument.  For matlab, you can change the format as:
>
> fid=fopen('data.dat','r','ieee-le'); % for little-endian
> fid=fopen('data.dat','r','ieee-be'); % for big-endian
>
> If you are not clear which one is used, just try both format and 
> you'll get the right numbers for only one format.
>
> ------------------
> Best regards
>
> Yu-Kun Qian (钱钰坤)
> Center for Monsoon and Environment Research
> Department of Atmospheric Sciences
> School of Environmental Science and Engineering
> Sun Yat-sen University
> No. 135 Xingang West Road, Haizhu District
> Guangzhou, 510275, P.R. China
> Tel; 020-84115227
> Email: qianyk at mail3.sysu.edu.cn <mailto:qianyk at mail2.sysu.edu.cn>
> ------------------ 原始邮件 ------------------
> *发件人:* "Camille Mazoyer"<mazoyer at univ-tln.fr>;
> *发送时间:* 2017年5月2日(星期二) 下午5:59
> *收件人:* "mitgcm-support"<mitgcm-support at mitgcm.org>;
> *主题:* [MITgcm-support] output files from the FLT package to netcdf
> Dear all,
>
> I would like to compare read drifters trajectories (surface buoys) to my
> simulation. For that, I see that I can use flt package.  So I start with
> the flt example and try to understand how it works.
>
> I would like to transform outputs float_trajectories.* from the example,
> to netcdf files. I see that they are two ways to do that:
>
> - cvfloat.F90 from the extra directory of flt example
>
> - a python toolbox named floater
>
> I'm trying both manners, and I encounter problems with both ... For
> floater toolbox, I'm asking for help in they github url. For
> cvfloat.f90, I would like to know if the script should work with the
> example without doing nothing? Is it the last version? flt output are in
> float32 (according to the meta files), so I had to change some double
> precision into single precision in cvfloat.F90, and I change a flag for
> the grid:
>
>   For the flt example, theses lines:
>
>    logical :: usingSphericalPolarGrid=.true.
>
>    real*8, dimension(:), allocatable ::  tmp
>
>    ilen=IMAX*8
>
> become :
>
>    logical :: usingSphericalPolarGrid=.false.
>
>     real*4, dimension(:), allocatable ::  tmp
>
>    ilen=IMAX*4
>
>
> Now, the error for me is when I try to read the first record tmp. If I
> write tmp at line
>
>   tmp:  7.1838967E-41  3.4893733E-41  1.7646863E-38 3.4893733E-41
> 2.3048557E-41
>    4.3986759E-42  2.8789677E-41  0.0000000E+00 0.0000000E+00 0.0000000E+00
>    0.0000000E+00  0.0000000E+00  0.0000000E+00
>
> Where, according to the matlab script read_flt_traj.m,  I should read
> 100,  3600, 10800, 3600, 3, 140, 13, 0, 0,  0,  0, 0, 0
>
> I am stuck here, so any advices is welcome,
>
> Thank you very much for your help,
>
> Camille
>
> -- 
> ------------------------------------------
> Camille Mazoyer
> Phd Student
> Mediterranean Institute of Oceanography (MIO)
> Institut de Mathématiques de Toulon (IMATH)
> Université de TOULON
> Bat X - CS 60584
> 83041 TOULON cedex 9
> France
> tel: +33.4.94.14.24.50
> Email: mazoyer at univ-tln.fr
> http://mio.pytheas.univ-amu.fr/
> http://imath.fr/
>
>
> _______________________________________________
> MITgcm-support mailing list
> MITgcm-support at mitgcm.org
> http://mitgcm.org/mailman/listinfo/mitgcm-support
>
>
> _______________________________________________
> MITgcm-support mailing list
> MITgcm-support at mitgcm.org
> http://mitgcm.org/mailman/listinfo/mitgcm-support

-- 
------------------------------------------
Camille Mazoyer
Phd Student
Mediterranean Institute of Oceanography (MIO)
Institut de Mathématiques de Toulon (IMATH)
Université de TOULON
Bat X - CS 60584
83041 TOULON cedex 9
France
tel: +33.4.94.14.24.50
Email: mazoyer at univ-tln.fr
http://mio.pytheas.univ-amu.fr/
http://imath.fr/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mitgcm.org/pipermail/mitgcm-support/attachments/20170502/a686e05d/attachment-0001.htm>


More information about the MITgcm-support mailing list