% um_level_test % Testing if the level asked for is available % gnp 31.01.2007 lev_model = 38; lev_theta = 8; lev_prs= 9; var_model = 1:8; var_theta = 9; var_prs = 10; um_error=0; var_model(9)=32; var_model(10)=33; var_model(11)=35; %Initialize single levels dummy variable slev = 0; slev2 = 0; found1 = find(var_model == ivar); found2 = find(var_theta == ivar); found3 = find(var_prs == ivar); if (isempty(found1) == 0) if (ilev1 > 0 && ilev1 <= lev_model) disp('Levels correct') else disp('Level not correct for variable on model levels') um_error=1; return end elseif (isempty(found2) == 0) if (ilev1 > 0 && ilev1 <= lev_theta) disp('Levels correct') else disp('Level not correct forvariable on theta levels') um_error=1; return end elseif (isempty(found3) == 0) if (ilev1 > 0 && ilev1 <= lev_prs) disp('Levels correct') else disp('Level not correct for variable on pressure levels') um_error=1; return end else disp('Single level variable') ilev1 = 1; end found1 = find(var_model == ivar2); found2 = find(var_theta == ivar2); found3 = find(var_prs == ivar2); if (ivar2 ~=0) if (isempty(found1) == 0) if (ilev2 > 0 && ilev2 <= lev_model) disp('Levels correct variable 2') else disp('Level not correct for variable on model levels') um_error=1; return end elseif (isempty(found2) == 0) if (ilev2 > 0 && ilev2 <= lev_theta) disp('Levels correct variable 2') else disp('Level not correct forvariable on theta levels') um_error=1; return end elseif (isempty(found3) == 0) if (ilev2 > 0 && ilev2 <= lev_prs) disp('Levels correct variable 2') else disp('Level not correct for variable on pressure levels') um_error=1; return end else disp('Single level variable 2') ilev2 = 1; end end if (ivec ~= 0) if (ivar_vec(1) > 10 || ivar_vec(2) > 10) disp('Single level vectors') ilev_vec=1; else ilev_vec=ilev1; end end return clear found1 found2 found3