[ncl-talk] new variables from rows
Rashed Mahmood
rashidcomsis at gmail.com
Mon Jul 24 05:31:14 MDT 2017
Hi Damjan,
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.
Cheers,
Rashed
On Mon, Jul 24, 2017 at 2:00 PM, Damjan Jelic <dnjelic at gmail.com> wrote:
> Dear Rashed,
>
> 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.
>
> i will feel free to contact you directly for similar problems if thats ok
> with you.
>
> Sincerely!
> from Croatia,
> Damjan Jelic
>
> On Sun, Jul 23, 2017 at 12:51 PM, Rashed Mahmood <rashidcomsis at gmail.com>
> wrote:
>
>> Hi Damjan,
>> 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.
>>
>> Since the variable and unit names in the text files has double quotes, I
>> had to add a "tric" 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).
>>
>> The script seems to work fine, I think!. Attached are input,output and
>> the script files.
>>
>> hope that helps,
>> Rashed
>>
>> Date: Fri, 21 Jul 2017 16:50:07 +0200
>> From: Damjan Jeli? <damjan.jelic at fmf.uni-lj.si>
>> Subject: [ncl-talk] new variables from rows
>> To: ncl-talk at ucar.edu
>> Message-ID: <81b23a5fb192458c543a235e55871440 at fmf.uni-lj.si>
>> Content-Type: text/plain; charset="utf-8"
>>
>> Dear NCL support,
>>
>> i have txt files (attached) containing 35 different variables which im
>> trying to save in netcdf format. current problem is that i need to
>> specify every variable on its own and it is not elegant (attached) and
>> later on it will be problem since columns will be rearranged in random
>> order from time to time.
>> Can it be done somehow like this:
>> .data=asciiread(...
>> ....
>> variable_5 = (str_get_field(data(1::),5,","))
>> print(variable_5(0)); which is variable name of column 5
>> print(variable_5(0))=variable_5(3:end)
>>
>> or in written form:
>> i load data, ignore first row,
>> read data by columns
>> use first row as new variable name
>> use second row tu set units
>> skip 3. row and use all the rest as data.
>>
>> Kind regards,
>> Damjan
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170724/18619f5a/attachment.html
More information about the ncl-talk
mailing list