<div dir="ltr">Xiaoming,<div><br></div><div>Okay, it looks like your actual fortran program is writing more records than what you originally showed. But you are having a problem with the very first record #0.</div><div><br></div><div>Try this in NCL:</div><div><br></div><div> <span style="font-size:14px">htest = fbinrecread ("./test.dat", 0, -1, "float")</span></div><div><span style="font-size:14px"> print ("Size of htest = " + diimsizes (htest))</span></div><div><br></div><div>The output of the print statement will show you the actual number of values in the first fortran record. With your numbers, this value should be 401 x 401 = 160801. If it matches, then <span style="font-size:14px">jde and ide in your original NCL command may have values other than 401.</span></div><div><span style="font-size:14px"><br></span></div><div><span style="font-size:14px">If the htest size is different, then record #0 in the file is not what you expected. To debug </span>this further, I would need to look at the binary start of the file with these two system commands:<br><br> od -Ad -i -v -N48 test.dat</div><div> od -Ad -tx1 -v -N48 test.dat</div><div><br></div><div>Also, please keep all replies on the NCL user list.</div><div><br>--Dave<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 3, 2015 at 11:44 AM, xiaoming Hu <span dir="ltr"><<a href="mailto:yuanfangcan@hotmail.com" target="_blank">yuanfangcan@hotmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div dir="ltr">Dave<br><br>Here is the relevant info:<br> ids=1;ide=401<br> jds=1;jde=401<br>-rw-r--r-- 1 xhu caps 617M Mar 3 11:11 test.dat<br><br>real,dimension(:,:),allocatable :: u,v,h<br><br>NCAR Command Language Version 5.2.1<br><br>/usr/local/intel/fc/9.1.040/bin/ifort<br><br>Linux <a href="http://cirrus.caps.ou.edu" target="_blank">cirrus.caps.ou.edu</a> 2.6.18-348.12.1.el5 #1 SMP Mon Jul 1 17:54:12 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux<br><br>I do have close(10) in the fortran code<br><br>Thanks a lot!<br>Xiaoming <br><div><hr>Date: Tue, 3 Mar 2015 11:21:46 -0700<br>Subject: Re: [ncl-talk] how to read a fortran binary file using fbinrecread<br>From: <a href="mailto:dave.allured@noaa.gov" target="_blank">dave.allured@noaa.gov</a><br>To: <a href="mailto:yuanfangcan@hotmail.com" target="_blank">yuanfangcan@hotmail.com</a><br>CC: <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br><br><div dir="ltr">Xiaoming,<br><div><br></div><div>Please tell us the following debug information.</div><div><br></div><div>* The exact values of <span style="font-size:14px">ids, ide, j</span><span style="font-size:14px">ds jde.</span></div><div><span style="font-size:14px">* The exact size of the file, in bytes, from "ls -l".</span></div><div><span style="font-size:14px">* The fortran data type of the array "h" in the fortran program (real, double, or what?)</span></div><div><span style="font-size:14px"><br></span></div><div><span style="font-size:14px">* NCL version number.</span></div><div><span style="font-size:14px">* Fortran compiler name and version number.</span><br></div><div><span style="font-size:14px">* The output from system command "uname -a".</span></div><div><span style="font-size:14px"><br></span></div><div><span style="font-size:14px">Also, just a guess, try adding close (10) at the end of your fortran program, and see if that helps.</span></div><div><span style="font-size:14px"><br></span></div><div><span style="font-size:14px">--Dave</span></div></div><div><br><div>On Tue, Mar 3, 2015 at 11:09 AM, xiaoming Hu <span dir="ltr"><<a href="mailto:yuanfangcan@hotmail.com" target="_blank">yuanfangcan@hotmail.com</a>></span> wrote:<br><blockquote style="border-left:1px #ccc solid;padding-left:1ex">
<div><div dir="ltr">Hello <br><br>In fortran I have:<br> ids=1;<br> open(10,file='./test.dat',form='unformatted',access='sequential')<br> write(10)((h(i,j),i=ids,ide),j=jds,jde)<br><br><br>In ncl I tried to use<br> h = fbinrecread ("./test.dat",0, (/jde,ide/),"float")<br>to read<br><br>But I got <br>warning:fbinrecread: size specified is greater than record size, filling with missing values<br>fatal:fbinrecread: an error occurred reading the requested record. Something is wrong with the FORTRAN binary file.<br>fatal:Execute: Error occurred at or near line 11 in file conwomap_2.ncl<br><br>Can anybody help? <br><br>Thanks a lot!<span><font color="#888888"><br><br>Xiaoming <br>                                            </font></span></div></div>
<br>_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div></div>                                            </div></div>
</blockquote></div><br></div>