<div dir="ltr"><div>Dave is correct.<br><br>FYI only:<br><br>; only one type per write<br><br> fbinrecwrite(filName, -1, str) ; write out all values<br> fbinrecwrite(filName, -1, ix)<br> fbinrecwrite(filName, -1, rx)<br> fbinrecwrite(filName, -1, con)<br><br>---<br>ASCII<br> <a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/write_table.shtml">http://www.ncl.ucar.edu/Document/Functions/Built-in/write_table.shtml</a><br><br>----<br><br><br>NCL's WRAPIT understands f77 syntax only...... *NOT TESTED*<br><br><a href="http://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclExtend.shtml#WRAPIT">http://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclExtend.shtml#WRAPIT</a><br><br><br>%> cat > raj.f<br>C NCLFORTSTART<br> subroutine rajwrite(fname, nw, str, ix, rx, con)<br> implicit none<br> integer nw, ix(nw) ! INPUT<br> character*(*) fname, str(nw)<br> real rx(nw), con<br>C NCLEND<br> integer n, nunit ! LOCAL<br><br> nunit = 31<br> open(nunit, file=fname)<br> do n=1,nw<br> write(nunit) str(n), ix(n), rx(n), con<br> end do<br><br> return<br> end<br><br>%> WRAPIT raj.f<br><br>%> ncl RAJ.ncl<br>=====<br><br>RAJ.ncl has<br><br>external MYRAJ "./raj.so"<br><br> filName = "./FOO.bin"<br></div> system("/bin/rm -f "+filName) ; remove any preexisting file<br><br><div> str = ...<br> ix = ...<br> rx = ...<br> con = ...<br><br> nw = dimsizes(ix)<br> MYRAJ::rajwrite(filName, nw, str, ix, rx, con)<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Mar 27, 2017 at 5:11 PM, Dave Allured - NOAA Affiliate <span dir="ltr"><<a href="mailto:dave.allured@noaa.gov" target="_blank">dave.allured@noaa.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Raj,<br><br>The short answer is no. The function fbinrecwrite does not support mixed data types, and this is the only function that can write Fortran sequential unformatted records without a horrible kludge. I recommend either text or Netcdf formats for what you want to do.<div><br></div><div>You could look into calling a Fortran output subroutine from NCL, but that would be more complicated than text or Netcdf formats.<span class="HOEnZb"><font color="#888888"><br></font></span><div><span class="HOEnZb"><font color="#888888"><div><br></div></font></span><div><div><span class="HOEnZb"><font color="#888888"><div>--Dave</div></font></span><div><div class="h5"><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Mar 27, 2017 at 2:42 PM, Raj K. Rai <span dir="ltr"><<a href="mailto:rajkrai@gmail.com" target="_blank">rajkrai@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>Hi, </div><div><br></div><div><font color="#000000" face="Times New Roman" size="3"></font><p style="margin:0in 0in 0pt"><font color="#000000" face="Calibri" size="3">I am trying to write string, integer, and real values using ncl as in the following fortran format. </font></p><font color="#000000" face="Times New Roman" size="3"></font><p style="margin:0in 0in 0pt"><font color="#000000" face="Calibri" size="3">do j=1,5</font></p><font color="#000000" face="Times New Roman" size="3"></font><p style="margin:0in 0in 0pt"><font color="#000000" face="Calibri" size="3">write(unit) stringx(j), intx(j),realx(j), 23.2</font></p><font color="#000000" face="Times New Roman" size="3"></font><p style="margin:0in 0in 0pt"><font color="#000000" face="Calibri" size="3">end do</font></p><font color="#000000" face="Times New Roman" size="3"></font><p style="margin:0in 0in 0pt"><font color="#000000" face="Calibri" size="3"> </font></p><font color="#000000" face="Times New Roman" size="3"></font><p style="margin:0in 0in 0pt"><font color="#000000" face="Calibri" size="3">I saw there is fbinrecwrite(fout,-1,stringx(1<wbr>)) and so on for each value. Is there anyway we can write the data in ncl as in fortran. </font></p><p style="margin:0in 0in 0pt"><br></p><p style="margin:0in 0in 0pt"><font color="#000000" face="Calibri" size="3">Thanks,</font></p><p style="margin:0in 0in 0pt"><font color="#000000" face="Calibri" size="3">Raj</font></p></div></div></blockquote></div></div></div></div></div></div></div></div></div>
<br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>