[1] | 1 | function plot_tide(grdname,frcname,k,cff,skp,coastfileplot) |
---|
| 2 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
| 3 | % |
---|
| 4 | % Plot tidal ellipses |
---|
| 5 | % |
---|
| 6 | % Further Information: |
---|
| 7 | % http://www.brest.ird.fr/Roms_tools/ |
---|
| 8 | % |
---|
| 9 | % This file is part of ROMSTOOLS |
---|
| 10 | % |
---|
| 11 | % ROMSTOOLS is free software; you can redistribute it and/or modify |
---|
| 12 | % it under the terms of the GNU General Public License as published |
---|
| 13 | % by the Free Software Foundation; either version 2 of the License, |
---|
| 14 | % or (at your option) any later version. |
---|
| 15 | % |
---|
| 16 | % ROMSTOOLS is distributed in the hope that it will be useful, but |
---|
| 17 | % WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 18 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 19 | % GNU General Public License for more details. |
---|
| 20 | % |
---|
| 21 | % You should have received a copy of the GNU General Public License |
---|
| 22 | % along with this program; if not, write to the Free Software |
---|
| 23 | % Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
---|
| 24 | % MA 02111-1307 USA |
---|
| 25 | % |
---|
| 26 | % Copyright (c) 2003-2006 by Patrick Marchesiello |
---|
| 27 | % |
---|
| 28 | % Updated 5-Oct-2006 by Pierrick Penven |
---|
| 29 | % |
---|
| 30 | % |
---|
| 31 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
---|
| 32 | rad=pi/180.0; |
---|
| 33 | deg=180.0/pi; |
---|
| 34 | |
---|
| 35 | niceplot=1; |
---|
| 36 | |
---|
| 37 | nc=netcdf(grdname); |
---|
| 38 | rlon=nc{'lon_rho'}(:); |
---|
| 39 | rlat=nc{'lat_rho'}(:); |
---|
| 40 | rmask=nc{'mask_rho'}(:); |
---|
| 41 | rangle=nc{'angle'}(:); |
---|
| 42 | close(nc) |
---|
| 43 | [M,L]=size(rlat); |
---|
| 44 | |
---|
| 45 | nc=netcdf(frcname); |
---|
| 46 | tide_Eamp(:,:)=nc{'tide_Eamp'}(k,:,:); |
---|
| 47 | tide_Cmax(:,:)=nc{'tide_Cmax'}(k,1:skp:M,1:skp:L); |
---|
| 48 | tide_Cmin(:,:)=nc{'tide_Cmin'}(k,1:skp:M,1:skp:L); |
---|
| 49 | tide_Cangle(:,:)=rad*nc{'tide_Cangle'}(k,1:skp:M,1:skp:L); |
---|
| 50 | cmpt=nc.components(:); |
---|
| 51 | disp(['Plot tidal component : ',cmpt(3*k-2:3*k)]) |
---|
| 52 | close(nc) |
---|
| 53 | slon=rlon(1:skp:M,1:skp:L); |
---|
| 54 | slat=rlat(1:skp:M,1:skp:L); |
---|
| 55 | smask=rmask(1:skp:M,1:skp:L); |
---|
| 56 | rmask(rmask==0)=NaN; |
---|
| 57 | |
---|
| 58 | disp(['Max currents: ',num2str(max(max(tide_Cmax)),2),' m/s']) |
---|
| 59 | |
---|
| 60 | if niceplot==1 |
---|
| 61 | |
---|
| 62 | domaxis=[min(min(rlon)) max(max(rlon)) min(min(rlat)) max(max(rlat))]; |
---|
| 63 | m_proj('mercator',... |
---|
| 64 | 'lon',[domaxis(1) domaxis(2)],... |
---|
| 65 | 'lat',[domaxis(3) domaxis(4)]); |
---|
| 66 | m_pcolor(rlon,rlat,rmask.*tide_Eamp) |
---|
| 67 | shading flat |
---|
| 68 | colorbar |
---|
| 69 | hold on |
---|
| 70 | m_ellipse(cff*smask.*tide_Cmax,cff*smask.*tide_Cmin,... |
---|
| 71 | smask.*tide_Cangle,slon,slat,'k'); |
---|
| 72 | if ~isempty(coastfileplot) |
---|
| 73 | m_usercoast(coastfileplot,'patch',[.9 .9 .9]); |
---|
| 74 | end |
---|
| 75 | hold off |
---|
| 76 | title(['Amplitude [m] of tide : ',cmpt(3*k-2:3*k)]) |
---|
| 77 | m_grid('box','fancy',... |
---|
| 78 | 'xtick',5,'ytick',5,'tickdir','out',... |
---|
| 79 | 'fontsize',7); |
---|
| 80 | |
---|
| 81 | else |
---|
| 82 | |
---|
| 83 | pcolor(rlon,rlat,rmask.*tide_Eamp) |
---|
| 84 | shading flat |
---|
| 85 | colorbar |
---|
| 86 | hold on |
---|
| 87 | ellipse(cff*smask.*tide_Cmax,cff*smask.*tide_Cmin,smask.*tide_Cangle,slon,slat,'k'); |
---|
| 88 | axis([min(min(rlon)) max(max(rlon)) min(min(rlat)) max(max(rlat))]) |
---|
| 89 | title(['Amplitude [m] of tide : ',cmpt(3*k-2:3*k)]) |
---|
| 90 | hold off |
---|
| 91 | |
---|
| 92 | end |
---|
| 93 | |
---|