Skip to content

Commit

Permalink
Merge branch 'master' into readthedocs
Browse files Browse the repository at this point in the history
  • Loading branch information
gaelforget committed May 27, 2018
2 parents 4c564f0 + 3c46380 commit fa6ddc2
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 36 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
docs/_build
.ipynb_checkpoints
octave-workspace
release2_climatology
GRID
devel

Binary file modified gcmfaces.pdf
Binary file not shown.
20 changes: 2 additions & 18 deletions gcmfaces_calc/calc_UEVNfromUXVY.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,9 @@
%inputs: fldU/fldV are the X/Y vector fields at velocity points
%outputs: fldUe/fldVn are the Eastward/Northward vectors at tracer points

global mygrid;
gcmfaces_global;

%fldU(mygrid.hFacW==0)=NaN; fldV(mygrid.hFacS==0)=NaN;
nr=size(fldU.f1,3); fldU(mygrid.hFacW(:,:,1:nr)==0)=NaN; fldV(mygrid.hFacS(:,:,1:nr)==0)=NaN;

[FLDU,FLDV]=exch_UV(fldU,fldV);

fldUe=fldU; fldVn=fldV;
for iF=1:fldU.nFaces;
tmp1=FLDU{iF}(1:end-1,:,:); tmp2=FLDU{iF}(2:end,:,:);
fldUe{iF}=reshape(nanmean([tmp1(:) tmp2(:)],2),size(tmp1));
tmp1=FLDV{iF}(:,1:end-1,:); tmp2=FLDV{iF}(:,2:end,:);
fldVn{iF}=reshape(nanmean([tmp1(:) tmp2(:)],2),size(tmp1));
end;

FLDU=fldUe; FLDV=fldVn;
cs=mk3D(mygrid.AngleCS,FLDU); sn=mk3D(mygrid.AngleSN,FLDU);

fldUe=+FLDU.*cs-FLDV.*sn;
fldVn=FLDU.*sn+FLDV.*cs;


[fldUe,fldVn]=calc_UV_zonmer(fldU,fldV);
26 changes: 26 additions & 0 deletions gcmfaces_calc/calc_UV_zonmer.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
function [fldUe,fldVn]=calc_UV_zonmer(fldU,fldV);
%object: compute Eastward/Northward vectors form X/Y vectors
%inputs: fldU/fldV are the X/Y vector fields at velocity points
%outputs: fldUe/fldVn are the Eastward/Northward vectors at tracer points
%
%note: this routine does no apply any mask -- unlike the old calc_UEVNfromUXVY.m

gcmfaces_global;

[FLDU,FLDV]=exch_UV(fldU,fldV);

fldUe=fldU; fldVn=fldV;
for iF=1:fldU.nFaces;
tmp1=FLDU{iF}(1:end-1,:,:); tmp2=FLDU{iF}(2:end,:,:);
fldUe{iF}=reshape(nanmean([tmp1(:) tmp2(:)],2),size(tmp1));
tmp1=FLDV{iF}(:,1:end-1,:); tmp2=FLDV{iF}(:,2:end,:);
fldVn{iF}=reshape(nanmean([tmp1(:) tmp2(:)],2),size(tmp1));
end;

FLDU=fldUe; FLDV=fldVn;
cs=mk3D(mygrid.AngleCS,FLDU); sn=mk3D(mygrid.AngleSN,FLDU);

fldUe=+FLDU.*cs-FLDV.*sn;
fldVn=FLDU.*sn+FLDV.*cs;


16 changes: 9 additions & 7 deletions gcmfaces_devel/calc_UV_geos.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@
% kk=10; cc=[-1 1]*0.1;
% kk=30; cc=[-1 1]*0.05;
% kk=40; cc=[-1 1]*0.02;
% figure; orient tall; m=mygrid.mskC(:,:,kk);
% [tmpu,tmpv]=calc_UEVNfromUXVY(U(:,:,kk),V(:,:,kk));
% [tmpug,tmpvg]=calc_UEVNfromUXVY(Ug(:,:,kk),Vg(:,:,kk));
% subplot(3,1,1); qwckplot(m.*tmpu); caxis(cc); colorbar; title('zonal flow');
% subplot(3,1,2); qwckplot(m.*tmpug); caxis(cc); colorbar; title('geostrophic flow');
% subplot(3,1,3); qwckplot(m.*tmpu-tmpug); caxis(cc); colorbar; title('difference');
%
% m=mygrid.mskC(:,:,kk);
% tmpP=P(:,:,kk); tmpP=tmpP-nanmedian(tmpP);
% [tmpu,tmpv]=calc_UV_zonmer(U(:,:,kk),V(:,:,kk));
% [tmpug,tmpvg]=calc_UV_zonmer(Ug(:,:,kk),Vg(:,:,kk));
% figure; m_map_gcmfaces(m.*tmpu,1.2,{'myCaxis',cc}); title('zonal flow');
% figure; m_map_gcmfaces(m.*tmpug,1.2,{'myCaxis',cc}); title('geostrophic flow');
% figure; m_map_gcmfaces(m.*tmpu-tmpug,1.2,{'myCaxis',cc}); title('deviation from geostrophy');
% figure; m_map_gcmfaces(m.*tmpP,1.2,{'myCaxis',[-5:0.5:5]}); title('hydrostatic pressure');


% development notes:
% is P assumed NaN-masked?
Expand Down
7 changes: 6 additions & 1 deletion gcmfaces_diags/diags_driver.m
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@

nmDiag=setDiags{iDiag};

normalLoop=~strcmp(nmDiag,'B')&~strcmp(nmDiag,'D')&...
normalLoop=~strcmp(nmDiag,'B')&~strcmp(nmDiag,'D')&~strcmp(nmDiag,'drwn3')&...
~strcmp(nmDiag,'profiles')&~strcmp(nmDiag,'ecco')&~strcmp(nmDiag,'ctrl');

if normalLoop;
Expand All @@ -82,6 +82,11 @@
recInAve=[myparms.recInAve(1):myparms.recInAve(2)];
diags_select(dirModel,dirMat,'B',1,recInAve);

elseif strcmp(nmDiag,'drwn3');
recs=(years(1)-1)*12+1:years(end)*12;
recs=recs(recs<=myparms.diagsNbRec);
diags_select(dirModel,dirMat,'drwn3',1,recs);

elseif strcmp(nmDiag,'D');
for kk=myparms.budgetList;
for myYear=years;
Expand Down
3 changes: 3 additions & 0 deletions gcmfaces_diags/diags_driver_tex.m
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@
elseif strcmp(setDiags{ii},'SEAICE');
write2tex(fileTex,1,'seaice and snow fields',1);
diags_display({dirMat,dirMatRef},'SEAICE',dirTex,nameTex);
elseif strcmp(setDiags{ii},'drwn3');
write2tex(fileTex,1,'Plankton and related fields',1);
diags_display({dirMat,dirMatRef},'drwn3',dirTex,nameTex);
elseif strcmp(setDiags{ii},'controls');
%controls
write2tex(fileTex,1,'controls',1);
Expand Down
2 changes: 1 addition & 1 deletion gcmfaces_diags/diags_grid_parms.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

%issue warning if myparms.recInAve seems inconsistent compared with myparms.diagsNbRec~:
if myparms.diagsNbRec~=(myparms.recInAve(2)-myparms.recInAve(1)+1);
warning(['It appears that myparms.recInAve does not match myparms.recInAve']);
warning(['It appears that myparms.diagsNbRec does not match myparms.recInAve']);
warning(['This may suggest that the oInteractive=1 option should be used.']);
pause(5);
end;
Expand Down
2 changes: 1 addition & 1 deletion gcmfaces_diags/diags_list_times.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
if isempty(who('listSubdirs'));
listSubdirs={[myenv.matdir 'BUDG/' ],[myenv.diagsdir '/BUDG/' ],[myenv.diagsdir '/OTHER/' ],...
[myenv.diagsdir '/STATE/' ],[myenv.diagsdir '/TRSP/'],[myenv.diagsdir '/' ]};
listFiles={'state_2d_set1','trsp_3d_set1','budg2d_zflux_set1'};
listFiles={'state_2d_set1','trsp_3d_set1','budg2d_zflux_set1','gud_3d_set1'};
end;
%
listTimes=[];
Expand Down
25 changes: 17 additions & 8 deletions gcmfaces_maps/gcmfaces_cmap_cbar.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,26 @@
end;
end;

%white/black at colorbar edges/center?
if strcmp(myCmap,'jetBW1'); myCmap='jet'; myBW=1; end;
if strcmp(myCmap,'jetBW2'); myCmap='jet'; myBW=2; end;

%flip colormap direction?
flipCmap=0;
if ~isempty(strfind(myCmap,'FLIP')); flipCmap=1; myCmap=myCmap(5:end); end;

%need to revert to known colormap?
test1=isempty(which(myCmap));
if test1;
warning(['Colormap ' myCmap ' not found => reverting to jet.']);
myCmap='jet';
end;

%vecLimCol must be strickly increasing :
tmp1=vecLimCol(2:end)-vecLimCol(1:end-1);
if ~isempty(find(tmp1<=0)); fprintf('please use increasing values \n');
myColorbar=-1; return; end;
if ~isempty(find(tmp1<=0));
error('Non-increasing sequence in vecLimCol');
end;

%original colormap precision :
%nb_colors=64*3;
Expand All @@ -69,12 +82,8 @@
%nb_colors=64*500*tmp3;

%colormap and caxis :
if ~isempty(strfind(myCmap,'FLIP'));
eval(['tmp_map=colormap(' myCmap(5:end) '(nb_colors));']);
tmp_map=flipdim(tmp_map,1);
else;
eval(['tmp_map=colormap(' myCmap '(nb_colors));']);
end;
eval(['tmp_map=colormap(' myCmap '(nb_colors));']);
if flipCmap; tmp_map=flipdim(tmp_map,1); end;
tmp_val=[vecLimCol(1) vecLimCol(end)];
tmp_val=[tmp_val(1) : (tmp_val(2)-tmp_val(1))/(nb_colors-1) : tmp_val(2)];
caxis([tmp_val(1) tmp_val(end)]);
Expand Down

0 comments on commit fa6ddc2

Please sign in to comment.