<div dir="ltr">​<div class="gmail_chip gmail_drive_chip" style="width:396px;height:18px;max-height:18px;background-color:#f5f5f5;padding:5px;color:#222;font-family:arial;font-style:normal;font-weight:bold;font-size:13px;border:1px solid #ddd;line-height:1"><a href="https://drive.google.com/file/d/0B3E3GjUeKpBdWnhCNDhyV1JfalE/view?usp=drive_web" target="_blank" style="display:inline-block;max-width:366px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-decoration:none;padding:1px 0;border:none"><img style="vertical-align: bottom; border: none;" src="https://ssl.gstatic.com/docs/doclist/images/icon_10_generic_list.png"> <span dir="ltr" style="color:#15c;text-decoration:none;vertical-align:bottom">eilat.txt</span></a><img src="//ssl.gstatic.com/ui/v1/icons/common/x_8px.png" style="display:none; opacity: 0.55; cursor: pointer; float: right; position: relative; top: -1px; "></div>​​<div class="gmail_chip gmail_drive_chip" style="width:396px;height:18px;max-height:18px;background-color:rgb(245,245,245);padding:5px;color:rgb(34,34,34);font-family:arial;font-style:normal;font-weight:bold;font-size:13px;border:1px solid rgb(221,221,221);line-height:1"><a href="https://drive.google.com/file/d/0B3E3GjUeKpBdY2FjVWMyLTRlSTg/view?usp=drive_web" target="_blank" style="display:inline-block;max-width:366px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-decoration:none;padding:1px 0;border:none"><img style="vertical-align: bottom; border: none;" src="https://ssl.gstatic.com/docs/doclist/images/icon_10_generic_list.png"> <span dir="ltr" style="color:rgb(17,85,204);text-decoration:none;vertical-align:bottom">get_ij.f</span></a><img src="//ssl.gstatic.com/ui/v1/icons/common/x_8px.png" style="opacity: 0.55; cursor: pointer; float: right; position: relative; top: -1px; display: none;"></div>​​<div class="gmail_chip gmail_drive_chip" style="width:396px;height:18px;max-height:18px;background-color:rgb(245,245,245);padding:5px;color:rgb(34,34,34);font-family:arial;font-style:normal;font-weight:bold;font-size:13px;border:1px solid rgb(221,221,221);line-height:1"><a href="https://drive.google.com/file/d/0B3E3GjUeKpBdaWxiSGFOdzF5RVU/view?usp=drive_web" target="_blank" style="display:inline-block;max-width:366px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-decoration:none;padding:1px 0;border:none"><img style="vertical-align: bottom; border: none;" src="https://ssl.gstatic.com/docs/doclist/images/icon_10_generic_list.png"> <span dir="ltr" style="color:rgb(17,85,204);text-decoration:none;vertical-align:bottom">get_ij_land.f</span></a><img src="//ssl.gstatic.com/ui/v1/icons/common/x_8px.png" style="opacity: 0.55; cursor: pointer; float: right; position: relative; top: -1px; display: none;"></div>​​<div class="gmail_chip gmail_drive_chip" style="width:396px;height:18px;max-height:18px;background-color:rgb(245,245,245);padding:5px;color:rgb(34,34,34);font-family:arial;font-style:normal;font-weight:bold;font-size:13px;border:1px solid rgb(221,221,221);line-height:1"><a href="https://drive.google.com/file/d/0B3E3GjUeKpBdZXBXNnl6QU5DQWM/view?usp=drive_web" target="_blank" style="display:inline-block;max-width:366px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-decoration:none;padding:1px 0;border:none"><img style="vertical-align: bottom; border: none;" src="https://ssl.gstatic.com/docs/doclist/images/icon_10_generic_list.png"> <span dir="ltr" style="color:rgb(17,85,204);text-decoration:none;vertical-align:bottom">jerusalem.txt</span></a><img src="//ssl.gstatic.com/ui/v1/icons/common/x_8px.png" style="opacity: 0.55; cursor: pointer; float: right; position: relative; top: -1px; display: none;"></div>​​<div class="gmail_chip gmail_drive_chip" style="width:396px;height:18px;max-height:18px;background-color:rgb(245,245,245);padding:5px;color:rgb(34,34,34);font-family:arial;font-style:normal;font-weight:bold;font-size:13px;border:1px solid rgb(221,221,221);line-height:1"><a href="https://drive.google.com/file/d/0B3E3GjUeKpBdeDIyUWZ2c05Yd28/view?usp=drive_web" target="_blank" style="display:inline-block;max-width:366px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-decoration:none;padding:1px 0;border:none"><img style="vertical-align: bottom; border: none;" src="https://ssl.gstatic.com/docs/doclist/images/icon_10_generic_list.png"> <span dir="ltr" style="color:rgb(17,85,204);text-decoration:none;vertical-align:bottom">katzrin.txt</span></a><img src="//ssl.gstatic.com/ui/v1/icons/common/x_8px.png" style="opacity: 0.55; cursor: pointer; float: right; position: relative; top: -1px; display: none;"></div>​​<div class="gmail_chip gmail_drive_chip" style="width:396px;height:18px;max-height:18px;background-color:#f5f5f5;padding:5px;color:#222;font-family:arial;font-style:normal;font-weight:bold;font-size:13px;border:1px solid #ddd;line-height:1"><a href="https://drive.google.com/file/d/0B3E3GjUeKpBdQURiNTR5UHlsckk/view?usp=drive_web" target="_blank" style="display:inline-block;max-width:366px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-decoration:none;padding:1px 0;border:none"><img style="vertical-align: bottom; border: none;" src="https://ssl.gstatic.com/docs/doclist/images/icon_10_generic_list.png"> <span dir="ltr" style="color:#15c;text-decoration:none;vertical-align:bottom">map_sta_data.ncl</span></a><img src="//ssl.gstatic.com/ui/v1/icons/common/x_8px.png" style="display:none; opacity: 0.55; cursor: pointer; float: right; position: relative; top: -1px; "></div>​​<div class="gmail_chip gmail_drive_chip" style="width:396px;height:18px;max-height:18px;background-color:#f5f5f5;padding:5px;color:#222;font-family:arial;font-style:normal;font-weight:bold;font-size:13px;border:1px solid #ddd;line-height:1"><a href="https://drive.google.com/file/d/0B3E3GjUeKpBdSXkxcjdTR2d0U2s/view?usp=drive_web" target="_blank" style="display:inline-block;max-width:366px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-decoration:none;padding:1px 0;border:none"><img style="vertical-align: bottom; border: none;" src="https://ssl.gstatic.com/docs/doclist/images/icon_10_generic_list.png"> <span dir="ltr" style="color:#15c;text-decoration:none;vertical-align:bottom">read_sta_data.f</span></a><img src="//ssl.gstatic.com/ui/v1/icons/common/x_8px.png" style="display:none; opacity: 0.55; cursor: pointer; float: right; position: relative; top: -1px; "></div>​​<div class="gmail_chip gmail_drive_chip" style="width:396px;height:18px;max-height:18px;background-color:rgb(245,245,245);padding:5px;color:rgb(34,34,34);font-family:arial;font-style:normal;font-weight:bold;font-size:13px;border:1px solid rgb(221,221,221);line-height:1"><a href="https://drive.google.com/file/d/0B3E3GjUeKpBdSGhoMVd3aW9hejA/view?usp=drive_web" target="_blank" style="display:inline-block;max-width:366px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-decoration:none;padding:1px 0;border:none"><img style="vertical-align: bottom; border: none;" src="https://ssl.gstatic.com/docs/doclist/images/icon_10_generic_list.png"> <span dir="ltr" style="color:rgb(17,85,204);text-decoration:none;vertical-align:bottom">shlomi.txt</span></a><img src="//ssl.gstatic.com/ui/v1/icons/common/x_8px.png" style="opacity: 0.55; cursor: pointer; float: right; position: relative; top: -1px; display: none;"></div>​​<div class="gmail_chip gmail_drive_chip" style="width:396px;height:18px;max-height:18px;background-color:#f5f5f5;padding:5px;color:#222;font-family:arial;font-style:normal;font-weight:bold;font-size:13px;border:1px solid #ddd;line-height:1"><a href="https://drive.google.com/file/d/0B3E3GjUeKpBdZ2RpY01RWjZnTkE/view?usp=drive_web" target="_blank" style="display:inline-block;max-width:366px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-decoration:none;padding:1px 0;border:none"><img style="vertical-align: bottom; border: none;" src="https://ssl.gstatic.com/docs/doclist/images/icon_10_generic_list.png"> <span dir="ltr" style="color:#15c;text-decoration:none;vertical-align:bottom">tel_aviv.txt</span></a><img src="//ssl.gstatic.com/ui/v1/icons/common/x_8px.png" style="display:none; opacity: 0.55; cursor: pointer; float: right; position: relative; top: -1px; "></div>​​<div class="gmail_chip gmail_drive_chip" style="width:396px;height:18px;max-height:18px;background-color:#f5f5f5;padding:5px;color:#222;font-family:arial;font-style:normal;font-weight:bold;font-size:13px;border:1px solid #ddd;line-height:1"><a href="https://drive.google.com/file/d/0B3E3GjUeKpBdNmhpUHo4R2lCNTQ/view?usp=drive_web" target="_blank" style="display:inline-block;max-width:366px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-decoration:none;padding:1px 0;border:none"><img style="vertical-align: bottom; border: none;" src="https://ssl.gstatic.com/docs/doclist/images/icon_10_generic_list.png"> <span dir="ltr" style="color:#15c;text-decoration:none;vertical-align:bottom">wrfinput_d02</span></a><img src="//ssl.gstatic.com/ui/v1/icons/common/x_8px.png" style="display:none; opacity: 0.55; cursor: pointer; float: right; position: relative; top: -1px; "></div>​Hi Dennis:<div><br></div><div>Thank you for looking at this.</div><div><br></div><div>I am running into some problems.</div><div><br></div><div>1) I can define my variables within the *.f program as you indicated, but each of them must have n_files elements.  WRAPIT read_sta_data.f compiles.</div><div><br></div><div>2) If I don&#39;t try to return to my ncl program, then I can write all array element of  these variables to a csv file, but they are truncated to seven elements.  Both the name and weather type no longer write out more than seven elements.</div><div><br></div><div>3) If I try to return to the NCL program (remove the &quot;stop&quot; at the end of the *.f program), I get a memory error.</div><div><br></div><div>4) I am not sure the cause of 2 (when I had defined the station and weather_type variables as *40, I had no problem writing complete variable to the weather_type.csv file (which I shouldn&#39;t need any more, since we&#39;re suppose to pass the variables back).</div><div><br></div><div>5) Regarding the memory error, I am probably not defining string correctly for an array.</div><div><br></div><div>Here is part of the memory error.  Programs, files attached.</div><div><br></div><div>







