Subject: Read format from csv text file Posted: 2/25/2020 Viewed: 2089 times
Good morning everyone:
I have a problem trying to load the data with weekly resolution in csv format, from read from file wizard, leaving the following error:
"There is not column named" precipitation "in file, column names listed in the $ columns directive in this file:" year, week, precipitation "
I appreciate your help.
Ms. Anne Hereford
Subject: Re: Read format from csv text file Posted: 3/21/2020 Viewed: 2052 times
Have you seen this section (below) of the WEAP help that provides an example of how to name your columns in your CSV file?
Use the optional $Columns directive to describe the contents and unit for each data column. The optional unit, if included, is in square brackets after the name. This is a very good way to document your data. In addition, you can then refer to columns by their name instead of their number in the ReadFromFile expression -- not only will this make for a clearer expression, but the reference will still be correct if you later add or remove columns in the file. Here is an example from a climate file named Climate.csv with 5 data columns (rainfall, min and max temperature, humidity and wind):
$Columns = Precipitation[mm], Min Temperature[C], Max Temperature[C], Relative Humidity[%], Wind Speed[m/s]
Here's how to refer to the Max Temperature column in the ReadFromFile expression: ReadFromFile(Climate.csv, "Max Temperature[C]") Note: you must enclose the column name in quotes. The unit is optional and can be omitted, e.g., ReadFromFile(Climate.csv, "Max Temperature")
Optionally, you may list the time columns first. Some examples: