Home > utilities > do_surface_plotMatlabMap.m

do_surface_plotMatlabMap

PURPOSE ^

SYNOPSIS ^

function [Plots]=do_surface_plotMatlabMap(plotOPTS,FVCOM)

DESCRIPTION ^

 Function to display color maps of FVCOM variables (i.e. temperature)

  [Plots]=do_surface_plot(plotOPTS,FVCOM)

 DESCRIPTION:
    Generates maps of variables using m_map toolbox (patch

 INPUT:
   plotOPTS   = structure array with predefined options for generating the
   maps
   FVCOM  = data extracted from FVCOM NC file. See read_netCDF_FVCOM for
   details

   plotOPTS.range_lat: [50.1000 50.4000]
   plotOPTS.range_lon: [-4.5000 -3.8500]
   plotOPTS.fig_name: 'co2_S5_slowleak'
   plotOPTS.mesh: [1x1 struct]
   plotOPTS.coastline_file: '../mat/tamar3_0coast.mat'
   plotOPTS.zone: 30
   plotOPTS.ell: 'grs80'
   plotOPTS.var_plot: 'PH'
   plotOPTS.clims: [6 8]
   plotOPTS.do_mesh: 0
   plotOPTS.nz_plot: 1
   plotOPTS.figure: 1
   plotOPTS.Time_record: 7.3271e+05
   plotOPTS.nz_plot_vec: 1
   plotOPTS.data_dec: 5
   plotOPTS.vel_sca: 5
   plotOPTS.pause: 0.5000

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [Plots]=do_surface_plotMatlabMap(plotOPTS,FVCOM)
0002 %
0003 % Function to display color maps of FVCOM variables (i.e. temperature)
0004 %
0005 %  [Plots]=do_surface_plot(plotOPTS,FVCOM)
0006 %
0007 % DESCRIPTION:
0008 %    Generates maps of variables using m_map toolbox (patch
0009 %
0010 % INPUT:
0011 %   plotOPTS   = structure array with predefined options for generating the
0012 %   maps
0013 %   FVCOM  = data extracted from FVCOM NC file. See read_netCDF_FVCOM for
0014 %   details
0015 %
0016 %   plotOPTS.range_lat: [50.1000 50.4000]
0017 %   plotOPTS.range_lon: [-4.5000 -3.8500]
0018 %   plotOPTS.fig_name: 'co2_S5_slowleak'
0019 %   plotOPTS.mesh: [1x1 struct]
0020 %   plotOPTS.coastline_file: '../mat/tamar3_0coast.mat'
0021 %   plotOPTS.zone: 30
0022 %   plotOPTS.ell: 'grs80'
0023 %   plotOPTS.var_plot: 'PH'
0024 %   plotOPTS.clims: [6 8]
0025 %   plotOPTS.do_mesh: 0
0026 %   plotOPTS.nz_plot: 1
0027 %   plotOPTS.figure: 1
0028 %   plotOPTS.Time_record: 7.3271e+05
0029 %   plotOPTS.nz_plot_vec: 1
0030 %   plotOPTS.data_dec: 5
0031 %   plotOPTS.vel_sca: 5
0032 %   plotOPTS.pause: 0.5000
0033 
0034 %
0035 % OUTPUT:
0036 %   Plots = structure array with figure handles
0037 %
0038 % EXAMPLE USAGE
0039 %    [Plots]=do_surface_plot(plotOPTS,FVCOM)
0040 %
0041 % Author(s):
0042 %    Ricardo Torres and Pierre Cazenave (Plymouth Marine Laboratory)
0043 %
0044 % Revision history
0045 %
0046 %==============================================================================
0047 %
0048 % adds m_map to matlab paths. file is in utilities directory.
0049 % amend according to your m_map installation paths
0050 
0051 figure(plotOPTS.figure);clf
0052 % generate figure with correct projection lat and lon range ellipsoid and
0053 % zone.
0054 axesm('mercator','MapLatLimit',plotOPTS.range_lat,'MapLonLimit',[plotOPTS.range_lon],'MeridianLabel','on',...
0055     'ParallelLabel','on','MLineLocation',[0.1],'PLineLocation',[0.1],'LabelUnits','dm')
0056 
0057 
0058 % add coastline if present
0059 if (isfield(plotOPTS,'coastline_file') && ~isempty(plotOPTS.coastline_file) )
0060     coast=load(plotOPTS.coastline_file);
0061     geoshow([coast.ncst(:,2)],[coast.ncst(:,1)],'Color','black')
0062 
0063 end
0064 %------------------------------------------------------------------------------
0065 % Generate maps at a give level
0066 %------------------------------------------------------------------------------
0067     mstruct = gcm;
0068 
0069 
0070 [X, Y] = mfwdtran(mstruct,plotOPTS.mesh.lat, plotOPTS.mesh.lon);
0071 
0072  aa=plotOPTS.Time_record;
0073     fprintf('Time step %i of %i\n',aa,length(FVCOM.Time_record));
0074     %plot map
0075     hold on
0076     ND=ndims(FVCOM.(plotOPTS.var_plot))
0077     switch ND
0078         case 2
0079                 Plots(plotOPTS.figure).handles=patch('Vertices',[X,Y],'Faces',plotOPTS.mesh.tri,...
0080         'Cdata',squeeze(FVCOM.(plotOPTS.var_plot)(:,aa)),'edgecolor','interp','facecolor','interp');
0081 
0082         case 3
0083     Plots(plotOPTS.figure).handles=patch('Vertices',[X,Y],'Faces',plotOPTS.mesh.tri,...
0084         'Cdata',squeeze(FVCOM.(plotOPTS.var_plot)(:,plotOPTS.nz_plot,aa)),'edgecolor','interp','facecolor','interp');
0085     end
0086     caxis(plotOPTS.clims)
0087     colorbar h
0088     % check if mesh elements are required
0089     if plotOPTS.do_mesh
0090         %plot vertices
0091         Plots(plotOPTS.figure).mesh=patch('Vertices',[X,Y],'Faces',plotOPTS.mesh.tri,...
0092             'EdgeColor',[0.6 0.6 0.6],'FaceColor','none');hold on
0093 
0094     end
0095 %      setm(gca,'MapLatLimit',plotOPTS.range_lat,'MapLonLimit',[plotOPTS.range_lon])
0096      tightmap
0097     %-----------------------------------------------------------------------
0098     % Only in my case it needs adding 6 because proj automatically determines a
0099     % reference long in strides of 6deg while m_map doesn't
0100     %------------------------------------------------------------------------
0101     pause(plotOPTS.pause)
0102 %     if aa~=length(plotOPTS.Time_record)
0103 %         delete(Plots(plotOPTS.figure).handles(:))
0104 %     end
0105 
0106 %  end
0107 
0108  
0109  
0110  
0111  
0112  
0113  
0114 %  fprintf('Time step %i of %i\n',aa,length(plotOPTS.Time_record));
0115 %     %plot map
0116 %     hold on
0117 %     Plots(plotOPTS.figure).handles=patch('Vertices',[lat,lon],'Faces',plotOPTS.mesh.tri,...
0118 %         'Cdata',squeeze(FVCOM.(plotOPTS.var_plot)(:,plotOPTS.nz_plot,aa)),'edgecolor','interp','facecolor','interp');
0119 %
0120 %     caxis(plotOPTS.clims)
0121 %     colorbar
0122 %     % check if mesh elements are required
0123 %     if plotOPTS.do_mesh
0124 %         %plot vertices
0125 %         Plots(plotOPTS.figure).mesh=patch('Vertices',[lon,lat],'Faces',plotOPTS.mesh.tri,...
0126 %             'EdgeColor',[0.6 0.6 0.6],'FaceColor','none');hold on
0127 %
0128 %     end
0129 %     setm(gca,'MapLatLimit',plotOPTS.range_lat,'MapLonLimit',[plotOPTS.range_lon])
0130 %     %-----------------------------------------------------------------------
0131 %     % Only in my case it needs adding 6 because proj automatically determines a
0132 %     % reference long in strides of 6deg while m_map doesn't
0133 %     %------------------------------------------------------------------------
0134 %     pause(.2)
0135 %     if aa~=length(plotOPTS.Time_record)
0136 %         delete(Plots(plotOPTS.figure).handles(:))
0137 %     end
0138 %
0139 % end
0140 %
0141 return
0142

Generated on Wed 10-Aug-2016 16:44:39 by m2html © 2005