| 1 |
gforget |
1.1 |
function []=MITprof_stats_cost(dirData,listData,listVar,varargin); |
| 2 |
|
|
%[]=MITprof_stats_cost(dirData,listData,listVar,varargin); |
| 3 |
|
|
%object: computes and displays cost function statistics |
| 4 |
|
|
%input: dirData is the data directory name |
| 5 |
|
|
% listData is the data file list (e.g. {'argo_in*'} or {'argo_in*','argo_at*'} ) |
| 6 |
|
|
% listVar is the variable list varCur (e.g. {'T'} or {'T','S'} ) |
| 7 |
|
|
% year0,year1 (optional) is the first,last year pair |
| 8 |
|
|
%output: (none -- figures only) |
| 9 |
|
|
% |
| 10 |
|
|
%for example: |
| 11 |
|
|
% dirData='./'; |
| 12 |
|
|
% listData={'argo_in*'}; listVar={'T','S'}; |
| 13 |
|
|
% MITprof_stats_cost(dirData,listData,listVar); |
| 14 |
|
|
|
| 15 |
|
|
|
| 16 |
|
|
%load paths and grid: |
| 17 |
|
|
%-------------------- |
| 18 |
gforget |
1.3 |
gcmfaces_path; global mygrid; mygrid=[]; grid_load([gcmfaces_dir '/sample_input/GRIDv4/'],5,'compact'); |
| 19 |
gforget |
1.1 |
|
| 20 |
|
|
%time limits: |
| 21 |
|
|
if nargin>3; |
| 22 |
|
|
year0=varargin{1}; year1=varargin{2}; |
| 23 |
|
|
date0=datenum(year0,1,1); date1=datenum(year1,12,31); |
| 24 |
|
|
else; |
| 25 |
|
|
year0=1992; year1=2008; |
| 26 |
|
|
date0=datenum(year0,1,1); date1=datenum(year1,12,31); |
| 27 |
|
|
end; |
| 28 |
|
|
|
| 29 |
|
|
figureL; |
| 30 |
|
|
|
| 31 |
|
|
for vv=1:length(listVar); |
| 32 |
|
|
varCur=listVar{vv}; |
| 33 |
|
|
|
| 34 |
|
|
%get the cost square root: |
| 35 |
|
|
[MITprof]=MITprof_stats_load(dirData,listData,varCur); |
| 36 |
|
|
|
| 37 |
|
|
%mask out values that are not in year range: |
| 38 |
|
|
ii=find(MITprof.prof_date<date0|MITprof.prof_date>date1); |
| 39 |
|
|
MITprof.prof(ii,:)=NaN; |
| 40 |
|
|
|
| 41 |
|
|
%mean and median: |
| 42 |
|
|
costCur=[nanmean(MITprof.prof(:).^2) nanmedian(MITprof.prof(:).^2)]; |
| 43 |
|
|
fprintf('mean cost for %s: %0.3g (median: %0.3g) \n',varCur,costCur); |
| 44 |
|
|
|
| 45 |
|
|
%depth/time mean cost: |
| 46 |
|
|
tmp_date=(MITprof.prof_date-date0)/365; |
| 47 |
|
|
[x,y,z,n]=MITprof_stats(MITprof.prof_depth,MITprof.prof_depth,... |
| 48 |
|
|
tmp_date,[0:1/4:1+(year1-year0)],'mean',MITprof.prof.^2); |
| 49 |
|
|
z(n<1e2)=NaN; |
| 50 |
|
|
subplot(2,length(listVar),vv); verticalplot('pcolor',y,x,z); |
| 51 |
|
|
caxis([0 8]); shading flat; colorbar; ylabel('depth (in m)'); |
| 52 |
|
|
xlabel(['date (in years since ' num2str(year0) ')']); |
| 53 |
|
|
title(sprintf('mean cost for %s: %0.3g (median: %0.3g)',varCur,costCur)); |
| 54 |
|
|
|
| 55 |
|
|
%latitudinal distribution: |
| 56 |
|
|
[x,y,z,n]=MITprof_stats(MITprof.prof_lat,[-90:5:90],MITprof.prof,[-5:0.25:5]); |
| 57 |
|
|
tmp1=(nansum(n,2)>1e4)*ones(1,size(n,2)); |
| 58 |
|
|
z(tmp1==0)=NaN; |
| 59 |
|
|
subplot(2,length(listVar),vv+length(listVar)); contourf(x,y,z,[0:0.05:0.5]); grid on; |
| 60 |
|
|
caxis([0 0.5]); colorbar; ylabel('normalized misfit'); xlabel('latitude'); title('pdf'); |
| 61 |
|
|
|
| 62 |
|
|
end; |
| 63 |
|
|
|