-
Notifications
You must be signed in to change notification settings - Fork 2
/
RBD_plot_fingerprints.m
132 lines (119 loc) · 4.91 KB
/
RBD_plot_fingerprints.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
function h_fig = RBD_plot_fingerprints( sitecode, year, decimal_day, ...
sw_incoming, rH, ...
Tair, NEE, LE, H_dry, main_t_str )
% RBD_PLOT_FINGERPRINTS - Creates a figure with six panels displaying
% "fingerprint" plots for Rg, RH, T, NEE, LE, H.
%
% Helper function for UNM_RemoveBadData (RBD).
%
% USAGE
% RBD_plot_fingerprints( sitecode, year, decimal_day, ...
% sw_incoming, rH, Tair, NEE, LE, H_dry, ...
% main_t_str );
%
% INPUTS
% sitecode: UNM_sites object; specifies the site (for plot labels)
% year: four digit year: specifies the year (for plot labels)
% decimal_day: fractional day of year (internal variable within RBD)
% sw_incoming: incoming shortwave radiation (internal variable within RBD)
% rH: relative humidity (internal variable within RBD)
% NEE: net ecosystem exchange (internal variable within RBD)
% LE: latent heat (internal variable within RBD)
% H_dry: sensible heat (internal variable within RBD)
% main_t_str: title for the plot, to appear centered above all panels
%
% OUTPUTS
% h_fig: handle to the figure containing the plot
%
% SEE ALSO
% dataset, UNM_RemoveBadData, UNM_RemoveBadData_pre2012
%
% author: Timothy W. Hilton, UNM, June 2012
h_fig = figure( 'Units', 'Normalized' );
ax1 = subplot( 2, 3, 1 );
pal = colormap( cbrewer( 'seq', 'YlOrRd', 9 ) );
Rg_cmap = [ interp1( 1:6, pal( 1:6, : ), linspace( 1, 6, 10 ) ); ...
interp1( 0:3, pal( 6:9, : ), linspace( 0, 3, 1000 ) ) ];
plot_fingerprint( decimal_day, sw_incoming, ...
sprintf( '%s %d Rg fingerprint', ...
char( sitecode ), year ), ...
'h_fig', h_fig, ...
'h_ax', ax1, ...
'cmap', Rg_cmap, ...
'clim', [ -10, 1400 ] );
ax2 = subplot( 2, 3, 2 );
% Hopefully rH is standardized now
% if max( rH ) > 1
% rH_max = 100;
% else
% DAN K
rH_max = 100.0;
plot_fingerprint( decimal_day, rH, ...
sprintf( '%s %d RH fingerprint', ...
char( sitecode ), year ), ...
'h_fig', h_fig, ...
'h_ax', ax2, ...
'clim', [ 0, rH_max ] );
ax3 = subplot( 2, 3, 3 );
plot_fingerprint( decimal_day, Tair, ...
sprintf( '%s %d T fingerprint', ...
char( sitecode ), year ), ...
'h_fig', h_fig, ...
'h_ax', ax3, ...
'clim', [ -20, 40 ] );
ax4 = subplot( 2, 3, 4 );
NEE_nobad = replace_badvals( NEE, [ -9999 ], 1e-6 );
pal = colormap( cbrewer( 'div', 'PRGn', 9 ) );
NEE_cmap = [ interp1( 1:9, pal, linspace( 1, 9, 100 ) ) ];
NEE_cmap = flipud( NEE_cmap );
plot_fingerprint( decimal_day, NEE_nobad, ...
sprintf( '%s %d NEE fingerprint', ...
char( sitecode ), year ), ...
'h_fig', h_fig, ...
'h_ax', ax4, ...
'cmap', NEE_cmap, ...
'center_caxis', true, ...
'clim', [ -2, 2 ] );
ax5 = subplot( 2, 3, 5 );
plot_fingerprint( decimal_day, LE, ...
sprintf( '%s %d LE fingerprint', ...
char( sitecode ), year ), ...
'h_fig', h_fig, ...
'h_ax', ax5, ...
'clim', [ 0, 200 ] );
ax6 = subplot( 2, 3, 6 );
plot_fingerprint( decimal_day, H_dry, ...
sprintf( '%s %d H fingerprint', ...
char( sitecode ), year ), ...
'h_fig', h_fig, ...
'h_ax', ax6, ...
'clim', [0, 500 ] );
set( h_fig, 'Units', 'Normalized', ...
'outerposition', [ 0, 0, 1, 1 ], ...
'Name', main_t_str );
% create a "main" title above the six subplots
ha = axes( 'Position', [0 0 1 1], ...
'Xlim',[0 1], 'Ylim',[0 1],...
'Box','off','Visible','off',...
'Units','normalized', ...
'clipping' , 'off');
text(0.5, 1, strcat( '\bf ', ...
strrep( main_t_str, '_', '\_' ) ),...
'HorizontalAlignment' ,'center',...
'VerticalAlignment', 'top');
%save the fingerprints plot to a PDF
fname = sprintf( 'fingerprint_%s_%s_%d.eps', ...
main_t_str, ...
char( UNM_sites( sitecode ) ), ...
year );
fprintf( 'fname: %s\n', fname );
% make the figure the same size regardless of screen size
set( h_fig, 'Units', 'Inches' );
pos = get( h_fig, 'Position' );
pos( 3:4 ) = [ 10.0, 7.5 ]; %size for 8.5 x 11 paper with 0.5" margins
set( h_fig, 'Position', pos );
%full_fname = fullfile( 'C:', 'Users', 'Tim', 'Plots', 'RadiationOffset', fname )
% full_fname = fullfile( getenv( 'PLOTS' ), ...
% 'RadiationOffset', 'AmerifluxFingerprints6Jul', fname );
% figure_2_eps( h_fig, full_fname );
%close( h_fig );