Aside any comment on whoever published data with this layout, I have to import a CSV like this, where the data of interest is repeated on each day of the year:
Does CSV.jl has options to load the (small) file at once ? Or should I go for a manual implementation using readline ? Or perhaps I should CSV-load the file piece by piece in a daily loop, accounting for the different row indexes… at least it is constant… ?
Another option would be to write a function that reads the file and outputs it as a single table, by including a column for the date, then read the CSV as usual.
The key useful info is the way awk tool is used to separate the important data lines from the intra-file headers, and to process the data in the header to enable adding it later to each line separately. This is the awk command on its own:
awk 'BEGIN { day = "0"; print "day\ttime\tvalue" } /^Day/ { day = $2} /^[^D]/ {print day,"\t" $0}' in.txt
Hopefully the awk logic is clear enough.
P.S. screenshots are annoying in a post. Try to insert copy-pasteable stuff
Tahnk you. Indeed I should have posted a minimal syntetic example. I posted a screenshot as I didn’t expect a complete solution, only on which path to take.
At the end I used the CSV.read options header and limit, but I am surprised that CSV has a select option for the columns but not one for the rows.