0001 function mrg_met_pp(days)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035 if nargin < 1
0036 days = 1;
0037 end
0038
0039 fnameCSV = ['met_data_',datestr(date,'yyyy_mmm'),'.csv'];
0040 f = fopen(fnameCSV);
0041 dat = textscan(f, '%s %f %f %f %f %f %f %f', 'HeaderLines',1, 'delimiter', ',');
0042
0043
0044 fclose(f);
0045
0046 dnum = datenum(char(dat{1}), 'dd/mm/yyyy HH:MM:SS');
0047 ctime = now;
0048 mintime = ctime-days;
0049 ind = dnum > mintime;
0050
0051 for a = 2:8
0052 nanind = dat{a}==-1e-30;
0053 dat{a}(nanind) = NaN;
0054 end
0055
0056 imgsize = [0 0 6*5 2*5];
0057
0058
0059 par = figure(1);
0060 plot(dnum(ind), dat{2}(ind), '-o', 'MarkerFaceColor', 'b');
0061 xlim([mintime ctime]);
0062 maxpar = max(dat{2}(ind));
0063 ylim([0 max(400,maxpar*1.1)]);
0064 dateaxis('x', 15);
0065 xlabel([datestr(mintime, 'dd/mm/yyyy'), ' - ', datestr(ctime, 'dd/mm/yyyy')])
0066 ylabel('PAR (\mumol photons m^{-2} s^{-1})')
0067
0068 set(par,'PaperUnits','centimeters ','PaperPosition',imgsize)
0069 print('-dpng', '-r300', 'web/images/light.png');
0070
0071
0072 ws = figure(1);
0073 plot(dnum(ind), dat{3}(ind), '-o', 'MarkerFaceColor', 'b');
0074 xlim([mintime ctime]);
0075 maxws = max(dat{3}(ind));
0076 ylim([0 max(1,maxws*1.1)]);
0077 dateaxis('x', 15);
0078 xlabel([datestr(mintime, 'dd/mm/yyyy'), ' - ', datestr(ctime, 'dd/mm/yyyy')])
0079 ylabel('Windspeed (m^{-1} s^{-1})')
0080
0081 set(ws,'PaperUnits','centimeters ','PaperPosition',imgsize)
0082 print('-dpng', '-r300', 'web/images/ws.png');
0083
0084
0085 wd = figure(1);
0086 plot(dnum(ind), dat{4}(ind), 'o', 'MarkerFaceColor', 'b');
0087 xlim([mintime ctime]);
0088 ylim([0 360]);
0089 dateaxis('x', 15);
0090 xlabel([datestr(mintime, 'dd/mm/yyyy'), ' - ', datestr(ctime, 'dd/mm/yyyy')])
0091 ylabel('Wind Direction (\circ)')
0092
0093 set(wd,'PaperUnits','centimeters ','PaperPosition',imgsize)
0094 print('-dpng', '-r300', 'web/images/wd.png');
0095
0096
0097 ap = figure(1);
0098 plot(dnum(ind), dat{5}(ind), '-o', 'MarkerFaceColor', 'b');
0099 xlim([mintime ctime]);
0100 ylim([800 1700]);
0101 dateaxis('x', 15);
0102 xlabel([datestr(mintime, 'dd/mm/yyyy'), ' - ', datestr(ctime, 'dd/mm/yyyy')])
0103 ylabel('Air Pressure (units)')
0104
0105 set(ap,'PaperUnits','centimeters ','PaperPosition',imgsize)
0106 print('-dpng', '-r300', 'web/images/ap.png');
0107
0108
0109 at = figure(1);
0110 plot(dnum(ind), dat{6}(ind), '-o', 'MarkerFaceColor', 'b');
0111 xlim([mintime ctime]);
0112 ylim([-10 30]);
0113 dateaxis('x', 15);
0114 xlabel([datestr(mintime, 'dd/mm/yyyy'), ' - ', datestr(ctime, 'dd/mm/yyyy')])
0115 ylabel('Air Temperature (\circ)')
0116
0117 set(at,'PaperUnits','centimeters ','PaperPosition',imgsize)
0118 print('-dpng', '-r300', 'web/images/at.png');
0119
0120
0121 tl = figure(1);
0122 plot(dnum(ind), dat{7}(ind), '-o', 'MarkerFaceColor', 'b');
0123 xlim([mintime ctime]);
0124
0125 dateaxis('x', 15);
0126 xlabel([datestr(mintime, 'dd/mm/yyyy'), ' - ', datestr(ctime, 'dd/mm/yyyy')])
0127 ylabel('Tidal Level (units)')
0128
0129 set(tl,'PaperUnits','centimeters ','PaperPosition',imgsize)
0130 print('-dpng', '-r300', 'web/images/tl.png');
0131
0132
0133 wt = figure(1);
0134 plot(dnum(ind), dat{8}(ind), '-o', 'MarkerFaceColor', 'b');
0135 xlim([mintime ctime]);
0136
0137 dateaxis('x', 15);
0138 xlabel([datestr(mintime, 'dd/mm/yyyy'), ' - ', datestr(ctime, 'dd/mm/yyyy')])
0139 ylabel('Water Temperature (\circ)')
0140
0141 set(wt,'PaperUnits','centimeters ','PaperPosition',imgsize)
0142 print('-dpng', '-r300', 'web/images/wt.png');
0143
0144 end