-
Notifications
You must be signed in to change notification settings - Fork 92
Reading Data
Functions are provided for reading one-dimensional data for which skill metrics and diagrams are desired. These functions are used by the example scripts in the Examples folder that are distributed as part of the SkillMetrics package to read the sample data. They are available to make it easier for users who are new to Python to adapt the example scripts to read their data. However, these data read functions are not included within the skill_metrics module and must reside within the same directory as the script that calls them. This is done because it is the responsibility of the user to read the data within their Python scripts, and it is impossible to provide a complete suite of functions that would accommodate all possible scenarios.
The one-dimensional data are read in and provided as dictionaries of lists via Comma, Separated, Value (CSV) files. For example,
data_files = ['pred1.csv', 'pred2.csv', 'pred3.csv', 'ref.csv']
data = load_data(data_files)
The format the CSV file must satisfy is described in the comments of the chosen read data function. For the load_data
function cited above, an example of the format for the contents of a CSV file is:
data latitude longitude depth jday units
52.9110002 43.161833 -69.576667 -1 3045.255556 cell/L
1.431675565 43.161833 -69.576667 -10 3045.255556 cell/L
1.280270828 43.161833 -69.576667 -20 3045.255556 cell/L
...
0.391304068 42.964333 -69.7645 -20 3045.979861 cell/L
0.360104567 42.964333 -69.7645 -30 3045.979861 cell/L
[56 rows x 7 columns]
The functions available for reading data are:
-
load_data: Reads data from CSV files and returns them in dictionary objects.
- Requires: read_csv_data
- Sample CSV file: pred1.csv
-
load_dataframe: Reads data from CSV files and returns them in Pandas DataFrame objects.
- Requires: get_time_series, read_csv_data)
- Sample CSV file: pred1_units.csv