<div dir="ltr"><div><div><div>Hi Damjan,<br></div>Sure you can contact me directly to discuss similar problems... However, to increase your chances of a best possible answer it is always good to discuss questions on NCL forum.<br><br></div>Cheers,<br></div>Rashed<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jul 24, 2017 at 2:00 PM, Damjan Jelic <span dir="ltr">&lt;<a href="mailto:dnjelic@gmail.com" target="_blank">dnjelic@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"><div>Dear Rashed,<br><br></div><div>thank you very much for the script! it solves my problem for sure and i learn from it very much since it shows several function didnt know exist.<br><br></div><div>i will feel free to contact you directly for similar problems if thats ok with you.<br><br></div><div>Sincerely!<br>from Croatia,<br></div><div>Damjan Jelic<br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jul 23, 2017 at 12:51 PM, Rashed Mahmood <span dir="ltr">&lt;<a href="mailto:rashidcomsis@gmail.com" target="_blank">rashidcomsis@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"><div><div><div><div><div>Hi Damjan,<br></div>The attached script would read variable names, units and data from the file, and write in a netcdf file. It still needs to specify number of header lines, and the line numbers for variable names and units.<br><br></div>Since the variable and unit names in the text files has double quotes, I had to add a &quot;tric&quot; using two do loops to get rid of double quotes from individual strings (lines:22-36, Perhaps there is some proper way for it which I am not aware of). <br><br></div>The script seems to work fine, I think!. Attached are input,output and the script files.<br><br></div>hope that helps,<br></div>Rashed<br><div><br>Date: Fri, 21 Jul 2017 16:50:07 +0200<br>
From: Damjan Jeli? &lt;<a href="mailto:damjan.jelic@fmf.uni-lj.si" target="_blank">damjan.jelic@fmf.uni-lj.si</a>&gt;<br>
Subject: [ncl-talk] new variables from rows<br>
To: <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
Message-ID: &lt;<a href="mailto:81b23a5fb192458c543a235e55871440@fmf.uni-lj.si" target="_blank">81b23a5fb192458c543a235e55871<wbr>440@fmf.uni-lj.si</a>&gt;<br>
Content-Type: text/plain; charset=&quot;utf-8&quot;<br>
<br>
Dear NCL support,<br>
<br>
i have txt files (attached) containing 35 different variables which im<br>
trying to save in netcdf format. current problem is that i need to<br>
specify every variable on its own and it is not elegant (attached) and<br>
later on it will be problem since columns will be rearranged in random<br>
order from time to time.<br>
Can it be done somehow like this:<br>
.data=asciiread(...<br>
....<br>
variable_5 = (str_get_field(data(1::),5,&quot;,&quot;<wbr>))<br>
print(variable_5(0)); which is variable name of column 5<br>
print(variable_5(0))=variable_<wbr>5(3:end)<br>
<br>
or in written form:<br>
i load data, ignore first row,<br>
read data by columns<br>
use first row as new variable name<br>
use second row tu set units<br>
skip 3. row and use all the rest as data.<br>
<br>
Kind regards,<br>
Damjan<br><br></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>