<div dir="ltr">You can pass strings to and from fortran subroutines. <br><div><br>============= test fortran subroutine: str.f<br><div>C NCLFORTSTART<br>      subroutine teststr(strin,strout)<br>      implicit none<br>      character*(*) strin, strout<br>C NCLEND<br><br>      print *,&quot;fortran: strin=&quot;,strin<br><br>      strout = strin // strin         ! create return string<br><br>      print *, &quot;fortran: strout=&quot;, strout<br><br>      return<br>      end<br></div><div>=========================Create str.so<br></div><div>%&gt; WRAPIT str.f<br><br></div><div>There will be some warning messages<br></div><div><br>============== NCL script: str.ncl<br><div>external STRING &quot;./str.so&quot;<br><br>  stri = &quot;Foo&quot;                          ; input<br>  stro = new( 1, &quot;string&quot;)        ; reserve space for return string<br><br>  STRING::teststr(stri, stro)<br><br>  print(&quot;after fortran: stro=&quot;+stro)<br><br>=============<br></div><div>%&gt; ncl str.ncl<br><br></div><div>=============output<br><br> fortran: strin=Foo<br> fortran: strout=FooFoo <br>(0)    after fortran: stro=FooFoo <br><br><br></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 2, 2017 at 6:13 AM, Barry Lynn <span dir="ltr">&lt;<a href="mailto:barry.h.lynn@gmail.com" target="_blank">barry.h.lynn@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi:<div><br></div><div>As you may have read before, you can&#39;t pass string variables through the subroutine call using WRAPIT.  Perhaps you could pass a single character, but I am not sure.</div><div><br></div><div>There is a simple way around this.</div><div><br></div><div>One can produce a csv file through a simple write statement in the *.f program.  Then, open the file in ncl.</div><div><br></div><div>A one line output (here).</div><div><br></div><div>







<p class="m_8107626477234004170gmail-p1"><span class="m_8107626477234004170gmail-s1"><span class="m_8107626477234004170gmail-Apple-converted-space"> </span>Tel Aviv University <span class="m_8107626477234004170gmail-Apple-converted-space">          </span>,<span class="m_8107626477234004170gmail-Apple-converted-space">  </span>Mostly Sunny <span class="m_8107626477234004170gmail-Apple-converted-space">      </span>,</span></p></div><div><br></div><div>Then, you can read it in the ncl program this way.</div><div><br></div><div>







<p class="m_8107626477234004170gmail-p1"><span class="m_8107626477234004170gmail-s1"><span class="m_8107626477234004170gmail-Apple-converted-space">  </span>asc_file = &quot;weather_type.csv&quot;</span></p>
<p class="m_8107626477234004170gmail-p1"><span class="m_8107626477234004170gmail-s1"><span class="m_8107626477234004170gmail-Apple-converted-space">  </span>lines = asciiread(asc_file,-1,&quot;string&quot;<wbr>)</span></p>
<p class="m_8107626477234004170gmail-p1"><span class="m_8107626477234004170gmail-s1"><span class="m_8107626477234004170gmail-Apple-converted-space">  </span>print(lines)</span></p>
<p class="m_8107626477234004170gmail-p1"><span class="m_8107626477234004170gmail-s1"><span class="m_8107626477234004170gmail-Apple-converted-space">  </span>delim = &quot;,&quot;</span></p>
<p class="m_8107626477234004170gmail-p1"><span class="m_8107626477234004170gmail-s1"><span class="m_8107626477234004170gmail-Apple-converted-space">  </span>station<span class="m_8107626477234004170gmail-Apple-converted-space">    </span>= str_get_field(lines,1,delim)</span></p>
<p class="m_8107626477234004170gmail-p1"><span class="m_8107626477234004170gmail-s1"><span class="m_8107626477234004170gmail-Apple-converted-space">  </span>weather_type<span class="m_8107626477234004170gmail-Apple-converted-space">    </span>= str_get_field(lines,2,delim)</span></p>
<p class="m_8107626477234004170gmail-p1"><span class="m_8107626477234004170gmail-s1"><span class="m_8107626477234004170gmail-Apple-converted-space">  </span>print(&quot;station = &quot; + station)</span></p>
<p class="m_8107626477234004170gmail-p1"><span class="m_8107626477234004170gmail-s1"><span class="m_8107626477234004170gmail-Apple-converted-space">  </span>print(&quot;weather_type = &quot; + weather_type)</span></p><p class="m_8107626477234004170gmail-p1"><br></p><p class="m_8107626477234004170gmail-p1">Just in case you want to read in a real value, you can do the following.</p><p class="m_8107626477234004170gmail-p1"><span class="m_8107626477234004170gmail-s1">







</span></p><p class="m_8107626477234004170gmail-p1"><span class="m_8107626477234004170gmail-s1">Latitude = tofloat(str_get_field(lines,2,<wbr>delim))   </span></p><p class="m_8107626477234004170gmail-p1"><span class="m_8107626477234004170gmail-s1">)</span></p><p class="m_8107626477234004170gmail-p1"><span class="m_8107626477234004170gmail-s1"><br></span></p><div><br></div>-- <br><div class="m_8107626477234004170gmail_signature"><div dir="ltr">Barry H. Lynn, Ph.D<div><div>Senior Lecturer,</div><div><div><span style="color:rgb(136,136,136)">The Institute of the Earth Science, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">The Hebrew University of Jerusalem, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Givat Ram, Jerusalem 91904, Israel </span><br style="color:rgb(136,136,136)"></div><span style="color:rgb(136,136,136)">Tel: 972 547 231 170</span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Fax: (972)-25662581</span></div></div><div><span style="color:rgb(136,136,136)"><br></span></div><div>C.E.O, Weather It Is, LTD<br>Weather and Climate Focus<br><a href="http://weather-it-is.com" target="_blank">http://weather-it-is.com</a><br>Jerusalem, Israel<br>Local: 02 930 9525<br>Cell: 054 7 231 170<br>Int-IS: x972 2 930 9525<br>US <a href="tel:(914)%20432-3108" value="+19144323108" target="_blank">914 432 3108</a><br></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>