<p class="gmail-p1"><span class="gmail-s1">*** Error in `ncl&#39;: double free or corruption (out): 0x000000000c8637a0 ***</span></p>
<p class="gmail-p1"><span class="gmail-s1">======= Backtrace: =========</span></p>
<p class="gmail-p1"><span class="gmail-s1">/usr/lib64/libc.so.6(+0x7d1fd)[0x2ba528ed61fd]</span></p>
<p class="gmail-p1"><span class="gmail-s1">./read_sta_data.so(read_sta_data_+0x4fb3)[0x2ba52b48e60c]</span></p>
<p class="gmail-p1"><span class="gmail-s1">./read_sta_data.so(read_sta_data_W+0xb3c)[0x2ba52b488d04]</span></p>
<p class="gmail-p1"><span class="gmail-s1">ncl(CallINTRINSIC_PROC_CALL+0x43)[0x8a282f]</span></p>
<p class="gmail-p1"><span class="gmail-s1">ncl(_NclExecute+0x419)[0x8aa685]</span></p>
<p class="gmail-p1"><span class="gmail-s1">ncl(yyparse+0x82c)[0x772f2e]</span></p>
<p class="gmail-p1"><span class="gmail-s1">ncl(NclDriver+0xc19)[0x76eec7]</span></p>
<p class="gmail-p1"><span class="gmail-s1">ncl(main+0x9)[0x76b4bd]</span></p>
<p class="gmail-p1"><span class="gmail-s1">/usr/lib64/libc.so.6(__libc_start_main+0xf5)[0x2ba528e7aaf5]</span></p>
<p class="gmail-p1"><span class="gmail-s1">ncl[0x76b3f9]</span></p></div><div><br></div><div>Thanks.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 2, 2017 at 5:27 PM, Dennis Shea <span dir="ltr">&lt;<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</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">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>=========================<wbr>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"><div><div class="h5">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></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><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_-6508571065059995901m_8107626477234004170gmail-p1"><span class="m_-6508571065059995901m_8107626477234004170gmail-s1"><span class="m_-6508571065059995901m_8107626477234004170gmail-Apple-converted-space"> </span>Tel Aviv University <span class="m_-6508571065059995901m_8107626477234004170gmail-Apple-converted-space">          </span>,<span class="m_-6508571065059995901m_8107626477234004170gmail-Apple-converted-space">  </span>Mostly Sunny <span class="m_-6508571065059995901m_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_-6508571065059995901m_8107626477234004170gmail-p1"><span class="m_-6508571065059995901m_8107626477234004170gmail-s1"><span class="m_-6508571065059995901m_8107626477234004170gmail-Apple-converted-space">  </span>asc_file = &quot;weather_type.csv&quot;</span></p>
<p class="m_-6508571065059995901m_8107626477234004170gmail-p1"><span class="m_-6508571065059995901m_8107626477234004170gmail-s1"><span class="m_-6508571065059995901m_8107626477234004170gmail-Apple-converted-space">  </span>lines = asciiread(asc_file,-1,&quot;string&quot;<wbr>)</span></p>
<p class="m_-6508571065059995901m_8107626477234004170gmail-p1"><span class="m_-6508571065059995901m_8107626477234004170gmail-s1"><span class="m_-6508571065059995901m_8107626477234004170gmail-Apple-converted-space">  </span>print(lines)</span></p>
<p class="m_-6508571065059995901m_8107626477234004170gmail-p1"><span class="m_-6508571065059995901m_8107626477234004170gmail-s1"><span class="m_-6508571065059995901m_8107626477234004170gmail-Apple-converted-space">  </span>delim = &quot;,&quot;</span></p>
<p class="m_-6508571065059995901m_8107626477234004170gmail-p1"><span class="m_-6508571065059995901m_8107626477234004170gmail-s1"><span class="m_-6508571065059995901m_8107626477234004170gmail-Apple-converted-space">  </span>station<span class="m_-6508571065059995901m_8107626477234004170gmail-Apple-converted-space">    </span>= str_get_field(lines,1,delim)</span></p>
<p class="m_-6508571065059995901m_8107626477234004170gmail-p1"><span class="m_-6508571065059995901m_8107626477234004170gmail-s1"><span class="m_-6508571065059995901m_8107626477234004170gmail-Apple-converted-space">  </span>weather_type<span class="m_-6508571065059995901m_8107626477234004170gmail-Apple-converted-space">    </span>= str_get_field(lines,2,delim)</span></p>
<p class="m_-6508571065059995901m_8107626477234004170gmail-p1"><span class="m_-6508571065059995901m_8107626477234004170gmail-s1"><span class="m_-6508571065059995901m_8107626477234004170gmail-Apple-converted-space">  </span>print(&quot;station = &quot; + station)</span></p>
<p class="m_-6508571065059995901m_8107626477234004170gmail-p1"><span class="m_-6508571065059995901m_8107626477234004170gmail-s1"><span class="m_-6508571065059995901m_8107626477234004170gmail-Apple-converted-space">  </span>print(&quot;weather_type = &quot; + weather_type)</span></p><p class="m_-6508571065059995901m_8107626477234004170gmail-p1"><br></p><p class="m_-6508571065059995901m_8107626477234004170gmail-p1">Just in case you want to read in a real value, you can do the following.</p><p class="m_-6508571065059995901m_8107626477234004170gmail-p1"><span class="m_-6508571065059995901m_8107626477234004170gmail-s1">







</span></p><p class="m_-6508571065059995901m_8107626477234004170gmail-p1"><span class="m_-6508571065059995901m_8107626477234004170gmail-s1">Latitude = tofloat(str_get_field(lines,2,<wbr>delim))   </span></p><p class="m_-6508571065059995901m_8107626477234004170gmail-p1"><span class="m_-6508571065059995901m_8107626477234004170gmail-s1">)</span></p><p class="m_-6508571065059995901m_8107626477234004170gmail-p1"><span class="m_-6508571065059995901m_8107626477234004170gmail-s1"><br></span></p><div><br></div>-- <br><div class="m_-6508571065059995901m_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></div></div>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">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/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_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 914 432 3108<br></div></div></div>
</div>