I am using a software that gives me as an output a .csv
file which I want to read with the aid of a fortran code. The .csv
file has the following form :
balance for 1. Unit: kg N/ha
___________________________________________________________________________________________________________________________________________________________________________
,N Pools,,,,,Influx N,,,,,Efflux N
Day,iniSON,iniSIN,endSON,endSIN,dSoilN,Deposit,Fertilizer,Manure,Litter,Sum-In...(**20 parameters**)
___________________________________________________________________________________________________________________________________________________________________________
1,5973.55, 20.20,5973.51, 20.23, -0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, -0.00, 0.00
.........
I have 365 lines with such values.
Example
In order to read the first lines I used the following :
program od
implicit none
integer :: res
character(LEN=200) :: head1,head2,head3,head4,head5
open(10, file="Balance_N_1.csv",access='sequential',form="formatted",iostat=res)
open(9,file="out.txt")
read(10,fmt='(A)', iostat=res) head1,head2,head3,head4,head5
write(9,*) head1,head2,head3,head4,head5
end program od
How is it possible to read the data that follow and to put them in a matrix so that I can perform calculations with some of the values?