I have the following text file of multiple lines(this is just a small sample of about 100 lines of data that I need to read).
- Each line of of data has a header, separated by a comma (I have left the header in so I can edit the text file if necessary - easy to find value to edit)
- First line of data has two dates (2020-01-1 and 2020-06-1) that are encased in the hash character(this is what VBA does when it writes a date to a text file - I could strip the characters if necessary if that makes more sense to Julia?
1,#2020-01-01#,#2020-06-30#,1,4368,4368 Location, Elevation, Latitude, Longitude, Year, Sky_TRNSYS "Toowoomba",598,-27.55,151.95,"2010",1 T_Cool_On, T_Heat_On, Hr_On, Hr_Off, RH_Max, RH_Min, RAD_Max, RH_Kp 25,15,18,7,75,40,300,2.5 T_Ideal, Semi_Permanent, External_Shade 20,0,0 Alpha_Leaf_Air, Latent, Sigma, e_Can, e_Sky, Ratio_Glob_NIR, Ratio_Glob_PAR, Ratio_Heat_CO2, Ratio_Heat_Vap, Ratio_mg_ppm 5,2450000,.0000000567,1,1,.5,.5,0,0,.554``` What I want to do, is assign each of the values to their variable name contained in the header and be of the appropriate type (float63, Int, String or Date...). In the past I have successfully used DelimitedFiles to read data files IF there are NO header lines above each line, as follows (works well): ```open("C:\\Users\\peter\\Documents\\Julia_Code\\Learning\\MyFile_line_1.txt","r") Crop_Model, Start_Date, End_Date, Start_Hr, End_Hr, Hours_Total = readdlm("C:\\Users\\peter\\Documents\\Julia_Code\\Learning\\MyFile_line_1.txt",',')``` Questions: 1. How to achieve my goal to be able to read in files and use the header details for each line to define the variable name in the Julia program (the data is NOT an array)? If this can't be done I could pass OVER each header line (how to do this ?) and then just assign the numerical values as I have done above - that would suffice. But how to pass over a line? Presumably I need a loop and a test condition ? 2. How to define (tell Julia) that I am reading a date so that I can use this date in the Julia program? If Julia can't handle dates well, I could translate the date into an hour number in my VBA program and eliminate the use of dates all together - not very elegant though. 3. Once the values are read and assigned to the variable names how do I make then visible and usable to other parts of my program? Do I encase this part of the program in a "Module say Input_Data" and then use the "using Module Input_Data" in the areas of my program that need these variables? - this last point is key to me, as the penny has not dropped on how to structure a Julia program and makes variables visible to different parts of my program I am hoping some kind soul can help with all of these queries. Thanks Peter