[ncl-talk] Selecting same date
Vanúcia Schumacher
vanucia-schumacher at hotmail.com
Tue Mar 3 11:38:35 MST 2020
Hi Mateus.
Thanks for the feedback, but this is not what I intend to do.
In my ascii file, I have several lines with the same date (e.g. 2018-01-01, ...) and in this proposed way, I would save 1 file for each line. However, what I need is to save each file for each unique date.
With the "test.txt" data I have 9 different dates, which I need to save as 9 different ascii files, containing all the information.
The function I used selects the dates in common, but I am missing something in the loop to save joining this information.
Thanks for the advance
________________________________
De: Mateus da Silva Teixeira <mateusstex at gmail.com>
Enviado: terça-feira, 3 de março de 2020 15:19
Para: Vanúcia Schumacher <vanucia-schumacher at hotmail.com>
Cc: ncl-talk at ucar.edu <ncl-talk at ucar.edu>
Assunto: Re: [ncl-talk] Selecting same date
Hi Vanucia,
Take a look at the following lines:
asciifile = asciiread( "test.txt", -1, "string" )
nlines = dimsizes( asciifile )
dates = str_get_field( asciifile(1:nlines-1), 1, ";" )
dates_nano = str_get_field( asciifile(1:nlines-1), 2, ";" )
lat = str_get_field( asciifile(1:nlines-1), 3, ";" )
lon = str_get_field( asciifile(1:nlines-1), 4, ";" )
pico_ka = str_get_field( asciifile(1:nlines-1), 5, ";" )
print( dates )
print( dates_nano )
print( lat )
print( lon )
print( pico_ka )
After reading all data, you can easily save them in an ascii file. Of course, if you want to make some calculations with these data you should convert from string to float.
Best regards,
Mateus
Em ter., 3 de mar. de 2020 às 12:01, Vanúcia Schumacher via ncl-talk <ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>> escreveu:
Hi users,
I need help to fix my ncl script,
what I'm trying to do is select all the same dates from the ascii file (test.txt) and save it
in a new ascii file (refers to each date), but I'm not able to get all the values for each date.
I attached the test data and the script
I appreciate any help
Cheers
_______________________________________________
ncl-talk mailing list
ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20200303/bc4e0f7c/attachment.html>
More information about the ncl-talk
mailing list