MATLAB Answers

How can i load solar data for forecasting as a raw vector in matlab ?

2 views (last 30 days)
NN
NN on 13 Nov 2020
Commented: Peter Perkins on 20 Nov 2020
Hi,
i have a dataset for solar irradiance and attaching here .How can i load this irradiance data in matlab as a single raw vector ?data should be loaded as irradiance in y axis and time (days) in a month in x axis.
please advice

Accepted Answer

Star Strider
Star Strider on 13 Nov 2020
Try this:
T1 = readtable('SoDa_MERRA2_lat24.533_lon79.615_2020-09-01_2020-09-30_1151725210.csv', 'VariableNamingRule','preserve');
VarNames = T1.Properties.VariableNames;
figure
plot(T1{:,1}, T1{:,11})
grid
xlabel(VarNames{1})
ylabel(VarNames{11})
producing:
Experiment to get the result you want.
I leave the forecasting to you.
  3 Comments
Peter Perkins
Peter Perkins on 20 Nov 2020
Allow me to tweak SS's solution, by adding together the date and time, and making a timetable. I am also running a very new release, the importing step might be slightly different for you.
>> t = readtable('SoDa_MERRA2_lat24.533_lon79.615_2020-09-01_2020-09-30_1151725210.csv');
Warning: Column headers from the file were modified to make them valid MATLAB identifiers before creating variable names for the table. The original column headers are saved in the VariableDescriptions
property.
Set 'VariableNamingRule' to 'preserve' to use the original column headers as table variable names.
>> t.x_Date.Format = 'default';
>> t.UTTime = duration(t.UTTime,'Format','hh:mm');
>> tt = table2timetable(t(:,3:end),'RowTimes',t.x_Date + t.UTTime);
>> head(tt)
ans =
8×9 timetable
Time Temperature RelativeHumidity Pressure WindSpeed WindDirection Rainfall Snowfall SnowDepth Short_waveIrradiation
____________________ ___________ ________________ ________ _________ _____________ ________ ________ _________ _____________________
01-Sep-2020 01:00:00 296.84 94.82 965.64 3.5 253.12 0.014494 0 0 17.749
01-Sep-2020 02:00:00 297.79 90.56 966.47 4.11 255.19 0.003622 0 0 169.53
01-Sep-2020 03:00:00 299.14 84.06 967.29 4.41 261.23 0.000337 0 0 339.2
01-Sep-2020 04:00:00 300.26 78.89 967.9 4.53 259.64 0.000199 0 0 449.41
01-Sep-2020 05:00:00 301.57 74.2 967.97 4.75 255.28 2e-05 0 0 701.08
01-Sep-2020 06:00:00 302.79 70.51 967.58 4.61 254.5 0.00081 0 0 885.31
01-Sep-2020 07:00:00 303.58 68.3 967.14 3.89 254.65 0.034965 0 0 910.14
01-Sep-2020 08:00:00 303.82 67.64 966.74 3.16 249.5 0.14678 0 0 775.07
>> plot(tt.Time,tt.Short_waveIrradiation)

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by